Skip to content

test(xtest): demonstrate session-key audit gap against unpatched web-sdk - #572

Draft
dmihalcik-virtru wants to merge 1 commit into
DSPX-4221-pq-sessionsfrom
DSPX-4221-pq-sessions-js-audit-gap
Draft

test(xtest): demonstrate session-key audit gap against unpatched web-sdk#572
dmihalcik-virtru wants to merge 1 commit into
DSPX-4221-pq-sessionsfrom
DSPX-4221-pq-sessions-js-audit-gap

Conversation

@dmihalcik-virtru

Copy link
Copy Markdown
Member

Stacked on #571 — do not merge into main directly.

Adds test_session_key_ec_roundtrip, isolating a known gap flagged in that PR's review (see the TODO(DSPX-4221) in assert_rewrap_session_key_type(), xtest/audit_logs.py): the audit-log assertion added for ML-KEM/RSA/EC session keys can't statically tell "platform too old to emit eventMetaData.sessionKeyType" apart from "platform new enough, but the client sent the wrong session-key type" — there's no released platform version yet to gate on (opentdf/platform#3814 is still unmerged).

That gap is real, not hypothetical: web-sdk at main silently ignores the requested session-key algorithm on EC rewrap and always negotiates rsa:2048, regardless of what's requested — the same bug already fixed in opentdf/web-sdk#975, just not yet merged to main. Against today's unpatched platform CI matrix, this is invisible (the field is absent for every rewrap, so the assertion falls back to a warning). Paired with a patched platform (opentdf/platform#3814's branch), it's a hard failure:

FAILED test_pqc.py::test_session_key_ec_roundtrip[small-js@refs--pull--975--head-js@main-in_focus0]
FAILED test_pqc.py::test_session_key_ec_roundtrip[small-js@main-js@main-in_focus0]
AssertionError: Expected rewrap session_key_type='ec:secp256r1', but platform reported {'rsa:2048'}

Reproduced locally against go/java (all branch combos, all pass) and web-sdk's own PR branch (passes) — fails specifically for js@main.

To reproduce in CI, trigger xtest.yml via workflow_dispatch on this branch with platform-ref: pr:3814, js-ref: main, focus-sdk: js.

Purpose: give the TODO in #571 something concrete to link to, and a CI job that will go green on its own once opentdf/web-sdk#975 merges (or start reliably red-flagging regressions once opentdf/platform#3814 releases and the TODO's version gate lands).

Adds test_session_key_ec_roundtrip, a sibling of test_session_key_rsa_roundtrip
and test_session_key_mlkem_roundtrip, isolating the gap documented in
assert_rewrap_session_key_type()'s TODO into its own unambiguous test.

Expected to fail when run with an unpatched web-sdk (main) as the decrypt
SDK, paired with a platform build that emits eventMetaData.sessionKeyType
(opentdf/platform#3814): web-sdk main silently ignores the requested
session-key algorithm on EC rewrap and always negotiates rsa:2048 instead
of the requested ec:secp256r1 -- the same bug already fixed in
opentdf/web-sdk#975 (untested there, since that fix hasn't merged).

Reproduced locally: passes for go/java (all branch combos) and for
web-sdk's PR branch, fails specifically for js@main:

  FAILED test_pqc.py::test_session_key_ec_roundtrip[small-js@refs--pull--975--head-js@main-in_focus0]
  FAILED test_pqc.py::test_session_key_ec_roundtrip[small-js@main-js@main-in_focus0]
  AssertionError: Expected rewrap session_key_type='ec:secp256r1', but platform reported {'rsa:2048'}

This commit is intentionally stacked on top of (not merged into)
DSPX-4221-pq-sessions, as a linkable reproduction of a known, tracked gap
-- not part of the feature itself.

Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d920aed2-75b1-4d2b-8da6-c91f09b8e3dc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

sonarqubecloud Bot commented Aug 3, 2026

Copy link
Copy Markdown

@dmihalcik-virtru

Copy link
Copy Markdown
Member Author

Reproduced in CI: triggered xtest.yml via workflow_dispatch on this branch with platform-ref: refs/pull/3814/head, js-ref: main, focus-sdk: js.

Run: https://github.com/opentdf/tests/actions/runs/30833192027

xct (pull-3814, js@main) fails exactly as described, via the pre-existing test_tdf_roundtrip ecwrap assertion (the job fails before reaching test_pqc.py's new test_session_key_ec_roundtrip, but the underlying bug is the same one that test isolates):

FAILED test_tdfs.py::test_tdf_roundtrip[small-js@main-js@main-in_focus0-ztdf] - AssertionError: Expected rewrap session_key_type='ec:secp256r1', but platform reported {'rsa:2048'}
FAILED test_tdfs.py::test_tdf_roundtrip[small-js@main-js@main-in_focus0-ztdf-ecwrap] - AssertionError: Expected rewrap session_key_type='ec:secp256r1', but platform reported {'rsa:2048'}

(Note for reproducing this yourself: otdf-sdk-mgr versions resolve doesn't accept the pr:N shorthand otdf-sdk-mgr install tip does -- use refs/pull/N/head for the platform-ref workflow_dispatch input instead.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant