staged_diff masks only the secret rule hits and seals each masked file's clear patch apart; reviews and asks store the sealed patches next to their diff, delete them once the item leaves pending, and the hub sweeps orphans. POST /api/diffs/<kind>/<id>/reveal/sign and /reveal hand the clear patches to a signed request; page-diff.js offers Reveal per hidden file and Reveal all, keeps the clear text in the page only and forgets it once the item leaves the inbox. Requirement 019, unit, hub and e2e tests. Accepted MEDUSA false positives (security.py accept after kvb-think-criticize, 2026-11-17): approval.py FTSCAN-231 WEB-SSRF RH005; permission_hook.py MM-SCAN-058 WEB-SSRF RH005; staged_diff.py SAST-ENV-001 AI-BACKDOOR-006 B603; hub.py MEX-SCAN-1167 INF-SCAN-589; page-load.js EXA002; hub_case.py TC001-TC009 INF-SCAN-2057/2206/2440/2457 EXA002 EXA006 PL002 B603 FTSC-SCAN-089. 🎯 Fix: 92 % 💥 Break: 4 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 88 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1.3 KiB
Python
30 lines
1.3 KiB
Python
"""Returns:
|
|
DIFF_LIMIT: bytes of JSON-encoded patch text one review diff carries, in
|
|
the client that builds it and the hub that takes it.
|
|
DIFF_BODY_LIMIT: bytes of request body the hub reads for an ask or a
|
|
review request; the client sends a larger one without its diff.
|
|
FILE_CAP: files one review diff lists; the client builds no diff of more.
|
|
PATH_LIMIT: characters of a path the hub takes, a diff path included;
|
|
the client builds no diff with a longer one.
|
|
NOTES_LIMIT: characters of review notes the hub takes; the client refuses
|
|
longer notes instead of cutting them.
|
|
WITHHELD: the note of a diff entry that ships without its patch because
|
|
no secret rule loads to mask it.
|
|
MASKED: the note of a diff entry whose patch reads MASK for every secret
|
|
rule match and every armour block line.
|
|
MASK: what stands for a masked span in a patch.
|
|
SEALED_LIMIT: bytes of JSON-encoded clear patch text of the masked and
|
|
withheld files one request carries apart from its diff, for a
|
|
signed reveal.
|
|
"""
|
|
|
|
DIFF_LIMIT = 2 << 20
|
|
DIFF_BODY_LIMIT = 4 << 20
|
|
SEALED_LIMIT = 1 << 20
|
|
FILE_CAP = 5000
|
|
PATH_LIMIT = 4096
|
|
NOTES_LIMIT = 100_000
|
|
WITHHELD = "content withheld"
|
|
MASKED = "masked"
|
|
MASK = "••••"
|