Skip to content

fix(otdfctl): DSPX-1561 pass the default assertion verification key to the SDK - #4304

Draft
dmihalcik-virtru wants to merge 1 commit into
mainfrom
DSPX-1561-default-key
Draft

dmihalcik-virtru wants to merge 1 commit into
mainfrom
DSPX-1561-default-key

Conversation

@dmihalcik-virtru

@dmihalcik-virtru dmihalcik-virtru commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Proposed Changes

  • The decrypt assertion verification keys file accepts defaultKey alongside keys, but the default key was never converted from its PEM or secret text, so the SDK could not use it. It is now converted like per-ID keys (HS256: the string's UTF-8 bytes; RS256: a PEM key).
  • A keys file that cannot be used as written is an error containing reason=configuration-error: an unknown top-level member (e.g. default_key; DefaultKey is still accepted), an HS256 key given as PEM text, or a key that cannot be read.
  • Fixes a nil dereference when an RSA PRIVATE KEY block fails to parse.
  • The man page documents defaultKey, and notes that it also applies to payload-key assertions (such as the system-metadata assertion Java writers add), so those files fail; list specific assertions under keys instead.

The Go SDK already uses DefaultKey for assertions without a per-ID key; this change only fixes the CLI. No new SDK API is used.

Split out of #4301 (draft; the complete change). Cross-SDK counterparts: opentdf/java-sdk#435, opentdf/web-sdk#1138.

Compatibility: keys files with unknown top-level members, or HS256 keys given as PEM text, are now rejected instead of being silently ignored or misused.

Checklist

  • I have added or updated unit tests
  • I have added or updated integration tests (if appropriate)
  • I have added or updated documentation

Testing Instructions

  • cd otdfctl && go test ./... -race (new cases in pkg/handlers/tdf_test.go).

…o the SDK

The decrypt command's assertion verification keys file accepts a
"defaultKey" alongside "keys", but that key was never converted from its
PEM or secret text, so the SDK could not use it. Convert it like the
per-ID keys. Report with reason=configuration-error a key that cannot be
used, an HS256 key given as PEM text, and any top-level member other than
"keys" and "defaultKey". Also stop dereferencing a nil key when an RSA
PRIVATE KEY block fails to parse, and document defaultKey.

Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
@dmihalcik-virtru
dmihalcik-virtru requested a review from a team as a code owner November 9, 2026 14:50
@coderabbitai

coderabbitai Bot commented Nov 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 51a403b4-6a78-4556-b276-42d257ba7da5
Commits

Reviewing files that changed from the base of the PR and between 57f15c4 and 765e203.

Files selected for processing: 3

  • otdfctl/docs/man/decrypt/_index.md
  • otdfctl/pkg/handlers/tdf.go
  • otdfctl/pkg/handlers/tdf_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor
Benchmark results, click to expand

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 223.982902ms
Throughput 446.46 requests/second

TDF3 Benchmark Results

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 23.958010493s
Average Latency 239.021417ms
Throughput 208.70 requests/second

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Govulncheck found vulnerabilities ⚠️

The following modules have known vulnerabilities:

  • otdfctl
  • sdk
  • service
  • tests-bdd

See the workflow run for details.

@dmihalcik-virtru
dmihalcik-virtru marked this pull request as draft November 17, 2026 04:55
@dmihalcik-virtru

Copy link
Copy Markdown
Member Author

Converting to draft until the xtest is merged

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant