Repository navigation
feat(baseline): key baselines with HMAC-SHA-256 in schema 4 (#225) - #235
Merged
Merged
Conversation
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
A schema 3 baseline holds no plain text, but its digests let anyone test candidate values offline. With a key, the baseline is recorded in schema 4: every digest (line text, value, JSON pointer) is an HMAC-SHA-256 under the key, and a
key_checkvalue tells the key apart without revealing it.--baseline-key-filenames (first), which must not be the analysed directory's or the baseline itself (compared as files: letter case, symlinks and firmlinks do not hide it), elseCORETRACE_BASELINE_KEY. At least 16 bytes; trailing line breaks are dropped from both; an empty variable is an error. The key never appears in a report, message or file.--record-baselinerecords explicitly (migration, key rotation); the file is replaced atomically (temporary file, fsync,os.replace, through a symlink, keeping its mode) only once the analysis succeeded and the report is rendered. Recording over a schema 4 baseline without its key is refused.findings/baseline.py; reporters never see the key.Verification
New tests in
tests/test_baseline_key.py(missing, wrong, prioritised and unusable keys, rotation, failed recording, unkeyed baselines refused with a key and migrated by an explicit record, old schemas without a key). No existing test changed. Independent review; its confirmed defects are fixed. Full suite green on 3.14 (apart from the localtest_packagingenvironment issue) and 3.11; ruff, mypy clean; regression snapshots unchanged.Closes #225