Repository navigation
Conversation
kddejong
force-pushed
the
feat/kiro-agent-permissions-gh-write
branch
from
October 23, 2026 22:40
463f5fa to
0238444
Compare
kddejong
marked this pull request as ready for review
October 23, 2026 23:18
kddejong
force-pushed
the
feat/kiro-agent-permissions-gh-write
branch
from
October 23, 2026 23:21
0238444 to
d69aa27
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4868 +/- ##
=======================================
Coverage 94.68% 94.68%
=======================================
Files 439 439
Lines 16004 16004
Branches 3108 3108
=======================================
Hits 15153 15153
Misses 468 468
Partials 383 383
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Configuration-only change to the three local
.kiro/agentsconfigs. Nosrc/ortest/changes, so there are no unit tests to run; the verification below is a policy-evaluation harness pluspre-commit.What changed
1.
issue-triagegets full issue-write accessPreviously it could comment and apply labels only. It can now:
gh issue commentgh issue editwith any flags — title, body, labels, milestone, assignees. The label-flags-only allowlist entry and the matching--title/--body/--milestone/assignee/project denies are gone.gh issue closegh issue reopengh issue createstays denied — filing new issues is a separate capability and was not requested.The prompt and
descriptionare rewritten to match. This matters more than the allowlist: the prompt previously said the agent "never closes or reopens an issue, never edits an issue's title or body", and an agent follows its prompt over its permissions. It still never writes code (that goes toissue-worker) and still presents a draft for approval rather than acting unprompted.2. The
permissionsblock is now machine-generatedThe hand-written
permissions.rulesglob block duplicatedtoolsSettings.execute_bash. Because it was hand-written,agent upgradetreated all three files as out of sync and refused to touch them:Deleting the block and running
kiro-cli agent upgrade --no-backup .kiro/agentsregenerates it from the regexes and adds akiroUpgradefingerprint. Acceptance test now passes:No
policiesfield is emitted, so there is no behaviour change from that direction.toolsSettings.execute_bashis preserved as-is and remains the single source. The diff is large (+782/-126) because the generator reformats to two-space indent and expands each glob onto its own line.One regex was changed to survive conversion.
(-P |--no-pager )*is a regex repetition, which the glob format cannot express; the converter emittedgit -P *status *, matching arbitrary text between the prefix and the subcommand — a real widening, andgit -P ; curl http://x ; status ypassed the glob check. Changing*to?converts cleanly togit -P status *, removes the conversion warning entirely, and is strictly narrower (it only drops repeated prefixes likegit -P -P log, which nothing issues). That probe is nowPROMPT.Two conversion warnings remain on
issue-worker, both unfixable in the glob format and both reported by the tool itself:^git push -u origin [A-Za-z0-9/._-]+$git push -u origin *.*push +-f.**push *-f*+widened to*; still denies3.
pre-commit runnarrowed toissue-workerRemoved from
issue-triageandpr-reviewer, kept onissue-worker. The "it writes, use a scratch worktree" note is removed from the two read-only prompts along with the permission.Two facts worth weighing before this sticks:
pr-revieweralready hadpre-commit runbefore this PR, so this narrows a pre-existing permission rather than declining a new one.statusCheckRollupempty — first-time contributors need workflow approval), and two had CI-detectable defects that only a local-m datarun surfaced.Re-adding one allowlist line per agent reverses this. Implemented as asked.
Verification
Both policy blocks evaluated independently with
DENY > ALLOW > PROMPT— regexes as anchored full matches againsttoolsSettings.execute_bash, globs asfnmatchagainstpermissions.rules.gh issue comment 4771 --body-file /tmp/x.mdgh issue edit 4771 --add-label buggh issue edit 4771 --title "new title"gh issue edit 4771 --body "rewritten"gh issue close 4771gh issue reopen 4771gh issue create --title xgh pr merge 4868gh pr ready 4868gh pr review 4868 --approvegh api repos/xgit push origin maingh issue comment 1 --body x; rm -rf /pre-commit run --all-filesgh issue comment 1 --body xgh issue edit 1 --title xgh pr review 4868 --approvepre-commit run --all-filesgh pr create --draft --title x --body ygh issue comment 4771 --body hipre-commit run --all-filesgh pr create --title x --body ygh pr create --title "x --draft y" --body zgh pr ready 4868gh pr merge 4868gh api repos/x26 cases, 0 failing.
pre-commit run --all-filesfor the two read-only agents is PROMPT, not DENY — it is no longer auto-approved, but it is not blocked either, so a human can still approve it case by case. Making it DENY would need an explicit deny entry; say the word if that is preferred.Does the metacharacter looseness survive?
Yes, and it is a format limitation rather than something introduced here. The glob format has no way to express "no shell metacharacters", which the regexes do with
[^;|&\$]. The tool flags every such conversion itself asregex-shell-pattern`.gh issue view 1; curl http://xgit status; curl http://xgit -P ; curl http://x ; status yRegeneration moved two of these in the safe direction, because a trailing
cmd*becamecmd *pluscmd— sogit status; curl http://xis now PROMPT where the hand-writtengit status*allowed it. The first row is unchanged and still loose. No claim of parity between the two blocks is being made.Could the
permissionsblock be dropped entirely?Recommendation: no, do not drop it. Two findings:
Its absence is itself drift. With
permissionsremoved,agent upgrade --dry-runreports the file aswould upgraderather than clean. Dropping the block permanently is therefore not a stable state whileagent upgradeis the maintenance path — the tool wants to re-add it, so drift detection would be permanently noisy, which is exactly what this PR set out to fix.I could not establish that the second engine is unused, only that this repo never invokes either.
agent upgrade --helpsays the universal format is what "both engines load". The regex block is demonstrably the one in force for CLI sessions: a blocked command reports the regex verbatim (.*rm -rf.*), not the glob. But these agents are referenced nowhere in the repo — no CI, no scripts, nothing outside.kiro/agents/— so they are launched interactively, and I cannot rule out this repo being opened in an editor-hosted runtime that readspermissionsinstead.Given it is now generated and fingerprinted, keeping it costs a stale-free regeneration step and nothing else. Dropping it would close the metacharacter looseness for good, so it is worth revisiting — but it needs someone who can confirm the second engine is unused, which I could not do from here. Not acted on.
Commands run
All three files are valid JSON with a trailing newline.
kiro-clion PATH here is 2.34.0 (both PATH entries resolve to it; a 2.33.1 install exists but nothing links to it).