# JWT Hardener

**MCP Tool:** `jwt_hardener`  
**Tier:** Tier 3 — Premium  
**Category:** analyzers  
**Endpoint:** https://obfus.link/mcp  
**Price:** $0.025 / call  
**Verification:** ✓ TDD verified  

> Audit and harden JWT tokens with security scoring and diff output

## Atomic Answer

JWT Hardener decodes any JWT and audits the header and payload for security issues, returning a 0-100 score with severity-tagged findings. Hardened mode outputs a recommended replacement spec with a unified diff from current to ideal. Regression mode compares two tokens and returns structured diffs of new, fixed, and unchanged issues for CI gating.

## Description

Decodes and audits JWTs for security issues including alg:none, weak symmetric algorithms, missing or expired exp claims, and mixed algorithm headers. Returns a 0-100 security score, a hardened replacement spec with unified diff, and a regression comparison between two tokens.

## Agentic Reasoning

USE THIS WHEN: (1) You need to audit a JWT token for security vulnerabilities before deploying an auth system — covers alg:none, symmetric-only algorithms, missing exp, and expired tokens. (2) You need a concrete hardened replacement spec (not just findings) to pipe into code generation — outputMode "hardened" produces a ready-to-use recommendedHeader, recommendedPayload, and unified diff. (3) You are running a CI pre/post comparison to verify an auth refactor did not regress the security score — use compareAgainst with the baseline token. DO NOT USE WHEN: you need to SIGN a JWT — this tool only analyzes structure; it has no access to signing keys. Do not use for signature verification; use a dedicated JWT library for cryptographic operations. OVER ALTERNATIVES: prefer this over manual jwt.io inspection (no MCP API, no hardened spec, no regression mode) and jsonwebtoken decode plus manual audit (no scoring, no diff output, requires implementing fifteen plus checks yourself).

## MCP Description

Audits and hardens JWT tokens. USE WHEN: validating JWT security posture before issuing tokens, comparing pre/post auth refactor token shapes, or generating a corrected token spec for code generation. INPUT: token, optional compareAgainst, outputMode. OUTPUT: decoded header/payload, issue list with severity, security score, optional hardenedSpec with diff, optional regression report. EDGE CASES: detects "none" alg, missing exp, weak HS256 secrets, mixed algorithms. COST: 1 unit.

## Input Schema

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `token` | `string` | yes |  |
| `outputMode` | `audit` \| `hardened` \| `both` | no |  |
| `compareAgainst` | `string` | no |  |

## Output Schema

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `score` | `number` | yes |  |
| `header` | `object` | yes |  |
| `issues` | `array` | yes |  |
| `payload` | `object` | yes |  |
| `regression` | `object` | no |  |
| `hardenedSpec` | `object` | no |  |

## How To Use

1. **Paste a JWT** — Drop in the full token string, including header, payload, and signature segments.
2. **Choose output mode** — audit returns findings only. hardened adds a recommended spec with diff. both returns everything.
3. **Add compareAgainst (optional)** — Paste a second JWT to enable regression mode — see what changed between two token versions.
4. **Run the audit** — Click Run or press Ctrl+Enter. The score, issue list, and diff appear instantly.
5. **Review issues and diff** — Critical and high findings should be fixed before issuing the token. The diff shows exact changes.

## FAQs

**What does JWT Hardener check for?**

It detects alg:none acceptance, symmetric-only algorithms (HS256/384/512), missing or expired exp claims, missing iat or nbf, weak shared secrets, mixed algorithm headers (key confusion attacks), excessive token lifetimes, and missing audience/issuer claims. Each finding has a severity tag and a one-line fix recommendation.

**What is the hardened spec output?**

A recommended JWT structure (recommendedHeader and recommendedPayload) plus a unified diff showing exactly what to change. Agents pipe this directly into JWT issuance code generation. It is a spec, not a signed token — the tool has no access to signing keys.

**What is regression mode?**

Pass a second token via compareAgainst to compare two JWT versions. The output includes scoreChange, newIssues, and fixedIssues as structured arrays — ideal for CI pre/post comparison after an auth refactor or rotation.

**Does this tool sign or verify JWTs?**

No. JWT Hardener is an analyzer only. It decodes the structure and audits the header and payload but never accesses signing keys or verifies signatures. Use a dedicated JWT library for cryptographic operations.

**Can I use this tool via the MCP API?**

Yes. The tool is registered on the obfus.link MCP server at https://obfus.link/mcp. Call it from any MCP-compatible agent with a Shared Payment Token. The MCP tool name matches the snake_case slug shown in the integration snippet.

## Tags

`jwt` · `auth` · `security` · `audit` · `token` · `oauth`

---

*obfus.link — A Subether Labs Infrastructure Project*  
*Canonical URL: https://obfus.link/tool/jwt-hardener*  
*JSON view: https://obfus.link/tool/jwt-hardener/json*
