Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions otdfctl/cmd/tdf/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func inspectRun(cmd *cobra.Command, args []string) {

func InitInspectCommand() {
inspectDoc.GroupID = TDF
inspectDoc.Args = cobra.MaximumNArgs(1)

inspectDoc.PreRun = func(cmd *cobra.Command, args []string) {
// Set the json flag to true since we only support json output
Expand Down
14 changes: 14 additions & 0 deletions otdfctl/e2e/encrypt-decrypt.bats
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ teardown_file(){
./otdfctl decrypt --host $HOST --tls-no-verify $DEBUG_LEVEL $WITH_CREDS $OUTFILE_TXT | grep "$SECRET_TEXT"
}

@test "inspect TDF3, one attribute, stdin" {
echo $SECRET_TEXT | ./otdfctl encrypt -o $OUT_TXT --host $HOST --tls-no-verify $DEBUG_LEVEL $WITH_CREDS -a $FQN

inspect_output=$(cat $OUTFILE_TXT | ./otdfctl --host $HOST --tls-no-verify $WITH_CREDS inspect)
assert_equal "$(echo "$inspect_output" | jq -r '.manifest.encryptionInformation.keyAccess | length')" "1"
}

@test "inspect rejects extra positional arguments" {
echo $SECRET_TEXT | ./otdfctl encrypt -o $OUT_TXT --host $HOST --tls-no-verify $DEBUG_LEVEL $WITH_CREDS -a $FQN

run sh -c "./otdfctl --host $HOST --tls-no-verify $WITH_CREDS inspect $OUTFILE_TXT extra-arg"
assert_failure
}

@test "allow traversal with mapped key uses definition when value missing" {
local attr_name="attr-allow-traversal-${RANDOM}"
local kas_name="kas-allow-traversal-${RANDOM}"
Expand Down
Loading