--- name: gathering-security description: The drum sounds. Spider and Raccoon gather for complete security work. Use when implementing auth or auditing security end-to-end. --- # 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. Together they secure the forestβ€”doors locked tight, secrets safe, paths protected. ## When to Summon - Implementing authentication systems - Adding OAuth or session management - Security auditing before launch - After security incidents - Preparing for production deployment - When auth and security audit must work together --- ## The Gathering ``` SUMMON β†’ ORGANIZE β†’ EXECUTE β†’ VALIDATE β†’ COMPLETE ↓ ↲ ↲ ↲ ↓ Receive Dispatch Animals Verify Security Request Animals Work Check Hardened ``` ### Animals Mobilized 1. **πŸ•·οΈ Spider** β€” Weave authentication webs with patient precision 2. **🦝 Raccoon** β€” Rummage for security risks and cleanup --- ### 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? - Post-incident cleanup? **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 > - Input validation review > - Access control verification > > Proceed with the gathering?" --- ### Phase 2: ORGANIZE *The animals take their positions in the shadows...* Dispatch in sequence: **Dispatch Order:** ``` Spider ──→ Raccoon β”‚ β”‚ β”‚ β”‚ Weave Audit Auth Security ``` **Dependencies:** - Spider must complete before Raccoon (needs auth to audit) - May iterate: Raccoon findings β†’ Spider fixes β†’ Raccoon re-audit **Iteration Cycle (When Vulnerabilities Found):** ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ SECURITY ITERATION β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ β”‚ πŸ•·οΈ Spider weaves auth ─────► 🦝 Raccoon audits β”‚ β”‚ β–² β”‚ β”‚ β”‚ β”‚ β–Ό β”‚ β”‚ β”‚ Vulnerabilities? β”‚ β”‚ β”‚ / \ β”‚ β”‚ β”‚ Yes No β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ └───── Spider fixes β—„β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β–Ό β”‚ β”‚ βœ… Secure β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` **Iteration Rules:** - Raccoon finds vulnerability β†’ Spider patches β†’ Raccoon re-audits that specific fix - 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...* Execute each phase: **πŸ•·οΈ SPIDER β€” WEAVE** ``` "Spinning the authentication threads..." Phase: SPIN - Choose auth pattern (OAuth 2.0 + PKCE, JWT, Session) - Set up infrastructure (client registration, secrets) Phase: CONNECT - Implement OAuth flow (login/callback) - Session/token management - User info fetching Phase: SECURE - Route protection middleware - CSRF protection - Rate limiting - Security headers Phase: TEST - Auth flow end-to-end - Error handling - Edge cases Phase: BIND - Documentation - Environment variables - Monitoring Output: - Working authentication system - Protected routes - Session management ``` **🦝 RACCOON β€” AUDIT** ``` "Rummaging through every corner..." Phase: RUMMAGE - Search for secrets in code - Check git history - Scan dependencies for vulnerabilities Phase: INSPECT - Validate auth implementation - Check input validation - Review access controls - Examine error messages Phase: SANITIZE - Remove any secrets found - Rotate exposed credentials - Patch vulnerabilities Phase: PURGE - Clean git history if needed - Remove dead code - Clear old tokens Phase: VERIFY - Re-scan for secrets - Verify fixes - Install pre-commit hooks Output: - Security audit report - Issues fixed - Preventive measures in place ``` --- ### Phase 4: VALIDATE *The web holds. The audit confirms...* **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: Input validation present - [ ] Raccoon: No sensitive data in logs - [ ] Raccoon: Pre-commit hooks installed **Security Test Cases:** ``` Authentication: β–‘ Login redirects to provider β–‘ Callback exchanges code for tokens β–‘ Sessions created correctly β–‘ Logout clears sessions β–‘ Expired tokens rejected Authorization: β–‘ Protected routes require auth β–‘ Admin routes check roles β–‘ API endpoints verify tokens β–‘ Users can't access others' data Input Validation: β–‘ SQL injection prevented β–‘ XSS prevented β–‘ File uploads sanitized β–‘ Rate limiting active ``` --- ### Phase 5: COMPLETE *The gathering ends. The forest is secure...* **Completion Report:** ```markdown ## 🌲 GATHERING SECURITY COMPLETE ### Security Work: [Description] ### Animals Mobilized πŸ•·οΈ Spider β†’ 🦝 Raccoon ### Authentication Implemented - **Provider:** [OAuth 2.0 / GitHub / Google / etc.] - **Flow:** [PKCE / Authorization Code] - **Session Type:** [Token / Session Cookie] - **Routes Protected:** [count] ### Security Measures - CSRF protection: βœ… - Rate limiting: βœ… [limits] - Security headers: βœ… - Input validation: βœ… - Secret scanning: βœ… Clean ### Vulnerabilities Addressed - [List any found and fixed] ### Preventive Measures - Pre-commit hooks installed - Dependency scanning enabled - Security headers configured - Monitoring alerts set ### Files Created/Modified - Auth routes: [files] - Middleware: [files] - Configuration: [files] ### Time Elapsed [Duration] *The forest sleeps securely.* 🌲 ``` --- ## Example Gathering **User:** "/gathering-security Add GitHub OAuth and security audit" **Gathering execution:** 1. 🌲 **SUMMON** β€” "Mobilizing for: GitHub OAuth + security audit. New auth provider needed." 2. 🌲 **ORGANIZE** β€” "Spider implements β†’ Raccoon audits" 3. 🌲 **EXECUTE** β€” - πŸ•·οΈ Spider: "OAuth client registered, PKCE flow implemented, sessions working, routes protected" - 🦝 Raccoon: "No secrets found, dependencies clean, input validated, rate limiting added" 4. 🌲 **VALIDATE** β€” "Auth works, audit clean, all security checks pass" 5. 🌲 **COMPLETE** β€” "GitHub OAuth live, security hardened" --- *Woven tight and audited cleanβ€”the forest is safe.* 🌲