auth-security
Skill22 starsChanged 5 months agoMITView on GitHub
Authentication and authorization: JWT, OAuth 2.0 / OIDC, session management, CSRF, password hashing, MFA, and object-level / function-level authorization (BOLA, IDOR) — confirming the caller may access the specific resource they asked for. Use when generating login, signup, or password-reset flows, issuing or verifying JWTs, writing OAuth or OIDC code, wiring session cookies or MFA, or writing any endpoint that reads or writes a resource by id.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- nahid-sparktales/agent-dispatchertheir own version, first seen Sep 21, 2026
- KbWen/agentic-ostheir own version, first seen Sep 10, 2026
- KbWen/agent-virtual-officetheir own version, first seen Aug 16, 2026
- YepAPI/skillstheir own version, first seen Apr 12, 2026
- vjrivmon/Setup-Software-IAtheir own version, first seen Feb 5, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- KbWen/agentic-os★ 206same name
- nahid-sparktales/agent-dispatcher★ 59same name
- KbWen/agent-virtual-office★ 35same name
- YepAPI/skills★ 8same name
- vjrivmon/Setup-Software-IA★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository36 other files it gives its agents.
- AGENTS.mdAGENTS.md
- dist/AGENTS.mdAGENTS.md
- dist/CLAUDE.mdCLAUDE.md
- dist/copilot-instructions.mdCopilot instructions
- docs/llms-full.txtllms.txt
- docs/llms.txtllms.txt
- api-securitySkill
- cicd-securitySkill
- container-securitySkill
- cors-securitySkill
- crypto-misuseSkill
- database-securitySkill
- deserialization-securitySkill
- dynamic-verificationSkill
- electron-securitySkill
- error-handling-securitySkill
- file-upload-securitySkill
- frontend-securitySkill
- graphql-securitySkill
- iac-securitySkill
- iam-best-practicesSkill
- llm-app-securitySkill
- logging-securitySkill
- ml-securitySkill
- mobile-securitySkill
- protocol-securitySkill
- saas-securitySkill
- secret-detectionSkill
- secure-code-reviewSkill
- security-regression-testsSkill
- serverless-securitySkill
- ssrf-preventionSkill
- supply-chain-securitySkill
- template-injectionSkill
- threat-modelingSkill
- websocket-securitySkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 97
Put access tokens, refresh tokens, or session IDs in URL query strings — they leak to logs, Referer headers, and browser history.
- Distinctive: line 106
Use the implicit flow or the password grant.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Authentication & Authorization Security
Rules (for AI agents)
ALWAYS
- Authorize at the object level — confirm the authenticated subject actually has access to the requested resource ID, not just that they are logged in. Being signed in is not permission to read record 4,182 (OWASP API1 — BOLA / IDOR).
- Bind object-level authorization to the authenticated principal, never to an
actor id echoed in the request: checking that a request-supplied
senderId/ownerId/actedByis a valid member validates the claimed actor, not the caller (looks like authorization, isn't). - On
/{scopeId}/.../{subjectId}routes, authorize the relationship — confirm the subject belongs to that scope. A caller-vs-scope check alone does not authorize the subject (multi-key BOLA). - Authorize each subject on streaming responses (SSE/chunked/WebSocket): the
200is committed before the handler runs, so an empty/filtered stream — not a4xx— is the deny signal; an unauthorized subject gets zero events. - Enforce a function-level role / privilege check on any write that publishes into a shared or global namespace (a global gallery, shared catalog, public template list). Authentication is not authorization (OWASP API5 — Broken Function Level Authorization); a low-privilege user posting into a globally-visible store is a delivery vector for stored-XSS and malicious-link chains.
- For JWT verification, pin the expected algorithm (
RS256,EdDSA, orES256) and verifyiss,aud,exp,nbf, andiat. Rejectalg=noneand any unexpected algorithm. - For OAuth 2.0 public clients (SPA / mobile / CLI), use the authorization code flow with PKCE (S256). Never the implicit flow. Never the resource owner password credentials grant.
- Cookies for sessions:
Secure; HttpOnly; SameSite=Lax(orStrictfor sensitive flows). Use the__Host-prefix when there's no subdomain sharing. - Rotate the session identifier on login and on privilege change. Bind the session to the user agent only as a soft signal — never as the sole check.
- Consult
crypto-misusefor every cryptographic primitive this flow touches — the password KDF and its work factors, the RNG behind session IDs and reset tokens, and constant-time comparison. It names the correct call per language, which is the half a "do not use X" rule leaves out. - Make both authentication failure paths cost the same. Do not return early when the
account does not exist: run an equivalent KDF verification — against a fixed dummy
hash held for the purpose — before returning the same failure the wrong-password
path returns. Matching the message alone still discloses which accounts exist,
because the not-found branch skips the expensive work and answers sooner. Aim for a
comparable processing path, not a constant wall-clock time, which HTTP cannot
deliver.
error-handling-securityowns what that response says. - Consult
frontend-securityfor where a token may live in the browser. Its rule covers every JWT and token, not just long-lived refresh ones — any XSS readslocalStorage— and pairs with the matchingdocument.cookierestriction. - Enforce password length ≥ 12 characters with no composition rules; allow Unicode; check candidate passwords against a known-breached list (HIBP / pwned-passwords k-anonymity API). The length floor tracks NIST SP 800-63B, current as of 2026-06.
- Implement account lockout or rate limiting for password attempts. NIST SP 800-63B §5.2.2 caps this at 100 failures over 30 days as of the 2026-06 revision; verify the section still reads that way before citing the number.
- Implement CSRF protection for state-changing requests reachable from a
browser session: synchronizer token, double-submit cookie, or
SameSite=Strictfor high-risk endpoints. - Require MFA / step-up for administrative operations, password changes, MFA-device changes, billing changes.
- For OIDC, validate the
nonceyou sent against thenoncein the ID token; validate theat_hash/c_hashwhen present.
NEVER
- Accept JWT
alg=none; or accept HS256 from a client when the issuer signs with RS256 (classic algorithm-confusion attack). - Put access tokens, refresh tokens, or session IDs in URL query strings — they leak to logs, Referer headers, and browser history.
- Trust client-supplied roles / claims at the API layer — re-derive the authenticated subject and look up server-side authorization on each request.
- Act on a subject/owner id asserted by an upstream producer (queue, topic, webhook) without authenticating the channel and re-validating the asserted subject — a spoofed producer otherwise drives forged cross-tenant effects.
- Issue long-lived (>1 hour) access tokens; rely on refresh tokens with rotation.
- Use the implicit flow or the password grant.
KNOWN FALSE POSITIVES
- A write into the caller's own private / tenant-scoped namespace needs only authentication plus object-level ownership — function-level role gating applies specifically to writes whose result becomes visible beyond the creator.
- Service-to-service tokens with long TTLs are sometimes acceptable when stored in a secret manager and bound to a specific workload identity.
- Local-development "magic link" auth without password hashing for ephemeral dev users is fine if it's gated behind an env flag and disabled in prod.
- Tokens in URL query are tolerable in one place — the OAuth authorization code return — because the value is short-lived and one-time-use.
Context (for humans)
Authentication failures show up consistently in OWASP Top 10 (A07:2021 — Identification and Authentication Failures). The common modes are: weak password storage, predictable tokens, missing MFA, JWT misconfiguration, and session fixation. RFC 9700 (OAuth 2.0 Security BCP) and NIST SP 800-63B are the authoritative references for the recipe.
AI assistants tend to ship "works in dev" auth: HS256 JWTs with hard-coded
secrets, bcrypt.hash with default cost 10, no PKCE, tokens in localStorage.
This skill catches the first two directly and routes the rest to the skill that
owns them — work factors to crypto-misuse, browser storage to
frontend-security.
References
references/verifying-findings.md— confirm or refute a finding, then lock itrules/jwt_safe_config.jsonrules/oauth_flows.json- OWASP Password Storage Cheat Sheet — the source of record for work factors; read it, do not recall it.
- OWASP Authentication Cheat Sheet.
- RFC 9700 — OAuth 2.0 Security BCP.
- NIST SP 800-63B.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

