feat: address Table C, D, and E feedback items (regex fixes, HMAC commitments, static sinks)#36
Merged
Conversation
…mitments, static sinks)
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.
Description
This Pull Request addresses the remaining items in Table C (Security & Cryptography Claims) and Table E (Minor/Consistency/Small Bugs) from the external feedback report.
Proposed Changes
1. Fix SEC-004 Regex Pattern Compilation Error (Table E – Item E1)
Issue
The regex pattern for SEC-004 (Bulk Environment Variable Access) contained the inline
(?i)case-insensitive flag in the middle of the expression.Beginning with Python 3.11, this causes a runtime exception:
As a result, the detector silently failed to execute.
Fix
Moved the
(?i)flag to the beginning of the regex pattern in:Updated the normalized SHA-256 integrity hash:
located in:
so the integrity verification remains consistent with the modified mitigation catalog.
2. Implement Keyed/Salted
findings_hashCommitment (Table C – Item C2)Issue
The ledger previously computed
findings_hashas:Because the rule vocabulary is relatively small (approximately 47 rules), an attacker could feasibly enumerate all possible rule combinations offline and infer which governance rules were triggered.
Fix
Replaced the unhashed commitment with a keyed HMAC-SHA256 commitment salted using the unique
entry_id(UUID4).Security Benefits
3. Add Static Detectors for
eval,pickle.loads, and Hardcoded Credentials (Table E – Item E2)Issue
Several intentionally planted insecure constructs were not detected during static analysis, including:
eval()exec()pickle.loads()pickle.load()marshal.loads()Fix
Extended the mitigation catalog:
with two additional static detection rules.
MIT-004-B (SEC-004)
Detects hardcoded credentials such as:
MIT-010-A (SEC-010)
Detects dynamic execution sinks including:
eval(exec(pickle.loads(pickle.load(marshal.loads(Verification Plan
Automated Tests
Added:
The new test suite validates:
findings_hashoutputs for identical rule violations, confirming the keyed and salted HMAC implementation.eval()pickle.loads()Test Results
Executed the full test suite:
======================= 68 passed, 5 warnings in 24.56s =======================All tests completed successfully with no regressions observed.