Repository navigation
Fix quarantine ID collision evidence loss - #52
Closed
cursor[bot] wants to merge 1 commit into
Closed
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Co-authored-by: Andre Schu <[email protected]>
1 of 3 tasks
Owner
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.
Bug and impact
scp_utils.quarantine()truncateduuid4()values to the first 8 characters for file names. Two distinct UUIDs with the same prefix wrote to the same{id}.txt/{id}.jsonpair, silently overwriting earlier quarantine evidence. At scale, that 32-bit namespace creates a realistic evidence-loss path for injection captures and registry/antigen quarantine records.Root cause
The quarantine ID was generated with
str(uuid.uuid4())[:8]and the write path did not check whether the resulting pair already existed.Fix
Use the full UUID hex value for new quarantine IDs and retry if either the target content or metadata path already exists. Existing 8-character IDs remain listable/purgeable because the purge validator already accepts UUID-like IDs from 1 to 36 characters.
Validation
PYTHONPATH=src python3 -m pytest tests/test_security_regressions.py::test_quarantine_uses_full_uuid_to_avoid_prefix_collision -qfailed on current main with both writes returningaaaaaaaa.PYTHONPATH=src python3 -m pytest tests/test_security_regressions.py tests/test_registry_ssot.py tests/test_registry_fetch_r4.py tests/test_antigen_p0.py tests/test_antigen_p1_nostr.py tests/test_mcp_contract_v1.py -q-> 81 passed, 1 skipped.python3 -m compileall -q src/scpgit diff --check