viper-auth-oauth-jwt
Skill22 starsChanged 15 days agoMITView on GitHub
Authentication, OAuth 2.0 / OIDC & JWT Security Auditor. Reviews token verification, algorithm allowlisting, claim validation, and OAuth redirect_uri configurations.
In this repository72 other files it gives its agents.
- llms.txtllms.txt
- viper-agent-skill-supplychainSkill
- viper-ai-llm-guardrailsSkill
- viper-api-gateway-apigee-kongSkill
- viper-aws-iam-cloud-auditSkill
- viper-bola-idorSkill
- viper-browser-extension-mv3Skill
- viper-browseros-agentSkill
- viper-cicd-hardeningSkill
- viperclawSkill
- viper-container-k8s-auditSkill
- viper-crypto-tls-auditSkill
- viper-csrf-samesite-auditSkill
- viper-dependency-sbomSkill
- viper-deserialization-parserSkill
- viper-diff-pr-reviewSkill
- viper-dns-email-domainSkill
- viper-electron-tauri-desktopSkill
- viper-fastapi-django-flaskSkill
- viper-file-upload-storageSkill
- viper-gcp-azure-cloud-auditSkill
- viper-github-repo-governanceSkill
- viper-go-service-auditSkill
- viper-graphql-wsSkill
- viper-grpc-protobuf-auditSkill
- viper-headers-csp-corsSkill
- viper-iac-terraform-auditSkill
- viper-incident-forensics-triageSkill
- viper-injection-oracleSkill
- viper-java-spring-auditSkill
- viper-js-harvesterSkill
- viper-kafka-rabbitmq-queueSkill
- viper-linux-systemd-hostSkill
- viper-logging-pii-complianceSkill
- viper-mcp-server-auditSkill
- viper-mobile-api-configSkill
- viper-multitenant-isolationSkill
- viper-nextjs-react-rscSkill
- viper-nginx-envoy-gatewaySkill
- viper-nodejs-express-nestjsSkill
- viper-oauth-oidc-complianceSkill
- viper-openapi-rest-schemaSkill
- viper-orchestratorSkill
- viper-payment-stripe-pciSkill
- viper-php-laravel-wordpressSkill
- viper-postgres-redis-mongoSkill
- viper-privacy-gdpr-hipaaSkill
- viper-proof-judgeSkill
- viper-proxy-fingerprintSkill
- viper-proxy-parser-alignmentSkill
- viper-race-logicSkill
- viper-rag-vector-auditSkill
- viper-rate-limit-dos-resilienceSkill
- viper-remediation-patch-verifierSkill
- viper-ruby-rails-auditSkill
- viper-rust-memory-unsafeSkill
- viper-saml-sso-enterpriseSkill
- viper-sbom-slsa-provenanceSkill
- viper-secrets-auditSkill
- viper-semgrep-rule-authorSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
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 30
Run the following discovery commands across the target repository before manual code review:
- Distinctive: line 62
Verify whether an upstream API Gateway, global middleware, or ORM hook already enforces the control before flagging a controller.
- Distinctive: line 102
Write a Positive Unit Test confirming authorized, schema-valid requests succeed.
- Distinctive: line 103
Write a Negative Security Regression Test confirming unauthorized, cross-tenant, or malformed inputs are deterministically rejected.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Authentication, JWT Cryptographic Verification & OAuth 2.0 Auditor (viper-auth-oauth-jwt)
1. Executive Scope, Standards & CWE/OWASP Mapping
- Frameworks & Standards: RFC 8725 (JWT Best Current Practices), RFC 9700 (OAuth 2.0 Security BCP), OWASP ASVS V2/V3, CWE-347, CWE-287
- Primary CWE Mapping: CWE-347 (Improper Verification of Cryptographic Signature), CWE-287 (Improper Authentication), CWE-327 (Broken or Risky Crypto Algorithm), CWE-601 (Open Redirect in OAuth)
- ViperClaw MCP Tools:
viper_jwt_audit,viper_browser_ingest,viper_diff_oracle,viper_verify_and_report - ViperClaw CLI Command:
viperclaw jwt "<token>" --output jwt_audit.json
2. Threat Model & Root-Cause Architecture
flowchart LR
Token["Incoming Bearer JWT / OAuth Code"] --> Header["Header Guard (Pin alg & kid)"] --> Crypto["Asymmetric / High-Entropy Verify"] --> Claims["Validate exp, iss, aud, sub"]Root-Cause Analysis
Authentication gaps arise when JWT libraries trust the token's own header (alg, kid, jku, jwk) to select the verification key or algorithm, or when OAuth account-linking flows trust unverified email addresses or loosely matched redirect_uri values.
3. Deterministic Discovery & Grep/AST Audit Commands
Run the following discovery commands across the target repository before manual code review:
# 1. Automated ViperClaw analysis
viperclaw jwt "<token>" --output jwt_audit.json
# 2. Rapid static pattern discovery (ripgrep)
rg -n "(jwt\.decode|jwt\.verify|jsonwebtoken|Jose\.JWT|NimbusJwtDecoder)"
rg -n "(verify_signature\s*:\s*False|options\s*=\s*\{.*verify_signature)"
rg -n "(redirect_uri|client_secret|response_type|code_verifier)"4. Senior Security Engineer 8-Point Audit Checklist
| Control ID | Audit Verification Target | Pass Criteria | Fail / Vulnerability Indicator |
AUTH-01 | Explicit JWT Algorithm Pinning | Verification call hardcodes algorithms=["RS256"] (or ES256/EdDSA); never reads header.alg dynamically. | alg: none accepted or RS256 public key usable as HS256 HMAC secret. |
AUTH-02 | HMAC Secret Entropy (>= 256 bits) | Symmetric HS256 keys generated via CSPRNG (>= 32 random bytes), never dictionary words. | Weak secret (secret, changeme, app name) recoverable offline via viperclaw jwt. |
AUTH-03 | Untrusted Header Parameters (kid, jku, jwk) | kid matched against a strict alphanumeric allowlist of server-configured key IDs; jku/x5u/jwk ignored. | kid passed into file path (../../../../dev/null) or SQL query. |
AUTH-04 | Mandatory Claim Validation (exp, iss, aud) | Verifier enforces require=["exp", "iss", "aud", "sub"] with bounded clock skew. | Tokens without exp never expire, or tokens from a staging/sibling service (aud mismatch) are accepted. |
AUTH-05 | Pre-ATO Email Collision Prevention | Linking an OAuth provider to an existing password account requires email_verified === true AND re-authentication if the email wasn't previously verified. | An unverified account can be pre-registered before a user signs up with Google OAuth and retains active session. |
AUTH-06 | Password Reset Token Security | Reset tokens are >= 128-bit CSPRNG, hashed (SHA-256) at rest in DB, expire in <= 15m, and are single-use. | Predictable UUIDv1/timestamp reset tokens or tokens not invalidated after use. |
AUTH-07 | Account Enumeration Resistance | Login, registration, and password-reset endpoints return uniform response messages and status codes (using dummy bcrypt verify on missing users). | Login returns "User not found" vs. "Wrong password" or 2ms vs. 250ms timing difference. |
AUTH-08 | Token Type Separation (Access vs. Refresh) | Refresh tokens cannot be used as Bearer access tokens on API endpoints (typ / token_use claim checked). | Long-lived refresh token accepted directly by auth middleware as an access token. |
5. False-Positive Elimination & CVSS v3.1 Triage Rubric
False-Positive Gate
- Verify whether an upstream API Gateway, global middleware, or ORM hook already enforces the control before flagging a controller.
- Confirm the code path is reachable from an external entrypoint (not dead code, CLI-only admin script, or unit-test fixture).
| Severity Tier | Baseline CVSS v3.1 Vector | Qualifying Security Impact |
| CRITICAL (9.8) | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H | Weak JWT HMAC secret, alg:none acceptance, or unvalidated kid path resolution allowing admin impersonation. |
| HIGH (8.1) | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N | OAuth redirect_uri validation gap or Pre-ATO unverified email collision leading to account takeover. |
| MEDIUM (5.3) | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N | Missing exp / aud validation or observable username enumeration on login. |
6. Production Remediation Patterns (Vulnerable vs. Hardened Code)
# ❌ VULNERABLE: Trusts unverified header alg, uses weak secret, and skips aud/iss checks
def verify_user_token(token: str) -> dict:
hdr = jwt.get_unverified_header(token)
return jwt.decode(token, key="secret123", algorithms=[hdr["alg"]])
# ✅ HARDENED: Pins asymmetric algorithm, allowlists kid, and enforces exp/iss/aud claims
ALLOWED_KIDS = {"prod-rs256-2026-01": PUBLIC_KEY_PEM_2026}
def verify_user_token(token: str) -> dict:
hdr = jwt.get_unverified_header(token)
kid = hdr.get("kid")
if hdr.get("alg") != "RS256" or kid not in ALLOWED_KIDS:
raise ValueError("Untrusted JWT algorithm or key ID")
return jwt.decode(
token,
key=ALLOWED_KIDS[kid],
algorithms=["RS256"],
issuer="https://auth.example.com",
audience="https://api.example.com",
options={"require": ["exp", "iat", "iss", "aud", "sub"]},
)7. Regression Testing & Continuous Verification
- Write a Positive Unit Test confirming authorized, schema-valid requests succeed.
- Write a Negative Security Regression Test confirming unauthorized, cross-tenant, or malformed inputs are deterministically rejected.
- Re-run
viperclaw taintandviperclaw verifyto confirm zero remaining unmitigated flows in.viperclaw/graph.db.
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.

