auth-session-and-oauth

auth-session-and-oauth is a skill for Claude Code, Codex from tmj-90/gaffer. It costs 101 tokens per session (2,017 once invoked), scanned A, original, Apache-2.0.

A guide for handling user identity in software, including login, logout, sessions, passwords, tokens, and sign-in through services such as Google using OAuth or OpenID Connect. It relies on established security libraries and platform features instead of custom cryptography.

In plain words
What is it for?
Use it for login and logout, cookies and sessions, password resets, JWTs, refresh tokens, OAuth sign-in, and API keys.
Why use it?
It helps avoid mistakes that can expose accounts, passwords, or session tokens, while keeping authentication consistent with the existing application.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for login and logout, cookies and sessions, password resets, JWTs, refresh tokens, OAuth sign-in, and API keys.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tmj-90/gaffer/auth-session-and-oauth
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add tmj-90/gaffer --skill auth-session-and-oauth
Clone the repo
git clone --depth 1 https://github.com/tmj-90/gaffer

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for auth-session-and-oauth

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmj-90/gaffer/auth-session-and-oauth/github.svg)](https://agentmods.dev/skills/tmj-90/gaffer/auth-session-and-oauth)
Your own site
<a href="https://agentmods.dev/skills/tmj-90/gaffer/auth-session-and-oauth"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/auth-session-and-oauth/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for auth-session-and-oauth

Your own site · 80×15
<a href="https://agentmods.dev/skills/tmj-90/gaffer/auth-session-and-oauth"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/auth-session-and-oauth.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 101 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,017 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00101 $0.02017
Opus 5.5 $0.00040 $0.00807
Sonnet 5.5 $0.00020 $0.00403
Haiku 4.5 $0.00010 $0.00202

Measured 16d ago against content hash d36c3f9c8fce, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

auth-session-and-oauth scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 16d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

runner/skills/auth-session-and-oauth/SKILL.md · 130 lines

How it starts

The opening of the file, as written. The whole thing — 130 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Implement authentication correctly

A small mistake in authentication is a full account takeover. Use the repo's mature library, follow the protocol as specified, and make every credential expire, rotate and revoke (ASVS 5.0 V6/V7/V9/V10; NIST SP 800-63B-4; RFC 9700; OWASP cheat sheets). What a logged-in user may do is the security-authz skill.

Procedure

  1. Use the repo's auth stack. Find the library and session store in use (Auth.js, Passport, Spring Security, Devise, ASP.NET Identity, an OIDC client) and call search_lore. Never write your own hashing, token format or OAuth flow. If the repo has no library and the ticket needs one, raise request_decision with a recommendation and mark_ticket_blocked naming the dependency. Never install it yourself: the safety hook blocks installs.
  2. Passwords (only if the ticket touches them):
    • Hash with Argon2id (at least m=19 MiB, t=2, p=1). Otherwise use scrypt (N=2^17, r=8, p=1), or bcrypt with cost ≥10, which ignores input past 72 bytes: reject longer input rather than silently truncating. Use PBKDF2-HMAC-SHA256 at 600,000 iterations or more only where FIPS requires it.
    • Rehash on login when the parameters are outdated.
    • Policy: minimum 15 characters with password as the only factor (8 if MFA is enforced), allow at least 64, no composition rules, no periodic expiry, accept paste and Unicode, and check against a breached or common-password list. Verify the password exactly as typed (ASVS 6.2).
    • Throttle failures per account and per IP through the rate-limiting skill, failing closed.
  3. No enumeration. Login, registration and reset return the same body, status and roughly the same timing whether or not the account exists. When no user is found, verify against a dummy hash (ASVS 6.3.8).
  4. Sessions and cookies (ASVS V7):
    • Opaque server-side id, ≥128 bits from a CSPRNG, in a __Host- cookie with Secure; HttpOnly; SameSite=Lax (or Strict) and Path=/.
    • Regenerate the id on login, re-authentication and privilege change (fixation).
    • Server-enforced idle and absolute timeouts. Logout deletes the session server-side; disabling an account kills all its sessions.
    • Changing email, phone or MFA requires re-authentication. Cookie-session writes need CSRF protection (SameSite plus a token or Origin check).
  5. JWTs, if the repo uses them (ASVS V9):
    • Allow-listed algorithm only: never none, never taken from the header, no HS/RS mixing. Keys only from configured issuers; ignore jku, x5u, jwk.
    • Check exp, nbf, iss, aud and the token type (an ID token is not an access token). Short-lived; revocation needs a jti denylist or a server session.
    • No personal data in the payload. For browser SPAs prefer a backend-for-frontend so tokens never reach JavaScript storage (ASVS 10.1.1).
  6. OAuth / OIDC client (RFC 9700):
    • Authorization-code flow with PKCE S256 for every client type; never implicit or the password grant. Exact-match registered redirect URIs.
    • Bind state and nonce to the user-agent session and verify them on callback. With more than one provider, validate the iss response parameter (RFC 9207).
    • Validate the ID token's signature, iss, aud == client_id, exp, nonce.
    • Identify the user by (iss, sub), never by email. Auto-linking an existing account by email is a takeover path: raise request_decision.
    • Minimal scopes, no tokens in URLs, post-login returnTo relative or allow-listed.
  7. Refresh tokens: rotate on every use and give them an absolute expiry. Reuse of a rotated token revokes the whole token family. Define and test what happens when two tabs refresh at the same moment: one wins, or both succeed inside a short grace window. A lost race must not log the user out silently, and must not let a stolen token keep working.
  8. Password reset, email verification and magic links:
    • ≥128-bit CSPRNG tokens stored hashed (SHA-256 is enough), short-lived (codes ≤10 minutes).
    • Single use, enforced atomically: UPDATE … SET used_at = now() WHERE token_hash = ? AND used_at IS NULL AND expires_at > now() and check that exactly one row changed.
    • Build the link from the configured canonical origin, never the Host header; Referrer-Policy: no-referrer on the reset page. A reset ends other sessions.
  9. API keys: generate from a CSPRNG with an identifying prefix, show once, store a hash, scope to a capability, allow revocation, record last use, and attribute every write to the key.
  10. Log security events (the structured-logging-and-tracing skill) with OWASP vocabulary names (authn_login_fail, authn_token_reuse, session_logout, …). Never log a password, token, cookie or reset link.
  11. Test every negative through the real endpoint. Cover:
    • wrong password, unknown user (same response), expired session, logout then reuse of the old cookie;
    • a session id that does not change on login (must fail the test);
    • a JWT with alg: none, a JWT signed with the wrong key, a wrong aud, an expired token;
    • a replayed or missing state, a mismatched nonce, a non-registered redirect_uri;
    • a reused reset token, two concurrent redemptions of one reset token (exactly one succeeds), and concurrent refresh-token use;
    • a disabled account's live session. Record the command and summary as test_output through the record-evidence skill, then stop.

Read the full file on GitHub · 130 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 16d ago Changed · +57 lines d36c3f9c8fce
  2. 19d ago First seen · 73 lines · 101 tokens per session scan A 58c1d5db6d73

Subscribe to this mod's changes

auth-session-and-oauth is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 17d ago), licensed Apache-2.0. It adds 101 tokens to every session and 2,017 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-28.

Related

Other skills, from other repositories

bulwark-brainstorm

Role-based brainstorming with dual modes: --scoped (sequential Task tool, 5 roles) and --exploratory (Agent Teams peer debate, 4 roles). Use for feasibility assessment and idea validation.

QBall-Inc/the-bulwark · 50 tokens

plan-creation

Create structured implementation plans via a 4-role scrum team (Product Owner, Architect, Eng/Delivery Lead, QA/Critic) with optional Agent Teams peer debate mode.

QBall-Inc/the-bulwark · 38 tokens

anthropic-validator

Validates Claude Code assets (skills, hooks, agents, commands, MCP servers, plugins) against official Anthropic standards. Fetches latest docs dynamically and produces structured validation reports.

QBall-Inc/the-bulwark · 40 tokens

create-subagent

Generates single-purpose Claude Code sub-agents for use via the Task tool. Use when creating dedicated sub-agents, scaffolding agent definitions, or generating agents with diagnostics and permissions setup.

QBall-Inc/the-bulwark · 42 tokens

test-audit

Audit test suites for T1-T4 violations using AST analysis, mock detection, and multi-stage synthesis. Invoke when user asks to audit tests, check test quality, find mock violations, review test effectiveness, or inspect test suites for over-mocking. Triggers automatic rewrites when quality gates fail.

QBall-Inc/the-bulwark · 0 tokens

code-review

Comprehensive code review with distinct aspect based sections. Use when reviewing code, checking for security issues, finding type safety problems, auditing code quality, or when user asks to review code, PRs or changes. Three-phase workflow runs static tools, LLM judgment, and writes diagnostic log.

QBall-Inc/the-bulwark · 61 tokens