Security

From event4u-app/agent-config · View interactive version

Security is an AI agent skill from the GitHub repository event4u-app/agent-config. Use when applying security best practices — authentication, authorization, CSRF protection, input sanitization, rate limiting, or secure coding — stack-agnostic.

How to use this skill

Skill file

security

When to use

Use when implementing authentication, authorization, or other security-sensitive work.

Do NOT use when:

Stack-specific carve-outs

The procedure below is stack-agnostic. For framework-specific primitives (Laravel Policies / Gates / FormRequests, Symfony voters, NestJS guards, Next.js middleware), defer to:

| Stack | Carve-out |

|---|---|

| Laravel | CODE0, CODE1, CODE2 |

| Symfony | CODE0 |

| Next.js / TS | CODE0 |

Procedure: Implement security for a feature (stack-neutral)

Step 0: Inspect

  1. Read the project's auth doc (agents/authentication.md, docs/auth.md, or framework docs).
  2. Read the project's authorization doc (gates / policies / voters / guards).
  3. Locate existing authorization rules in the project's idiomatic location (Laravel app/Policies/, Symfony src/Security/Voter/, NestJS *.guard.ts).

Step 1: Authentication

Step 2: Authorization

  1. Create / locate the authz rule in the framework's idiomatic primitive (Policy, voter, guard, middleware, route dependency).
  2. Apply it at the request boundary (FormRequest authorize(), controller / route-handler dependency, middleware chain).
  3. Cover non-model gates (cross-aggregate rules) — keep them centralised, not scattered across handlers.

Step 3: Review for adversarial

For security-sensitive changes, run CODE0.

Focus: attack surface, trusted user input, authz gaps.

Conventions

→ For PHP / Laravel specifics (auth helpers, mass assignment, Blade escaping, CSRF middleware): see guideline docs/guidelines/php/security.md.

→ For other stacks, follow the framework's hardening guide and the carve-outs above.

Account flows — the whole lifecycle, not just the login

Sign-up, verification, reset, credential and email change, MFA, federated

sign-in and logout are one surface. Before judging any of them, trace the path:

input → identity lookup → verification → secret handling → state change →

session → response.

status, body category, redirect and cookies must not differ between a known

and an unknown identity, and the verifier path runs for both.

that primitive's length precondition. Never a general-purpose fast hash for a

password. Never an invented token, one-time code or salt scheme.

codes, a linked provider — needs fresh re-authentication and a notice on the

channel that was already verified.

Ground the specifics before enumerating from memory: the account-lifecycle

failure classes, their required controls and their negative tests live in

CODE0's corpus under the

authentication surface class. Every numeric value in them defers to the

external authority named in the block below.

Crypto, password storage, certificates — route, do not guess

This skill carries no cryptographic parameter, key size, work factor, cipher

suite, or TLS version floor: such a value is authoritative-looking long after it stops

being true. Take it from <https://cheatsheetseries.owasp.org/> when you

need it — never from memory, never from this file. Rationale and reopening

condition: ADR-238.

Validate

Output format

  1. Security-hardened code with auth, input validation at the boundary, and output encoding.
  2. Authorization rule (Policy / voter / guard / middleware) co-located with the route.

Gotcha

Do NOT

Auto-trigger keywords

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.