Repository navigation
Introduce PDR 0.3 with registry context and RFC 8785 hashing - #62
Merged
Merged
Conversation
PDR generation now writes contract version 0.3. Document hashes, record hashes and run_id values differ from 0.2 for the same input. - Hashes use the RFC 8785 canonical form (qstriage/canonical_json.py). - registry_context (registry_id, registry_version, registry_hash) is recorded in the document and in each record. registry_hash is the RFC 8785 SHA-256 hash of the parsed algorithm_registry.json data. - run_id is derived from source_hash, policy_pack_hash, registry_hash and pdr_version. - observed_state adds scheme_type, components and validation_component. The current registry has no hybrid entries, so they are "single", [] and null. - Values that RFC 8785 cannot represent, such as integers above 2^53, stop PDR generation; no output file is written. - The registry file is rejected if it contains duplicate JSON keys. pdr verify checks 0.2 documents under the 0.2 rule and 0.3 documents under the 0.3 rule, including registry_context consistency for each record. A PDR 0.2 document generated before this change is kept as a test fixture and must keep verifying. A test binds each registry_version to one registry_hash, so a change to registry content requires a new registry_version. Decision, policy and evidence content is unchanged relative to the 0.2 fixture.
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.
Summary
PDR generation writes contract version 0.3. For the same input, document
hashes, record hashes and
run_iddiffer from 0.2. Decisions do not change.can recompute them from the parsed document.
registry_context(registry_id,registry_version,registry_hash)is recorded at document level and copied into each record.
registry_hashis the RFC 8785 SHA-256 hash of the parsedqstriage/algorithm_registry.jsondata, so formatting changes do notaffect it. The registry file is rejected if it has duplicate JSON keys.
run_idis derived fromsource_hash,policy_pack_hash,registry_hashandpdr_version.observed_stateaddsscheme_type,componentsandvalidation_component. With the current registry they aresingle,[]andnull; hybrid entries are added separately.stop
pdr generatewith exit code 1 and no output file.pdr verifyapplies the 0.2 rule to 0.2 documents and the 0.3 rule to0.3 documents. For 0.3 it also checks
registry_contextin every record.Verification
including
registry_hash, were recomputed with the independentrfc87850.1.4 package and matched.tests/fixtures/pdr_v0_2_sample.json, generated before this change,still verifies (27 of 27 checks), and tampering with it is detected.
pdr_version,run_id,registry_context, hashes and the newobserved_statefields. Decision, policy evaluation, evidence and mission content are
identical.
modified, and the three new fields are checked separately.
registry_version"1" to itsregistry_hash. A contentchange without a new version fails the suite.
32 of 32 checks; after changing one
action_typevalue it fails with29 of 32.
Documentation
docs/pdr-contract.md(0.3 contract, registry context, scheme fields,verification table),
docs/usage.md,docs/standards-and-classification.md,docs/algorithm-identifier-grammar.md, CHANGELOG (Unreleased, Changed).The README keeps its links to the v1.3.0 documentation and is updated
with the next release.