Gathering Security π²π·οΈπ¦π’
The drum echoes in the shadows. The Spider weaves intricate webs of authentication, each strand placed with precision. The Raccoon rummages through every corner, finding what doesn't belong, cleaning what could harm. The Turtle moves with ancient patience, layering defense upon defense, testing every plate of the shell. Together they secure the forest β doors locked tight, secrets safe, paths protected, and the ground itself hardened against anything that comes.
When to Summon
-
Implementing authentication systems
-
Adding OAuth or session management
-
Security auditing before launch
-
After security incidents
-
Preparing for production deployment
-
When auth, security audit, and deep hardening must work together
-
Building a new feature that handles sensitive data
-
Hardening existing code for defense in depth
Grove Tools for This Gathering
Use gw and gf throughout. Quick reference for security work:
Find security-relevant code patterns
gf --agent search "sanitize|escape|validate" # Security patterns gf --agent auth # Find auth code and middleware
Verify security changes don't break anything
gw ci --affected --diagnose # Run CI on affected packages
The Gathering
SUMMON --> ORGANIZE --> EXECUTE --> VALIDATE --> COMPLETE | | | | | Receive Dispatch Animals Verify Security Request Animals Work Check Hardened
Animals Mobilized
-
π·οΈ Spider β Weave authentication webs with patient precision
-
π¦ Raccoon β Rummage for security risks and cleanup
-
π’ Turtle β Harden with layered, defense-in-depth protection
Phase 1: SUMMON
The drum sounds. The shadows shift...
Receive and parse the request:
Clarify the Security Work:
-
Adding new auth provider? (OAuth, SSO)
-
Securing routes and APIs?
-
General security audit?
-
Deep security hardening?
-
Post-incident cleanup?
-
Pre-production hardening?
Error Codes as Security Posture: All errors MUST use Signpost codes β this is a security requirement, not just a convention:
-
All server errors use codes from the appropriate catalog (API_ERRORS , AUTH_ERRORS , etc.)
-
userMessage is always generic and warm β no technical details leak to clients
-
adminMessage is detailed β stays in server logs only
-
Auth errors NEVER reveal user existence ("Invalid credentials" β not "user not found")
-
logGroveError() for all server errors β never console.error alone
Scope Check:
"I'll mobilize a security gathering for: [security work]
This will involve:
-
π·οΈ Spider weaving authentication
-
OAuth/PKCE flow
-
Session management
-
Route protection
-
Token handling
-
π¦ Raccoon auditing security
-
Secret scanning
-
Vulnerability check
-
Dependency audit
-
Dead code removal
-
π’ Turtle hardening defenses
-
Input/output validation
-
Security headers & CSP
-
Defense-in-depth enforcement
-
Exotic attack vector testing
-
Hardening report
Proceed with the gathering?"
Selective Mobilization: Not every gathering needs all three animals:
Situation Animals Needed
New auth system + full security All three: Spider β Raccoon β Turtle
Auth already exists, need hardening Raccoon β Turtle
New feature, ensure secure by design Turtle only (or Turtle β Raccoon)
Secrets leak / incident response Raccoon β Spider (rotate creds) β Turtle (verify)
Pre-production deploy Raccoon β Turtle
Phase 2: ORGANIZE
The animals take their positions in the shadows...
Dispatch in sequence:
Full Dispatch Order:
Spider βββ Raccoon βββ Turtle β β β β β β Weave Audit Harden Auth Secrets Defenses
Dependencies:
-
Spider must complete before Raccoon (needs auth to audit)
-
Raccoon should complete before Turtle (clean first, then harden)
-
May iterate: Turtle findings β Spider/Raccoon fixes β Turtle re-verify
Iteration Cycle (When Vulnerabilities Found):
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β SECURITY ITERATION β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β β π·οΈ Spider βββΊ π¦ Raccoon βββΊ π’ Turtle β β weaves auth audits hardens & tests β β β² β β β β βΌ β β β Deep vulnerabilities? β β β / \ β β β Yes No β β β β β β β β ββββββββββββββ βΌ β β β βΌ β Hardened β β β Auth issue? β β β / \ β β β Yes No β β β β β β β βββββ Raccoon/Turtle β β fixes directly β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Iteration Rules:
-
Turtle finds auth vulnerability β Spider patches β Turtle re-verifies
-
Turtle finds non-auth vulnerability β Fix directly β Turtle re-verifies
-
Raccoon finds secrets β Raccoon cleans β Turtle verifies no residual exposure
-
Maximum 3 iterations per issue (if more needed, architectural review required)
-
Each iteration focuses only on newly found/fixed items
-
Document all iterations in final report
Phase 3: EXECUTE
The web is woven. The audit begins. The shell hardens...
Execute each animal's phase by loading and running their dedicated skill:
π·οΈ SPIDER β WEAVE
Load skill: spider-weave
Execute the full Spider workflow for [the auth system being implemented]. Handoff: working authentication system (OAuth flow, session management, protected routes, CSRF protection) β Raccoon for audit
π¦ RACCOON β AUDIT
Load skill: raccoon-audit
Execute the full Raccoon workflow on the entire codebase, with particular attention to the Spider's auth implementation. If secrets found or auth issues discovered β Spider patches β Raccoon re-verifies. Handoff: clean audit report (no secrets, vulnerabilities patched, dead code removed, pre-commit hooks installed) β Turtle for hardening
π’ TURTLE β HARDEN
Load skill: turtle-harden
Execute the full Turtle workflow on the codebase, including auth routes, API endpoints, and data flows. If deep vulnerabilities found in auth β Spider patches β Turtle re-verifies. Maximum 3 iterations per issue. Handoff: hardening report (defense-in-depth verified, exotic vectors tested, all layers applied) β VALIDATE phase
Phase 4: VALIDATE
The web holds. The audit confirms. The shell endures...
Validation Checklist:
-
Spider: Auth flow works end-to-end
-
Spider: Routes properly protected
-
Spider: Sessions expire correctly
-
Spider: CSRF protection active
-
Raccoon: No secrets in codebase
-
Raccoon: Dependencies up to date
-
Raccoon: No sensitive data in logs
-
Raccoon: Pre-commit hooks installed
-
Turtle: Input validation on all entry points
-
Turtle: Output encoding on all exit points
-
Turtle: Security headers complete
-
Turtle: CSP enforced (nonce-based)
-
Turtle: CORS restricted to exact origins
-
Turtle: Defense-in-depth verified (2+ layers per critical function)
-
Turtle: Exotic attack vectors tested and clear
-
Turtle: Multi-tenant isolation verified (if applicable)
Rootwork Boundary Validation:
-
Form data parsed with parseFormData() , not raw formData.get()
-
JSON reads validated with safeJsonParse() , not unsafe as casts
-
Caught exceptions use isRedirect() /isHttpError() type guards
-
No as any or as SomeType casts at trust boundaries
-
Schemas defined at module scope, not inside handlers
Security Test Cases:
Authentication: [ ] Login redirects to provider [ ] Callback exchanges code for tokens [ ] Sessions created correctly [ ] Logout clears sessions server-side [ ] Expired tokens rejected [ ] Session fixation prevented
Authorization: [ ] Protected routes require auth [ ] Admin routes check roles [ ] API endpoints verify tokens [ ] Users can't access others' data (IDOR tested) [ ] Horizontal escalation prevented [ ] Vertical escalation prevented
Hardening: [ ] SQL injection prevented (parameterized queries) [ ] XSS prevented (output encoding + CSP) [ ] CSRF prevented (tokens + SameSite cookies) [ ] File uploads sanitized (type + size + rename) [ ] Rate limiting active on all sensitive endpoints [ ] Prototype pollution vectors blocked [ ] Timing attacks mitigated (constant-time comparison) [ ] Race conditions prevented (atomic operations) [ ] SSRF prevented (URL allowlist, no redirect following)
Phase 5: COMPLETE
The gathering ends. The forest is fortified...
Completion Report:
GATHERING SECURITY COMPLETE
Security Work: [Description]
Animals Mobilized
π·οΈ Spider β π¦ Raccoon β π’ Turtle
Authentication Implemented
- Provider: [OAuth 2.0 / GitHub / Google / etc.]
- Flow: [PKCE / Authorization Code]
- Session Type: [Token / Session Cookie]
- Routes Protected: [count]
Security Audit Results
- Secrets found: [count] (all rotated/removed)
- Dependencies patched: [count]
- Dead code removed: [lines]
- Pre-commit hooks: Installed
Hardening Applied
| Defense Layer | Status | Details |
|---|---|---|
| Input Validation | [PASS/FAIL] | Zod schemas on all endpoints |
| Output Encoding | [PASS/FAIL] | Context-aware, DOMPurify for rich text |
| SQL Injection | [PASS/FAIL] | All queries parameterized |
| Security Headers | [PASS/FAIL] | CSP, HSTS, X-Frame, etc. |
| CORS | [PASS/FAIL] | Exact origin allowlist |
| Session Security | [PASS/FAIL] | HttpOnly, Secure, SameSite |
| CSRF Protection | [PASS/FAIL] | Tokens + SameSite |
| Rate Limiting | [PASS/FAIL] | Per-endpoint limits configured |
| Multi-Tenant | [PASS/FAIL/N/A] | Tenant scoping verified |
| File Uploads | [PASS/FAIL/N/A] | Type/size/rename enforced |
Exotic Attack Vectors Tested
| Vector | Status |
|---|---|
| Prototype Pollution | [CLEAR/FOUND] |
| Timing Attacks | [CLEAR/FOUND] |
| Race Conditions | [CLEAR/FOUND] |
| ReDoS | [CLEAR/FOUND] |
| SSRF | [CLEAR/FOUND] |
| Unicode Attacks | [CLEAR/FOUND] |
| Cache Poisoning | [CLEAR/FOUND] |
| SVG XSS | [CLEAR/FOUND] |
Defense-in-Depth Compliance
- Layers verified: [X/5] (Network, Application, Data, Infrastructure, Process)
- Critical functions with 2+ layers: [X/Y]
Vulnerabilities Found & Fixed
| Severity | Count | Status |
|---|---|---|
| CRITICAL | [n] | All fixed |
| HIGH | [n] | All fixed |
| MEDIUM | [n] | [fixed/accepted] |
| LOW | [n] | [fixed/deferred] |
Files Created/Modified
- Auth routes: [files]
- Middleware: [files]
- Configuration: [files]
- Security tests: [files]
Woven tight, audited clean, hardened deep β the forest endures. π²
Example Gathering
User: "/gathering-security Add GitHub OAuth, audit everything, and harden for production"
Gathering execution:
π² SUMMON β "Mobilizing full security gathering: GitHub OAuth + audit + hardening. All three animals needed."
π² ORGANIZE β "Spider implements auth β Raccoon audits for secrets/vulns β Turtle hardens everything"
π² EXECUTE β
-
π·οΈ Spider: "OAuth client registered, PKCE flow implemented, sessions working, routes protected"
-
π¦ Raccoon: "No secrets found, 2 dependency vulns patched, dead debug endpoint removed"
-
π’ Turtle: "CSP configured with nonces, CORS locked to exact origins, all inputs validated with Zod, constant-time token comparison added, prototype pollution vector in config merge fixed, defense-in-depth verified at 3 layers per critical function"
π² VALIDATE β "Auth works, audit clean, hardening verified, all exotic vectors tested clear"
π² COMPLETE β "GitHub OAuth live, secrets clean, shell hardened. The forest endures."
Quick Decision Guide
Situation Animals to Mobilize
New auth + full security Spider β Raccoon β Turtle
Auth exists, need deep hardening Raccoon β Turtle
New feature, secure by design Turtle (optionally + Raccoon)
Incident response Raccoon β Spider β Turtle
Pre-production deploy Raccoon β Turtle
Auth-only work Spider β Raccoon (no Turtle needed)
Woven tight, audited clean, hardened deep β the forest endures. π²