Skip to content

feat(security): implement shell execution policy and runtime bypass guardrails - #4

Merged
nicolasvd merged 1 commit into
mainfrom
feat/issue-3-shell-execution-guardrails
Sep 23, 2026
Merged

nicolasvd merged 1 commit into
mainfrom
feat/issue-3-shell-execution-guardrails

Conversation

@nicolasvd

Copy link
Copy Markdown
Owner

Closes #3

📌 Summary

Branch: feat/issue-3-shell-execution-guardrails → main
Type: feat(security)
Related Issue: #3 feat(security): implement shell execution policy and runtime bypass guardrails

  • Principle of Least Privilege (PoLP): Formally revoked run_command from Inception persona P4 (p4-system-architect.md), confining shell execution strictly to delivery personas P5 and P6.
  • Runtime PreToolUse Guardrail (plan-guard.mjs): Intercepts run_command to reject airbag circumvention (--no-verify, -n), hook path overrides (-c core.hooksPath, GIT_HOOKS_PATH), and direct commits/pushes to protected branches (main, master), closing findings S-01, S-02, and S-03.
  • Canonical Path Hardening (branch-guard.mjs): Hardened isArtifactPath to eliminate loose endsWith checks and strictly validate external brain artifact canonical paths, preventing path evasion on main and closing finding S-04.
  • Automated Verification Suite: Added scripts/test-runtime-guardrails.mjs verifying 18 deterministic test vectors across PoLP, plan-guard, and branch-guard.

📂 Affected Files

File Diff Role
.agent/personas/p4-system-architect.md +1 -1 Revoke run_command (PoLP)
.agent/hooks/branch-guard.mjs +40 -35 Canonical path hardening (S-04)
.agent/hooks/plan-guard.mjs +144 -0 Runtime PreToolUse guardrail (S-01, S-02, S-03)
.agent/hooks.json +16 -0 Register plan-guard hook for run_command
scripts/validate-docs.sh +1 -0 Add executable check for plan-guard.mjs
scripts/test-runtime-guardrails.mjs +276 -0 Automated test suite for runtime guardrails

✅ Quality Airbag — ./scripts/quality-check.sh

Check Result
Kotlin / Java compilation ✅ 0 errors
Android Lint (debug) ✅ 0 warnings
Android Lint (release) ✅ 0 warnings
Unit tests & Screenshot tests ✅ Passed (UP-TO-DATE) · 0 failed
Guardrails test suite ✅ 18/18 passed · 0 failed
./scripts/validate-docs.sh ✅ All contracts valid & byte budgets respected

⚡ FinOps & Agent Efficiency

Metric Measurement Status
Conversation turns 4 turns ✅ Optimal (< 20)
Circuit Breaker 0 trip (max 3 iterations) ✅ Passed · No loop
Context Hygiene Clean persona transitions ✅ Compliant
Security Drift Check Zero bypass vectors open ✅ Compliant

📸 UI Snapshots / Roborazzi Visual Diffs

N/A — Pure runtime governance, persona security, and hook enforcement changes. Zero UI or composable modifications.


Caution

Zero Auto-Merge — Explicit approval required.
This PR will NOT be merged until the author explicitly confirms: "Tu peux merger" or equivalent.
Persona 6 presents this PR link and stops. Merge is a deliberate human action.

…uardrails

- Revoke run_command from P1-P4 personas to enforce PoLP
- Implement plan-guard.mjs PreToolUse hook intercepting run_command (S-01, S-02, S-03)
- Harden branch-guard.mjs isArtifactPath to block workspace path escapes (S-04)
- Register plan-guard in hooks.json and validate in validate-docs.sh
- Add scripts/test-runtime-guardrails.mjs test suite

Closes #3
@nicolasvd nicolasvd added the skip-release Skip APK artifact release and distribution label Sep 22, 2026
@nicolasvd
nicolasvd merged commit 8a6b257 into main Sep 23, 2026
3 checks passed
@nicolasvd
nicolasvd deleted the feat/issue-3-shell-execution-guardrails branch September 23, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-release Skip APK artifact release and distribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(security): implement shell execution policy and runtime bypass guardrails

1 participant