Skip to content

Fix registry contribution and SSOT safety gaps#12

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-936b
Draft

Fix registry contribution and SSOT safety gaps#12
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-936b

Conversation

@cursor

@cursor cursor Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

  • Structured patterns_json contribution could carry raw prompt text in source_ref metadata and publish it in the registry snapshot when approve=true and consent/host allowlist were configured.
  • Deeply nested URL-encoded override phrases could be decoded only to reversal tier instead of injection, so scp_validate_output would still mark them safe.
  • Registry SSOT writes were direct and committed before projection persistence; a failed projection write could leave SSOT updated while inspect continued using the stale projection, and corrupt SSOT JSON could crash fetch/diff paths.

Root cause

  • The contribution gate closed only top-level fields and did not constrain source_ref keys/values.
  • Canonicalization was capped at four layers.
  • SSOT/projection persistence used direct writes and committed SSOT before projection write success.

Fix

  • Reject unknown structured contribution detector/source-ref fields and constrain source_ref.lang to language-tag metadata.
  • Increase bounded canonicalization depth to catch five-layer URL encoding while retaining a hard cap.
  • Load corrupt SSOT fail-closed, write JSON via temp-file replace, and persist projection before committing SSOT.

Validation

  • PYTHONPATH=src python3 -m pytest -q tests/test_registry_contribute_r3.py::test_structured_patterns_rejects_unknown_detector_field tests/test_registry_contribute_r3.py::test_structured_patterns_rejects_unabstracted_source_ref_metadata tests/test_registry_contribute_r3.py::test_structured_patterns_rejects_unabstracted_source_ref_lang_value tests/test_sanitize_encoding_evasion.py::TestComposition::test_deep_url_encoded_injection_classified tests/test_registry_ssot.py::test_load_ssot_returns_empty_for_corrupt_json tests/test_registry_ssot.py::test_apply_merge_does_not_commit_ssot_when_projection_write_fails -> 6 passed
  • PYTHONPATH=src python3 -m pytest -q tests/test_registry_contribute_r3.py tests/test_sanitize_encoding_evasion.py tests/test_registry_ssot.py tests/test_registry_load_order_r5.py tests/test_registry_fetch_r4.py tests/test_appsec_host_allowlists.py -> 116 passed
  • PYTHONPATH=src python3 -m pytest -q with .[dev,antigen] installed -> 286 passed, 3 skipped, 3 known baseline contract hash failures in tests/test_contract_document_hash.py
Open in Web View Automation 

Co-authored-by: Andre Schu <Art.Int.Interface@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant