$npx -y skills add Rune-kit/rune --skill sentinelAutomated security gatekeeper. Blocks unsafe code before commit — secret scanning, OWASP top 10, dependency audit, permission checks. A GATE, not a suggestion.
| 1 | # sentinel |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | Automated security gatekeeper that blocks unsafe code BEFORE commit. Unlike `review` which suggests improvements, sentinel is a hard gate — it BLOCKS on critical findings. Runs secret scanning, OWASP top 10 pattern detection, dependency auditing, and destructive command checks. Escalates to opus for deep security audit when critical patterns detected. |
| 6 | |
| 7 | <HARD-GATE> |
| 8 | If status is BLOCK, output the report and STOP. Do not hand off to commit. The calling skill (`cook`, `preflight`, `deploy`) must halt until the developer fixes all BLOCK findings and re-runs sentinel. |
| 9 | </HARD-GATE> |
| 10 | |
| 11 | ## Triggers |
| 12 | |
| 13 | - Called automatically by `cook` before commit phase |
| 14 | - Called by `preflight` as security sub-check |
| 15 | - Called by `deploy` before deployment |
| 16 | - `/rune sentinel` — manual security scan |
| 17 | - Auto-trigger: when `.env`, auth files, or security-critical code is modified |
| 18 | - Signal: `quarantine.notice.emitted` (from `rune:quarantine`) — escalate when the same untrusted MCP namespace is quarantined ≥5× in a session (suggests prompt-injection attempt) |
| 19 | |
| 20 | ## Calls (outbound) |
| 21 | |
| 22 | - `scout` (L2): scan changed files to identify security-relevant code |
| 23 | - `verification` (L3): run security tools (npm audit, pip audit, cargo audit) |
| 24 | - `integrity-check` (L3): agentic security validation of .rune/ state files |
| 25 | - `sast` (L3): deep static analysis with Semgrep, Bandit, ESLint security rules |
| 26 | - `neural-memory` (ext): after any BLOCK finding — capture vulnerability pattern + root cause so the same vector isn't introduced again in future sessions |
| 27 | |
| 28 | ## Called By (inbound) |
| 29 | |
| 30 | - `cook` (L1): auto-trigger before commit phase |
| 31 | - `review` (L2): when security-critical code detected |
| 32 | - `deploy` (L2): pre-deployment security check |
| 33 | - `preflight` (L2): security sub-check in quality gate |
| 34 | - `audit` (L2): Phase 2 full security audit |
| 35 | - `incident` (L2): security dimension check during incident response |
| 36 | - `review-intake` (L2): security scan on code submitted for structured review |
| 37 | - `adversary` (L2): deep security analysis when attack vectors identified in plan |
| 38 | - `scaffold` (L1): security baseline for new projects |
| 39 | |
| 40 | ## Severity Levels |
| 41 | |
| 42 | ``` |
| 43 | BLOCK — commit MUST NOT proceed (secrets found, critical CVE, SQL injection) |
| 44 | WARN — commit can proceed but developer must acknowledge (medium CVE, missing validation) |
| 45 | INFO — informational finding, no action required (best practice suggestion) |
| 46 | ``` |
| 47 | |
| 48 | ## Security Patterns (built-in) |
| 49 | |
| 50 | ``` |
| 51 | # Secret patterns (regex) |
| 52 | AWS_KEY: AKIA[0-9A-Z]{16} |
| 53 | GITHUB_TOKEN: gh[ps]_[A-Za-z0-9_]{36,} |
| 54 | GENERIC_SECRET: (?i)(api[_-]?key|secret|password|token)\s*[:=]\s*["'][^"']{8,} |
| 55 | HIGH_ENTROPY: [A-Za-z0-9+/=]{40,} (entropy > 4.5) |
| 56 | |
| 57 | # OWASP patterns |
| 58 | SQL_INJECTION: string concat/interpolation in SQL context |
| 59 | XSS: innerHTML, dangerouslySetInnerHTML, document.write |
| 60 | CSRF: form without CSRF token, missing SameSite cookie |
| 61 | ``` |
| 62 | |
| 63 | ## Verification Route Selection |
| 64 | |
| 65 | Before starting analysis, classify the change into **Standard** or **Deep** route. This prevents under-analyzing complex code and over-analyzing trivial changes. |
| 66 | |
| 67 | | Signal | Count for Deep | |
| 68 | |--------|---------------| |
| 69 | | Trust boundaries crossed (user input → DB, API → filesystem, etc.) | 3+ → Deep | |
| 70 | | Async operations (callbacks, promises, workers, queues) | 3+ → Deep | |
| 71 | | Cross-component data flow (data passes through 3+ modules) | Yes → Deep | |
| 72 | | Auth/crypto/payment code touched | Any → Deep | |
| 73 | | External service integration (API calls, webhooks) | 2+ → Deep | |
| 74 | |
| 75 | **Standard Route** (default): Linear checklist — Steps 1→2→3→4→5 in order. Sufficient for single-file changes, config updates, and code with <3 trust boundaries. |
| 76 | |
| 77 | **Deep Route**: After Step 3 (OWASP), add a **dependency graph analysis** — trace data flow through all trust boundaries, map async timing, identify privilege transitions. Two automatic escalation checkpoints: |
| 78 | - After Step 3: re-evaluate — if analysis reveals MORE boundaries than initially estimated → add WARN: "complexity higher than estimated" |
| 79 | - After Step 4: re-evaluate — if multiple interacting vulnerabilities found → escalate to `opus` model for combinatorial analysis |
| 80 | |
| 81 | ## Executable Steps |
| 82 | |
| 83 | ### Step 1 — Secret Scan (Gitleaks-Enhanced) |
| 84 | <MUST-READ path="references/secret-patterns.md" trigger="Before scanning for secrets — load extended gitleaks patterns and git history scan procedure"/> |
| 85 | |
| 86 | Use `Grep` on all changed files for core patterns: `sk-`, `AKIA`, `ghp_`, `ghs_`, `-----BEGIN`, `password\s*=\s*["']`, `secret\s*=\s*["']`, `api_key\s*=\s*["']`, `token\s*=\s*["']`. Also flag high-entropy strings (>40 chars, entropy >4.5) and `.env` contents |