Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

Harden JWT tokens with jti, nbf, iss claims and revocation tracking #6

@haasonsaas

Description

@haasonsaas

Summary

Session JWTs use only exp for expiry. Missing standard claims make tokens weaker against replay and misuse.

Current state

  • internal/crypto/sessionjwt/manager.go — tokens have session_id, tenant_id, agent_id, run_id, tool_context, workload_hash, exp
  • No jti (JWT ID) — same token can't be individually revoked or tracked
  • No nbf (not before) — no clock skew tolerance
  • No iss (issuer) — can't distinguish tokens from different broker instances
  • No token revocation list — revoking a session doesn't immediately invalidate outstanding tokens

Required work

  • Add jti claim with a unique ID per token
  • Add nbf claim (issued-at minus clock skew tolerance)
  • Add iss claim with the broker's identity
  • Implement a token revocation list in Redis (or in-memory for dev): on session revoke, add the jti to the revocation set
  • Check the revocation list on every token verification
  • Set revocation list entries to auto-expire when the token's exp would have passed (no unbounded growth)

Files

  • internal/crypto/sessionjwt/manager.go — add claims, check revocation
  • internal/store/redis/runtime.go — add revocation set operations
  • internal/app/service.go — on RevokeSession, add token jti to revocation list

Priority

Medium — important for security hardening, not blocking for initial deployment.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions