Zero-Trust Auth: The JWT Static Analysis Standard

Automated enforcement for bulletproof authentication. Use static analysis to detect algorithm confusion and weak secrets programmatically.

3 min read
Zero-Trust Auth: The JWT Static Analysis Standard
Share:

Authentication is the front door of your ecosystem. Weak JWT configurations are a gift to attackers. Here is the engineering standard for automated Zero-Trust authentication through static analysis.

Quick Install

bash
npm install --save-dev eslint-plugin-jwt

Flat Config

javascript
// eslint.config.js
import jwt from 'eslint-plugin-jwt';

export default [jwt.configs.recommended];

Run ESLint

bash
npx eslint .

You'll see output like:

bash
src/auth.ts
  15:3  error  ๐Ÿ”’ CWE-347 CVSS:9.8 | JWT algorithm 'none' is allowed
               Fix: Remove 'none' from algorithms: ['HS256']

src/verify.ts
  28:5  error  ๐Ÿ”’ CWE-613 | JWT missing expiration
               Fix: Add expiresIn: '1h' or exp claim

Rule Overview

RuleCWEWhat it catches
no-algorithm-noneCWE-347Algorithm 'none' bypass
no-algorithm-confusionCWE-327RS256/HS256 confusion
no-weak-secretCWE-326Brute-forceable secrets
no-hardcoded-secretCWE-798Secrets in source code
no-sensitive-payloadCWE-312PII in token payload
require-expirationCWE-613Missing exp claim
require-algorithm-whitelistCWE-327No explicit algorithms
require-issuer-validationCWE-345Missing iss check
require-audience-validationCWE-345Missing aud check
no-decode-without-verifyCWE-347jwt.decode() misuse
require-issued-atCWE-613Missing iat claim
require-max-ageCWE-613No maxAge in verify
no-timestamp-manipulationCWE-345Clock skew exploits

Quick Wins

Before

javascript
// โŒ Algorithm none allowed
jwt.verify(token, secret, {
  algorithms: ['HS256', 'none'],
});

After

javascript
// โœ… Explicit safe algorithm
jwt.verify(token, secret, {
  algorithms: ['HS256'],
});

Before

javascript
// โŒ No expiration
jwt.sign({ userId: 123 }, secret);

After

javascript
// โœ… Short-lived token
jwt.sign({ userId: 123 }, secret, {
  expiresIn: '1h',
});

Complete Secure Pattern

javascript
// Signing
const token = jwt.sign({ userId: 123 }, process.env.JWT_SECRET, {
  expiresIn: '1h',
  algorithm: 'HS256',
  issuer: 'your-app',
  audience: 'your-api',
});

// Verifying
const payload = jwt.verify(token, process.env.JWT_SECRET, {
  algorithms: ['HS256'],
  issuer: 'your-app',
  audience: 'your-api',
  maxAge: '1h',
});

Available Presets

javascript
// Security-focused configuration
jwt.configs.recommended;

// All rules enabled
jwt.configs.all;

Quick Reference

bash
# Install
npm install --save-dev eslint-plugin-jwt

# Config (eslint.config.js)
import jwt from 'eslint-plugin-jwt';
export default [jwt.configs.recommended];

# Run
npx eslint .

๐Ÿ“ฆ npm: eslint-plugin-jwt ๐Ÿ“– Full Rule List


The Interlace ESLint Ecosystem Interlace is a high-fidelity suite of static code analyzers designed to automate security, performance, and reliability for the modern Node.js stack. With over 330 rules across 18 specialized plugins, it provides 100% coverage for OWASP Top 10, LLM Security, and Database Hardening.

Explore the full Documentation

ยฉ 2026 Ofri Peretz. All rights reserved.


Build Securely. I'm Ofri Peretz, a Security Engineering Leader and the architect of the Interlace Ecosystem. I build static analysis standards that automate security and performance for Node.js fleets at scale.

ofriperetz.dev | LinkedIn | GitHub

Built with Nuxt UI โ€ข ยฉ 2026 Ofri Peretz