feat(orchestrator): reveal withheld diff content under a passkey signature (019)
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>
This commit is contained in:
1 parent
78d4e4a6aa
commit
af3555e88b
24 files changed
+928
-111
No files matched your search
@@ -15,9 +15,10 @@
|
||||
with the repository, worktree, branch and tree as git prints them
|
||||
here, the notes file's text (refused past NOTES_LIMIT characters),
|
||||
and the diff of the tree git write-tree prints against HEAD
|
||||
(staged_diff.tree_diff, content withheld per the MEDUSA rules under
|
||||
<dir>, by default those of the pipx install); without the diff when
|
||||
the body would pass DIFF_BODY_LIMIT.
|
||||
(staged_diff.tree_diff, secrets masked per the MEDUSA rules under
|
||||
<dir>, by default those of the pipx install) with the sealed clear
|
||||
patches of its masked files apart; without either when the body
|
||||
would pass DIFF_BODY_LIMIT.
|
||||
|
||||
Returns:
|
||||
pin: exit code 0 and the pinned credential on stdout; 1 and the reason
|
||||
@@ -89,14 +90,14 @@ def request_review(args: argparse.Namespace) -> str:
|
||||
item = staged(cwd, "0" * 16)
|
||||
try:
|
||||
notes = args.notes.read_text(encoding="utf-8")
|
||||
diff = staged_diff.tree_diff(cwd, item["tree"], args.rules or staged_diff.rules_root())
|
||||
diff, sealed = staged_diff.tree_diff(cwd, item["tree"], args.rules or staged_diff.rules_root())
|
||||
except (OSError, ValueError, staged_diff.DiffError) as error:
|
||||
raise Refused(f"the review cannot be prepared: {error}") from error
|
||||
if len(notes) > NOTES_LIMIT:
|
||||
raise Refused(f"the notes hold {len(notes)} characters, the hub takes at most {NOTES_LIMIT}")
|
||||
arguments = {key: item[key] for key in ("repo", "worktree", "branch", "tree")}
|
||||
arguments.update(title=args.title, page=str(args.page), notes=notes, gate=args.gate, score=args.score, agent=args.agent)
|
||||
body = review_body({**arguments, "diff": diff})
|
||||
body = review_body({**arguments, "diff": diff, "sealed": sealed})
|
||||
if len(body) > DIFF_BODY_LIMIT:
|
||||
print(f"approval: the review goes without its diff, its {len(body)} bytes pass the hub's {DIFF_BODY_LIMIT}", file=sys.stderr)
|
||||
body = review_body(arguments)
|
||||
|
||||
Reference in new issue
Block a user