Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: otdfctl throws different error on invalid tdf #222

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/xtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
env:
PLATFORM_REF: "${{ inputs.platform-ref || 'main' }}"
JS_REF: "${{ inputs.js-ref || 'main' }}"
OTDFCTL_REF: "${{ inputs.otdfctl-ref || 'main' }}"
OTDFCTL_REF: "${{ inputs.otdfctl-ref || 'return-invalidtdf-error' }}"
JAVA_REF: "${{ inputs.java-ref || 'main' }}"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
Expand Down
21 changes: 15 additions & 6 deletions xtest/test_tdfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ def test_tdf_with_unbound_policy(encrypt_sdk, decrypt_sdk, pt_file, tmp_dir):
tdfs.decrypt(decrypt_sdk, b_file, rt_file, "ztdf")
assert False, "decrypt succeeded unexpectedly"
except subprocess.CalledProcessError as exc:
assert b"wrap" in exc.output
assert b"tamper" in exc.output or b"InvalidFileError" in exc.output
assert (
b"tamper" in exc.output
or b"InvalidFileError" in exc.output
or b"invalid TDF" in exc.output
)


def test_tdf_with_altered_root_sig(encrypt_sdk, decrypt_sdk, pt_file, tmp_dir):
Expand All @@ -135,8 +138,11 @@ def test_tdf_with_altered_root_sig(encrypt_sdk, decrypt_sdk, pt_file, tmp_dir):
tdfs.decrypt(decrypt_sdk, b_file, rt_file, "ztdf")
assert False, "decrypt succeeded unexpectedly"
except subprocess.CalledProcessError as exc:
assert b"root" in exc.output
assert b"tamper" in exc.output or b"IntegrityError" in exc.output
assert (
b"tamper" in exc.output
or b"IntegrityError" in exc.output
or b"invalid TDF" in exc.output
)


def test_tdf_with_altered_seg_sig(encrypt_sdk, decrypt_sdk, pt_file, tmp_dir):
Expand All @@ -149,8 +155,11 @@ def test_tdf_with_altered_seg_sig(encrypt_sdk, decrypt_sdk, pt_file, tmp_dir):
tdfs.decrypt(decrypt_sdk, b_file, rt_file, "ztdf")
assert False, "decrypt succeeded unexpectedly"
except subprocess.CalledProcessError as exc:
assert b"signature" in exc.output
assert b"tamper" in exc.output or b"IntegrityError" in exc.output
assert (
b"tamper" in exc.output
or b"IntegrityError" in exc.output
or b"invalid TDF" in exc.output
)


def test_tdf_assertions(encrypt_sdk, decrypt_sdk, pt_file, tmp_dir):
Expand Down
Loading