Skip to content

fix(sdk): DSPX-4748 remove the unsupported unencrypted-payload read path - #431

Draft
dmihalcik-virtru wants to merge 1 commit into
mainfrom
DSPX-4748-java-sdk-reject-unencrypted-payload
Draft

dmihalcik-virtru wants to merge 1 commit into
mainfrom
DSPX-4748-java-sdk-reject-unencrypted-payload

Conversation

@dmihalcik-virtru

Copy link
Copy Markdown
Member

Summary

OpenTDF writers always produce TDFs with an encrypted payload, and reading a manifest that declares otherwise was never a supported feature. This removes that read path from the Java reader.

  • loadTDF rejects a manifest whose payload.isEncrypted is not true (false, null, or absent) with SDK.MalformedTDFException, immediately after the manifest is parsed.
  • Segment checks, root-signature checks, decryption, and segment-hash aggregation always use the encrypted-payload logic. The alternative branches, and the boolean parameter of Segments.aggregate, are removed.
  • The writer is unchanged; it always sets isEncrypted to true.

Testing

  • mvn -B -o -pl cmdline -am package -Dmaven.antrun.skip=true: sdk 442 tests (9 skipped), sdk-pqc-bc 54, cmdline 16, all passing.
  • New TDFUnencryptedPayloadTest: TDFs declaring isEncrypted as false, null, or absent are rejected as malformed, and an unmodified TDF still loads.

loadTDF now rejects a manifest whose payload.isEncrypted is not true (false, null or absent) with MalformedTDFException, immediately after the manifest is parsed and before any key access, integrity or assertion processing. Segments and the root signature are always checked with the payload key, segments are always decrypted, and the segment-hash aggregate is always built from base64-decoded hashes. The writer continues to set isEncrypted to true.

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

coderabbitai Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
B Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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