fix(security): harden @general agent permission model and add git-commit gating validator#241
Merged
kyaulabs-bot merged 3 commits intoJul 23, 2026
Conversation
Records why the read-only contract did not cover the inline primary agent @general: it has no description, so it inherited the top-level permissive permission.bash (only git push* denied) and could git add/stage/commit with no gate. The fix mirrors build/design (git add*/stage*/commit*: ask + git push*: deny); general stays general-purpose, not read-only. The validator is extended to flag inline agents that can commit without an explicit gate. Refs: #202 Authored-by: glm-5.2 Tested-by: deepseek-v4-pro Signed-off-by: kyau <git@kyaulabs.com>
@general shipped only lsp: allow and inherited the top-level permission.bash (only git push* denied), so the most-invoked default agent could git add/stage/commit with no gate. Add the same bash block as build/design: "*" allow plus git add*/stage*/commit*: ask and git push*: deny. general stays general-purpose (not read-only); the safety hook of ADR-0023/0036 already covers destructive non-git commands harness-wide. Refs: #202 Authored-by: glm-5.2 Tested-by: deepseek-v4-pro Signed-off-by: kyau <git@kyaulabs.com>
Extends validate-harness.sh (ADR-0006 Decision #4) with a check that flags any inline agent whose bash is not a full deny but that lacks an explicit git commit* gate (ask/deny). inline-agent-permissions.js now emits a sixth column (git_commit verdict) and uses pipe delimiter to prevent IFS tab- collapsing of empty fields. Agents backed by .md files or without a project- level permission block are skipped. Prevents recurrence of the @general drift class (issue #202): an inline agent that inherits the top-level permissive default and can commit with no gate. Fixes: #202 Authored-by: glm-5.2 Tested-by: deepseek-v4-pro Signed-off-by: kyau <git@kyaulabs.com>
kyau
approved these changes
Jul 23, 2026
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.
📋 Summary
The
generalinline primary agent — the most-invoked default agent — shipped with onlylsp: allowand inherited the top-level permissivepermission.bash(which denied onlygit push*). This meant it couldgit add,git stage, andgit commitwith no approval gate, bypassing the permission model thatbuild/designalready enforce. This PR closes that gap and extends the harness validator so the drift class cannot recur.Three changes: (1) record the decision in ADR-0006, (2) add the same bash gate to
generalthatbuild/designcarry, (3) extendvalidate-harness.shto flag any inline agent that can git commit without an explicit gate.📦 Changes by Phase
Phase A — ADR amendment
adr/0006-readonly-agent-permission-contract.md— Appended
2026-07-22 (issue #202)amendment explaining why the read-only contract did not already covergeneral(no description → fell through every guard) and the mirror-build/design decision.Phase B — Config fix + regression test
opencode.jsonc(lines 130–137)— Replaced
general's bare{"lsp": "allow"}permission with a full bash block mirroringbuild/design:"*": "allow",git add*/stage*/commit*: ask,git push*: deny.tests/Unit/Harness/GeneralAgentPermissionTest.php— Pest regression test asserting all 4 git-verdict keys exist with correct values.
Phase C — Validator extension
.github/scripts/inline-agent-permissions.js— Switched from tab-delimited to pipe-delimited output to prevent IFS tab-collapsing of empty fields. Added 5th column (
git_commitverdict) and 6th column (has_permissionboolean). Updated header comment..github/scripts/validate-harness.sh— Updated the pre-existing
readfor the inline read-only check from 4→6 fields. Added a new inline-agent git-commit gating check that flags any agent whose bash is not a full deny but that lacks an explicitgit commit*gate (ask/deny). Skips.md-backed agents (their real permissions live in frontmatter) and built-in agents with no project-level permission block.tests/Shell/validate-harness_test.sh— Added 3 Shell tests (ungated → flagged, ask-gated → not flagged, bash:deny → skipped).
📜 ADRs
@generalgit-mutation gate decision and the validator extension for the inherited-default drift class✅ Verification
tests/Unit/Harness)tests/Shell/validate-harness_test.sh)🏗️ Architect Conditions (if applicable)
N/A — the change was scoped and low-complexity; the root cause was fully documented in the issue.
@debug's investigation loop had nothing to discover. Proceeded straight to plan +@tdd.📝 Commits (3 total)
Atomic, conventional-commits-formatted, signed. All reference
Refs: #202.dc2d779docs(adr)a4b4e2dfix(security)b6f9fc1fix(security)🧪 Test Plan
php vendor/bin/pest tests/Unit/Harness/GeneralAgentPermissionTest.php— Run the regression testphp -d pcov.enabled=1 vendor/bin/pest tests/Unit/Harness— Run the full harness suitebash tests/Shell/validate-harness_test.sh— Run the Shell validator testsbash .github/scripts/validate-harness.sh— Run the real-repo validatorgrep -A10 '"general":' opencode.jsonc— Verify thegeneralblock in opencode.jsonc. Should have: bash > git add*/stage*/commit*: ask, git push*: deny