fix(schema): put the spec version at the manifest root and stop rejecting real TDFs - #70
Draft
pflynn-virtru wants to merge 1 commit into
Draft
pflynn-virtru wants to merge 1 commit into
pflynn-virtru wants to merge 1 commit into
Conversation
…ting real TDFs json-schema/schema.json declared tdf_spec_version under payload and listed it in payload.required. manifest.md has always documented the spec version as a top-level field, and payload.md never listed it at all, so the schema was the outlier of the three. The required entry made the normative schema reject every TDF anyone writes: against the eight golden containers in opentdf/tests it failed 8/8, each time on `'tdf_spec_version' is a required property`. It now passes 7, matching what platform's copy of this schema accepts. The eighth omits method.isStreamable and fails on platform too; that constraint is left alone here so the two copies stay in step. Changes: * schemaVersion is declared at the root as the canonical name. Nothing declared it before, in any copy of this schema, though it is the name every current SDK writes. * tdf_spec_version is declared at the root as deprecated, and kept under payload as deprecated, typed to admit null. Both positions occur in archival files -- the root because writers followed manifest.md, payload because they followed this schema's error -- so readers have to take either. A new "Spec Version Naming" section in manifest.md states the reader/writer rules. * mimeType leaves payload.required. Platform dropped it in Nov 2024, one day after this schema was forked from it; the fix never came back across. * policyBinding accepts a bare string, keyAccess.type gains ec-wrapped and hybrid-wrapped, and ephemeralPublicKey is declared. These have been in platform's copy since 2025 and describe key access objects that exist. * rootSignature.alg is pinned to HS256. * rootSignature.sig, segments[].hash and policyBinding.hash now state that the pre-4.3.0 hex spelling MUST be accepted indefinitely, and that a reader should tell the two apart by decoded length rather than by the spec version, which nothing authenticates. Requested in platform#3597. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Paul Flynn <pflynn-virtru@users.noreply.github.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
json-schema/schema.jsondeclaredtdf_spec_versionunderpayloadand listed it inpayload.required.manifest.mdhas always documented the spec version as a top-level field, andpayload.mdnever listed it at all — so the schema was the outlier of the three. This aligns the schema with the documentation and with what implementations actually write.schemaVersionis declared at the root as the canonical name. Nothing declared it before, in any copy of this schema, though it is the name every current SDK writes.tdf_spec_versionis declared at the root as deprecated, and kept underpayloadas deprecated, typed to admitnull. Both positions occur in archival files — the root because writers followedmanifest.md,payloadbecause they followed this schema's error — so readers have to take either. A new Spec Version Naming section inmanifest.mdstates the reader/writer rules: readers MUST accept both names in both positions and preferschemaVersion; writers MUST emit onlyschemaVersion.mimeTypeleavespayload.required. Platform dropped it in Nov 2024, one day after this schema was forked from it; the fix never came back across.policyBindingaccepts a bare string,keyAccess.typegainsec-wrappedandhybrid-wrapped, andephemeralPublicKeyis declared. These have been in platform's copy since 2025 and describe key access objects that exist today.rootSignature.algis pinned toHS256. The root signature covers the aggregate hash, which AES-GCM never processes, so a GMAC root has no authentication tag to read back out.rootSignature.sig,segments[].hashandpolicyBinding.hashnow state that the pre-4.3.0 hex spelling MUST be accepted indefinitely, and that a reader should tell the two apart by decoded length rather than by the spec version, which nothing authenticates. Requested in fix(sdk): align policy binding encoding with spec, keep legacy compat platform#3597.Why
The
requiredentry made the normative schema reject every TDF anyone writes. Against the eight golden containers inopentdf/testsit failed 8/8, each time on'tdf_spec_version' is a required property. With this change it passes 7, matching what platform's copy of this schema accepts. The eighth omitsmethod.isStreamableand fails on platform too; that constraint is left alone here so the two copies stay in step.The
payloadplacement was not merely unused — it propagated. A writer built from this schema emitted the key underpayload, and readers that trusted the documented root position decoded no spec version at all.Notes
$idstill readshttps://example.com/manifest.schema.json. Giving the schema a real identifier is a separate decision, still open, and it travels with chore(sdk): give the bundled manifest schemas real $id values platform#4070 rather than riding along here.rootSignature.alg: ["HS256"], matches what platform has enforced for some time; a cross-SDK run is checking that no SDK writes a GMAC root.🤖 Generated with Claude Code