enhance dangerous pattern recognition in hooks: rf, force push, sql...#118
enhance dangerous pattern recognition in hooks: rf, force push, sql...#118sveto wants to merge 5 commits into
Conversation
…atterns, .env, <redacted>
Rosetta Triage ReviewSummary: This PR strengthens the Findings:
Suggestions:
Automated triage by Rosetta agent |
Rosetta Triage ReviewSummary: This PR significantly expands the dangerous-actions hook's detection coverage across six dimensions (G-1 through G-6): unified shell evaluation against all three pattern sets (bash, paths, content), robust Findings:
Suggestions:
Automated triage by Rosetta agent |
G-1:
evalBashnow also checksDANGEROUS_PATHSandDANGEROUS_CONTENT; same formcp.G-2:
rm -r -fand similar commands with flags are now being catched, including situations where the flags are written after the folder name:rm myfolder/ -r -f,rm myfolder -rfetc; also including situations when a flag is inside quotation marks (rm '-rf').G-3: force push with
+prefix being catched, excluding cases where+means something else.G-4: dangerous SQL expressions are being catched, strictly before the first
;.Problems (worth discussion):
;in a text field:UPDATE t SET col = 'a;b' WHERE id = 5->deny← should beallowedWHEREin a subquery:UPDATE t SET x=(SELECT y FROM z WHERE z.id=1)->allowed← should bedenyWHEREin a comment:DELETE FROM users -- WHERE never-> allowed ← should bedeny-- such expressions are hard to catch by a regex. SQL is a language with recursive syntax. ;(
G-5:
.envis now being catched before word end, like in.envandapp.env, but not.envfileorfoo.envx.G-6: password-like expressions are now catched and republished as
KEY= < redacted >instead ofKEY=sk-proj-blablah.