Skip to content

feat(cli): accept a DPoP signing key and algorithm (DSPX-3397) - #991

Draft
dmihalcik-virtru wants to merge 1 commit into
dspx-3397-4-ci-keycloak-26from
dspx-3397-5-cli-dpop-keys
Draft

feat(cli): accept a DPoP signing key and algorithm (DSPX-3397)#991
dmihalcik-virtru wants to merge 1 commit into
dspx-3397-4-ci-keycloak-26from
dspx-3397-5-cli-dpop-keys

Conversation

@dmihalcik-virtru

@dmihalcik-virtru dmihalcik-virtru commented Aug 10, 2026

Copy link
Copy Markdown
Member

Stack 4/6, split out of #939. Base: #990.

What

--dpop was a boolean that always generated an ephemeral RSA key, so the CLI could not exercise ECDSA proofs or reuse a key across invocations. Both are needed to test DPoP against a real IdP, and by the cross-SDK harness.

Changes

  • --dpop[=ALG] optionally takes ES256, ES384, ES512 or RS256 and generates an ephemeral key of that type. Bare --dpop defaults to ES256.
  • --dpopKey <file> loads a PEM private key and infers its algorithm. Combined with an explicit --dpop=ALG, the key is checked against the requested alg, so a mismatch fails with a clear message instead of an opaque WebCrypto error at signing time. Bare --dpop --dpopKey k.pem infers from the key and does not conflict.
  • supports <feature> reports whether this build implements a feature (currently just dpop), exiting non-zero when it does not. Cross-SDK test harnesses use this to skip cases a given SDK build cannot run, rather than hard-coding version checks. Nothing in this repo calls it — the consumer is the xtest harness.
  • cli/src/dpop-helpers.ts holds the key generation/loading/validation, kept out of cli.ts so it is directly unit-testable.

Also

Replaces the console.assert calls in argument validation with thrown CLIErrors. console.assert only prints — it does not halt — so invalid input was being logged and then used anyway.

Tests

cli/tests/dpop-helpers.spec.ts — 30 cases covering generation per alg, PEM loading, algorithm inference, explicit/inferred conflict resolution, and the --no-dpop / bare---dpop argument shapes.

How to test

cd cli && npm test

@coderabbitai

coderabbitai Bot commented Aug 10, 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: 7b0cbdda-664b-4f61-96e3-873fa8c57051

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.

@dmihalcik-virtru
dmihalcik-virtru force-pushed the dspx-3397-4-ci-keycloak-26 branch from 3ae0223 to 45582fe Compare August 10, 2026 17:47
@dmihalcik-virtru
dmihalcik-virtru force-pushed the dspx-3397-5-cli-dpop-keys branch from e6accca to 435b290 Compare August 10, 2026 17:47
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

X-Test Failure Report

opentdf-ctl
opentdf-sdk-lib

`--dpop` was a boolean that always generated an ephemeral RSA key, so the CLI
could not exercise ECDSA proofs or reuse a key across invocations. Both are
needed to test DPoP against a real IdP.

- `--dpop[=ALG]` now optionally takes ES256, ES384, ES512 or RS256 and
  generates an ephemeral key of that type; bare `--dpop` defaults to ES256.
- `--dpopKey <file>` loads a PEM private key and infers its algorithm.
  Combined with an explicit `--dpop=ALG`, the key is checked against the
  requested alg so a mismatch fails with a clear message instead of an opaque
  WebCrypto error at signing time.
- `supports <feature>` reports whether this build implements a feature
  (currently just `dpop`), exiting non-zero when it does not. Cross-SDK test
  harnesses use this to skip cases a given SDK build cannot run, rather than
  hard-coding version checks.

Replaces the `console.assert` calls in argument validation with thrown
CLIErrors. `console.assert` only prints -- it does not halt -- so invalid
input was being logged and then used anyway.

Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
@dmihalcik-virtru
dmihalcik-virtru force-pushed the dspx-3397-5-cli-dpop-keys branch from 435b290 to e307560 Compare August 11, 2026 17:54
@dmihalcik-virtru
dmihalcik-virtru force-pushed the dspx-3397-4-ci-keycloak-26 branch from 45582fe to 41dad28 Compare August 11, 2026 17:54
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