-
Notifications
You must be signed in to change notification settings - Fork 0
fix(guardrails): address review follow-up findings (#104-107) #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6eb3c44
0426e23
8ae78d2
be3a4e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -514,7 +514,7 @@ export default async function guardrail(input: { | |
| const protectedBranch = /^(main|master|develop|dev)$/ | ||
| if (/\bgit\s+push\b/i.test(cmd)) { | ||
| // Check explicit branch target | ||
| const explicitMatch = cmd.match(/\bgit\s+push\s+\S+\s+(?:HEAD:)?(\S+)/i) | ||
| const explicitMatch = cmd.match(/\bgit\s+push\s+(?:(?:-\w+|--[\w-]+)\s+)*\S+\s+(?:HEAD:)?(\S+)/i) | ||
| if (explicitMatch && protectedBranch.test(explicitMatch[1])) { | ||
|
Comment on lines
514
to
518
|
||
| throw new Error(text("direct push to protected branch blocked — use a PR workflow")) | ||
| } | ||
|
|
@@ -524,7 +524,7 @@ export default async function guardrail(input: { | |
| throw new Error(text("direct push to protected branch blocked — use a PR workflow")) | ||
| } | ||
| // Plain `git push` with no branch — check current branch | ||
| if (!/\bgit\s+push\s+\S+\s+\S+/i.test(cmd)) { | ||
| if (!/\bgit\s+push\s+(?:(?:-\w+|--[\w-]+)\s+)*\S+\s+\S+/i.test(cmd)) { | ||
| try { | ||
|
Comment on lines
526
to
528
|
||
| const result = await git(input.worktree, ["branch", "--show-current"]) | ||
| if (result.stdout && protectedBranch.test(result.stdout.trim())) { | ||
|
|
@@ -609,7 +609,7 @@ export default async function guardrail(input: { | |
| out.output += "\n\n📝 Source code edited (3+ operations). Check if related documentation (README, AGENTS.md, ADRs) needs updating." | ||
| } | ||
| // Auto-format reminder after 3+ source edits | ||
| if (nextEditCount >= 3 && nextEditCount % 3 === 0) { | ||
| if (code(file) && nextEditCount >= 3 && nextEditCount % 3 === 0) { | ||
| out.output = (out.output || "") + "\n🎨 " + nextEditCount + " source edits — consider running formatter (`prettier --write`, `biome format`, `go fmt`)." | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These
grepdeny patterns won’t actually prevent reading.env/key material via thegreptool, becauseGrepToolasks permission againstparams.pattern(the regex searched for), not the file paths being scanned. As a result,grep "DATABASE_URL"over a repo will still return matches from.envfiles. To fix #105 you likely need to (a) remove/disablegrepfor this agent, or (b) update the grep tool/permission model to authorize based on searched file paths (or at least exclude sensitive globs in the tool itself before returning matches).