Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Auth Security

ASecurity

Secure authentication and authorization when credentials, sessions, roles, or permissions change.

206 stars
0 votes
0 copies
0 views
Added 9/27/2026
ai-agentsgorailstestingapidatabasefrontendbackendsecurity

Works with

cliapi

Security Analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned 9/27/2026

$npx -y skills add KbWen/agentic-os --skill auth-security --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Auth Security?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Auth Security
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/kbwen-auth-security-agentic-os/badge)](https://www.skillsdirectory.com/skills/kbwen-auth-security-agentic-os)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: auth-security
description: Secure authentication and authorization when credentials, sessions, roles, or permissions change.
---

<!-- This is a SCAFFOLD skill -->

# Auth & Security

## When to Apply

- **Classification**: ALL classifications that touch auth, permissions, user data, or session management
- **Phase**: /plan (auth flow design), /implement (auth logic), /review (MANDATORY for any auth-related change), /test (auth bypass testing)
- **Trigger**: Task involves login, registration, password, token, session, role, permission, or access control

## Relationship to Security Guardrails

This skill **extends** `.agent/rules/security_guardrails.md` with APP-specific auth patterns. The security guardrails handle OWASP scanning and secret detection. This skill handles auth architecture and implementation patterns.

**Precedence**: security_guardrails.md > this skill. If conflict, security guardrails win.

## Conventions

> **Customize after /app-init**: Replace these with your project's ADR auth decisions.

### Authentication Flow (JWT Example)

```
Client                    Server                     DB
  |-- POST /auth/login -->|                           |
  |   {email, password}   |-- verify password hash -->|
  |                       |<-- user record -----------|
  |<-- {access_token,     |                           |
  |     refresh_token} ---|                           |
  |                       |                           |
  |-- GET /api/resource ->|                           |
  |   Authorization:      |-- verify token            |
  |   Bearer <access>     |-- check permissions       |
  |<-- 200 data ---------|                           |
  |                       |                           |
  |-- POST /auth/refresh->|                           |
  |   {refresh_token}     |-- verify + rotate ------->|
  |<-- {new_access,       |<-- new tokens ------------|
  |     new_refresh} -----|                           |
```

### Token Rules
- **Access token**: Short-lived (15-30 min). Stored in memory only (NOT localStorage).
- **Refresh token**: Longer-lived (7-30 days). Stored in httpOnly, secure, sameSite cookie.
- **Token rotation**: Issue new refresh token on each refresh. Invalidate old one.
- **Revocation**: Maintain a blocklist for compromised tokens (or use short expiry + DB check).

### Password Rules
- Hash with bcrypt (cost 12+) or argon2id
- NEVER store plaintext passwords — not even in logs, not even temporarily
- Minimum 8 characters, no maximum less than 128
- Check against breach database (HaveIBeenPwned API) on registration if feasible
- Rate limit login attempts: 5 failures → temporary lockout (progressive delay)

### Authorization (RBAC Pattern)

```
Users ──< UserRoles >── Roles ──< RolePermissions >── Permissions
```

| Concept | Example | Storage |
|---|---|---|
| Role | admin, editor, viewer | `roles` table |
| Permission | users:read, users:write, posts:delete | `permissions` table |
| Assignment | User A has role "editor" | `user_roles` junction table |

**Middleware pattern** (pseudocode):
```
authenticate(req)          → verify token, attach user to request
authorize('posts:write')   → check user's roles have this permission
handler(req, res)          → business logic (user is authenticated + authorized)
```

### Session Security
- Set `httpOnly`, `secure`, `sameSite=strict` on auth cookies
- Regenerate session ID after login (prevent session fixation)
- Invalidate all sessions on password change
- Implement "logout everywhere" for compromised accounts

### Input Security (Auth-Specific)
- Sanitize email: lowercase, trim, validate format
- Timing-safe comparison for tokens and passwords (prevent timing attacks)
- Generic error messages: "Invalid email or password" (never reveal which one is wrong)
- CAPTCHA or rate limiting on registration and login endpoints

## Checklist

During /plan:
- [ ] Auth flow documented in spec (which endpoints, which tokens, which storage)
- [ ] Permission model defined (who can do what)
- [ ] Session management strategy chosen (per ADR)

During /implement:
- [ ] Passwords hashed with approved algorithm (bcrypt/argon2, NOT MD5/SHA1)
- [ ] Tokens validated on EVERY protected endpoint (no missing auth middleware)
- [ ] Refresh token rotation implemented
- [ ] Rate limiting on auth endpoints
- [ ] No sensitive data in JWT payload (no password, no PII beyond user ID)
- [ ] CORS configured to restrict origins

During /review:
- [ ] No auth bypass paths (every protected route checked)
- [ ] No hardcoded credentials or API keys
- [ ] Error messages don't leak user existence (registration: "If this email exists...")
- [ ] Password reset token is single-use and time-limited
- [ ] Admin endpoints have role check (not just auth check)

During /test:
- [ ] Test: unauthenticated request → 401
- [ ] Test: wrong role → 403
- [ ] Test: expired token → 401
- [ ] Test: manipulated token (wrong signature) → 401
- [ ] Test: rate limit triggers after N failures
- [ ] Test: password change invalidates old tokens

## Heading-Scoped Read Note

For phase-entry loading, read only:
- `When to Apply`
- `Relationship to Security Guardrails`
- `Checklist`

Load `Conventions`, `Anti-Patterns`, and `References` on full read or cache miss only.

## Anti-Patterns

- **JWT in localStorage**: Vulnerable to XSS. Use httpOnly cookies or in-memory only.
- **No refresh token rotation**: Stolen refresh token = permanent access. Always rotate.
- **Role check in frontend only**: Frontend hides UI but backend doesn't enforce. ALWAYS check server-side.
- **Password in logs**: Logging request body that includes password field. Exclude sensitive fields.
- **Shared admin token**: One API key for all admin operations. Use per-user auth with audit trail.
- **No rate limiting**: Brute force attacks on login become trivial.
- **Email enumeration**: "No account with this email" on login. Use generic "Invalid credentials".
- **Long-lived access tokens**: Access tokens valid for days. Use short-lived + refresh pattern.
- **Missing CSRF protection**: For cookie-based auth, CSRF tokens are mandatory on state-changing requests.

## References

- Project ADR: `docs/adr/ADR-002-project-architecture.md` § Auth & Security
- Security guardrails: `.agent/rules/security_guardrails.md` (A01, A02, A07 — primary references)
- Red team skill: `.agents/skills/red-team-adversarial/SKILL.md` (auth bypass testing)
- Spec template: `.agentcortex/templates/spec-app-feature.md` § Auth & Permissions

Attribution

KbWenKbWen
View sourceSee grades on GitHubMore from KbWen →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →