eslint-plugin-jwt-security 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +5 -5
  2. package/package.json +16 -24
  3. package/src/index.d.ts +17 -0
  4. package/{dist/src → src}/index.js +16 -69
  5. package/src/oxlint.d.ts +17 -0
  6. package/src/oxlint.js +3 -0
  7. package/{dist/src → src}/rules/no-algorithm-confusion/index.js +0 -20
  8. package/{dist/src → src}/rules/no-algorithm-none/index.js +0 -38
  9. package/{dist/src → src}/rules/no-decode-without-verify/index.js +0 -14
  10. package/{dist/src → src}/rules/no-hardcoded-secret/index.js +0 -39
  11. package/{dist/src → src}/rules/no-sensitive-payload/index.js +0 -6
  12. package/{dist/src → src}/rules/no-timestamp-manipulation/index.js +0 -6
  13. package/{dist/src → src}/rules/no-weak-secret/index.js +0 -19
  14. package/{dist/src → src}/rules/require-algorithm-whitelist/index.js +0 -9
  15. package/{dist/src → src}/rules/require-audience-validation/index.js +0 -7
  16. package/{dist/src → src}/rules/require-expiration/index.js +0 -16
  17. package/{dist/src → src}/rules/require-issued-at/index.js +0 -21
  18. package/{dist/src → src}/rules/require-issuer-validation/index.js +0 -7
  19. package/{dist/src → src}/rules/require-max-age/index.js +0 -7
  20. package/src/types/index.js +2 -0
  21. package/{dist/src → src}/utils/index.js +1 -74
  22. package/AGENTS.md +0 -102
  23. package/CHANGELOG.md +0 -161
  24. package/dist/AGENTS.md +0 -102
  25. package/dist/CHANGELOG.md +0 -161
  26. package/dist/LICENSE +0 -23
  27. package/dist/README.md +0 -158
  28. package/dist/package.json +0 -125
  29. package/dist/src/index.d.ts +0 -101
  30. package/dist/src/oxlint.d.ts +0 -20
  31. package/dist/src/oxlint.js +0 -21
  32. package/dist/src/rules/no-algorithm-confusion/index.d.ts +0 -24
  33. package/dist/src/rules/no-algorithm-none/index.d.ts +0 -24
  34. package/dist/src/rules/no-decode-without-verify/index.d.ts +0 -23
  35. package/dist/src/rules/no-hardcoded-secret/index.d.ts +0 -23
  36. package/dist/src/rules/no-sensitive-payload/index.d.ts +0 -20
  37. package/dist/src/rules/no-timestamp-manipulation/index.d.ts +0 -23
  38. package/dist/src/rules/no-weak-secret/index.d.ts +0 -23
  39. package/dist/src/rules/require-algorithm-whitelist/index.d.ts +0 -24
  40. package/dist/src/rules/require-audience-validation/index.d.ts +0 -20
  41. package/dist/src/rules/require-expiration/index.d.ts +0 -23
  42. package/dist/src/rules/require-issued-at/index.d.ts +0 -23
  43. package/dist/src/rules/require-issuer-validation/index.d.ts +0 -20
  44. package/dist/src/rules/require-max-age/index.d.ts +0 -24
  45. package/dist/src/types/index.js +0 -7
  46. package/dist/src/utils/index.d.ts +0 -98
  47. package/src/__compatibility__/jwt-interface.spec.ts +0 -192
  48. package/src/index.test.ts +0 -47
  49. package/src/index.ts +0 -209
  50. package/src/oxlint.test.ts +0 -61
  51. package/src/oxlint.ts +0 -23
  52. package/src/rules/no-algorithm-confusion/index.ts +0 -208
  53. package/src/rules/no-algorithm-confusion/no-algorithm-confusion.test.ts +0 -106
  54. package/src/rules/no-algorithm-none/index.ts +0 -270
  55. package/src/rules/no-algorithm-none/no-algorithm-none.test.ts +0 -146
  56. package/src/rules/no-decode-without-verify/index.ts +0 -162
  57. package/src/rules/no-decode-without-verify/no-decode-without-verify.test.ts +0 -76
  58. package/src/rules/no-hardcoded-secret/index.ts +0 -230
  59. package/src/rules/no-hardcoded-secret/no-hardcoded-secret.test.ts +0 -97
  60. package/src/rules/no-sensitive-payload/index.ts +0 -123
  61. package/src/rules/no-sensitive-payload/no-sensitive-payload.test.ts +0 -157
  62. package/src/rules/no-timestamp-manipulation/index.ts +0 -118
  63. package/src/rules/no-timestamp-manipulation/no-timestamp-manipulation.test.ts +0 -54
  64. package/src/rules/no-weak-secret/index.ts +0 -204
  65. package/src/rules/no-weak-secret/no-weak-secret.test.ts +0 -114
  66. package/src/rules/require-algorithm-whitelist/index.ts +0 -145
  67. package/src/rules/require-algorithm-whitelist/require-algorithm-whitelist.test.ts +0 -72
  68. package/src/rules/require-audience-validation/index.ts +0 -120
  69. package/src/rules/require-audience-validation/require-audience-validation.test.ts +0 -68
  70. package/src/rules/require-expiration/index.ts +0 -170
  71. package/src/rules/require-expiration/require-expiration.test.ts +0 -135
  72. package/src/rules/require-issued-at/index.ts +0 -143
  73. package/src/rules/require-issued-at/require-issued-at.test.ts +0 -64
  74. package/src/rules/require-issuer-validation/index.ts +0 -120
  75. package/src/rules/require-issuer-validation/require-issuer-validation.test.ts +0 -68
  76. package/src/rules/require-max-age/index.ts +0 -117
  77. package/src/rules/require-max-age/require-max-age.test.ts +0 -69
  78. package/src/tests/coverage-dual-layer.test.ts +0 -323
  79. package/src/types/index.ts +0 -107
  80. package/src/utils/index.ts +0 -285
  81. package/src/utils/utils.test.ts +0 -324
  82. /package/{dist/src → src}/types/index.d.ts +0 -0
package/dist/package.json DELETED
@@ -1,125 +0,0 @@
1
- {
2
- "name": "eslint-plugin-jwt-security",
3
- "version": "2.3.0",
4
- "description": "ESLint plugin for JWT security — detects algorithm confusion (CVE-2022-23540), alg:none, weak or hardcoded secrets, and decode-without-verify.",
5
- "type": "commonjs",
6
- "main": "./src/index.js",
7
- "types": "./src/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./src/index.d.ts",
11
- "default": "./src/index.js"
12
- },
13
- "./types": {
14
- "types": "./src/types/index.d.ts",
15
- "default": "./src/types/index.js"
16
- },
17
- "./oxlint": {
18
- "types": "./src/oxlint.d.ts",
19
- "default": "./src/oxlint.js"
20
- }
21
- },
22
- "author": "Ofri Peretz <ofriperetzdev@gmail.com>",
23
- "license": "MIT",
24
- "homepage": "https://eslint.interlace.tools/docs/security/plugin-jwt-security?utm_source=npm&utm_medium=referral&utm_campaign=eslint-plugin-jwt-security-security",
25
- "repository": {
26
- "type": "git",
27
- "url": "https://github.com/ofri-peretz/eslint",
28
- "directory": "packages/eslint-plugin-jwt-security"
29
- },
30
- "bugs": {
31
- "url": "https://github.com/ofri-peretz/eslint/issues"
32
- },
33
- "publishConfig": {
34
- "access": "public"
35
- },
36
- "files": [
37
- "src/",
38
- "dist/",
39
- "README.md",
40
- "LICENSE",
41
- "CHANGELOG.md",
42
- "AGENTS.md"
43
- ],
44
- "keywords": [
45
- "eslint",
46
- "eslintplugin",
47
- "eslint-plugin",
48
- "static-analysis",
49
- "linting",
50
- "code-quality",
51
- "security",
52
- "sast",
53
- "appsec",
54
- "vulnerability",
55
- "owasp",
56
- "cwe",
57
- "interlace-security",
58
- "jwt",
59
- "json-web-token",
60
- "jwt-security",
61
- "jsonwebtoken",
62
- "jose",
63
- "express-jwt",
64
- "nestjs-jwt",
65
- "jwks-rsa",
66
- "jwt-decode",
67
- "algorithm-confusion",
68
- "cve-2022-23540",
69
- "cwe-347",
70
- "cwe-757",
71
- "token",
72
- "authentication",
73
- "authorization",
74
- "llm-optimized",
75
- "ai-assistant",
76
- "typescript",
77
- "auto-fix",
78
- "auth-security",
79
- "token-security"
80
- ],
81
- "engines": {
82
- "node": ">=18.0.0"
83
- },
84
- "dependencies": {
85
- "tslib": "^2.3.0",
86
- "@interlace/eslint-devkit": "^1.4.3"
87
- },
88
- "peerDependencies": {
89
- "eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
90
- },
91
- "peerDependenciesMeta": {
92
- "jsonwebtoken": {
93
- "optional": true
94
- },
95
- "@nestjs/jwt": {
96
- "optional": true
97
- },
98
- "express-jwt": {
99
- "optional": true
100
- },
101
- "jose": {
102
- "optional": true
103
- },
104
- "jwks-rsa": {
105
- "optional": true
106
- },
107
- "jwt-decode": {
108
- "optional": true
109
- }
110
- },
111
- "devDependencies": {
112
- "@typescript-eslint/parser": "^8.46.2",
113
- "@typescript-eslint/rule-tester": "^8.46.2"
114
- },
115
- "scripts": {
116
- "build": "tsx ../../scripts/build-package.ts",
117
- "test": "vitest run",
118
- "test:coverage": "vitest run --coverage",
119
- "typecheck": "tsc -p tsconfig.lib.json --noEmit"
120
- },
121
- "funding": {
122
- "type": "github",
123
- "url": "https://github.com/ofri-peretz/eslint"
124
- }
125
- }
@@ -1,101 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * eslint-plugin-jwt-security
8
- *
9
- * Comprehensive JWT security ESLint plugin for Node.js applications.
10
- * Detects vulnerabilities across jsonwebtoken, jose, express-jwt,
11
- * @nestjs/jwt, jwks-rsa, and jwt-decode libraries.
12
- *
13
- * Features:
14
- * - Algorithm confusion attack detection (CVE-2022-23540)
15
- * - "Back to the Future" replay attack prevention (LightSEC 2025)
16
- * - Signature verification enforcement
17
- * - Weak secret detection
18
- * - Expiration and claim validation
19
- * - AI-assisted fix guidance with CWE references
20
- *
21
- * @see https://tools.ietf.org/html/rfc8725
22
- * @see https://securitypattern.com/post/jwt-back-to-the-future
23
- */
24
- import type { TSESLint } from '@interlace/eslint-devkit';
25
- import { noAlgorithmNone } from './rules/no-algorithm-none';
26
- import { noAlgorithmConfusion } from './rules/no-algorithm-confusion';
27
- import { requireAlgorithmWhitelist } from './rules/require-algorithm-whitelist';
28
- import { noDecodeWithoutVerify } from './rules/no-decode-without-verify';
29
- import { noWeakSecret } from './rules/no-weak-secret';
30
- import { requireExpiration } from './rules/require-expiration';
31
- import { noHardcodedSecret } from './rules/no-hardcoded-secret';
32
- import { requireIssuedAt } from './rules/require-issued-at';
33
- import { requireIssuerValidation } from './rules/require-issuer-validation';
34
- import { requireAudienceValidation } from './rules/require-audience-validation';
35
- import { noTimestampManipulation } from './rules/no-timestamp-manipulation';
36
- import { requireMaxAge } from './rules/require-max-age';
37
- import { noSensitivePayload } from './rules/no-sensitive-payload';
38
- /**
39
- * Collection of all JWT security ESLint rules (13 rules)
40
- */
41
- export declare const rules: Record<string, TSESLint.RuleModule<string, readonly unknown[]>>;
42
- /**
43
- * ESLint Plugin object
44
- */
45
- export declare const plugin: TSESLint.FlatConfig.Plugin;
46
- /**
47
- * Configuration presets for flat config
48
- */
49
- export declare const configs: {
50
- /**
51
- * Flagship preset — the rule from this plugin in the ecosystem-wide
52
- * flagship list (`.agent/flagship-rules.md`). Use this when you want
53
- * the highest-signal JWT subset shippable in CI gates.
54
- */
55
- flagship: {
56
- plugins: {
57
- jwt: TSESLint.FlatConfig.Plugin;
58
- };
59
- rules: {
60
- 'jwt/no-algorithm-none': "error";
61
- };
62
- };
63
- /**
64
- * Recommended preset - balanced security
65
- */
66
- recommended: {
67
- plugins: {
68
- jwt: TSESLint.FlatConfig.Plugin;
69
- };
70
- rules: Record<string, TSESLint.SharedConfig.RuleEntry>;
71
- };
72
- /**
73
- * Strict preset - maximum security (includes 2025 research)
74
- */
75
- strict: {
76
- plugins: {
77
- jwt: TSESLint.FlatConfig.Plugin;
78
- };
79
- rules: Record<string, TSESLint.SharedConfig.RuleEntry>;
80
- };
81
- /**
82
- * Legacy preset - migration mode
83
- */
84
- legacy: {
85
- plugins: {
86
- jwt: TSESLint.FlatConfig.Plugin;
87
- };
88
- rules: Record<string, TSESLint.SharedConfig.RuleEntry>;
89
- };
90
- /**
91
- * All rules preset
92
- */
93
- all: {
94
- plugins: {
95
- jwt: TSESLint.FlatConfig.Plugin;
96
- };
97
- rules: Record<string, TSESLint.SharedConfig.RuleEntry>;
98
- };
99
- };
100
- export default plugin;
101
- export { noAlgorithmNone, noAlgorithmConfusion, requireAlgorithmWhitelist, noDecodeWithoutVerify, noWeakSecret, requireExpiration, noHardcodedSecret, requireIssuedAt, requireIssuerValidation, requireAudienceValidation, noTimestampManipulation, requireMaxAge, noSensitivePayload, };
@@ -1,20 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * oxlint sub-export.
8
- *
9
- * Consumers wire oxlint to this entry via:
10
- * { "jsPlugins": ["eslint-plugin-jwt-security/oxlint"] }
11
- *
12
- * oxlint's JS plugin loader does `require('eslint-plugin-jwt-security/oxlint')` and reads
13
- * `.rules` off the result. The compiled output of `export = plugin` is
14
- * `module.exports = plugin`, which gives oxlint the plugin object directly
15
- * (`{ meta, rules }`) — no wrapper, no `.default` indirection.
16
- *
17
- * Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
18
- */
19
- import { plugin } from './index';
20
- export = plugin;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2025 Ofri Peretz
4
- * Licensed under the MIT License. Use of this source code is governed by the
5
- * MIT license that can be found in the LICENSE file.
6
- */
7
- /**
8
- * oxlint sub-export.
9
- *
10
- * Consumers wire oxlint to this entry via:
11
- * { "jsPlugins": ["eslint-plugin-jwt-security/oxlint"] }
12
- *
13
- * oxlint's JS plugin loader does `require('eslint-plugin-jwt-security/oxlint')` and reads
14
- * `.rules` off the result. The compiled output of `export = plugin` is
15
- * `module.exports = plugin`, which gives oxlint the plugin object directly
16
- * (`{ meta, rules }`) — no wrapper, no `.default` indirection.
17
- *
18
- * Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
19
- */
20
- const index_1 = require("./index");
21
- module.exports = index_1.plugin;
@@ -1,24 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-algorithm-confusion
8
- *
9
- * Detects algorithm confusion attacks where symmetric algorithms (HS256/384/512)
10
- * are used with asymmetric keys (public keys). This allows attackers to sign
11
- * tokens using the public key as an HMAC secret.
12
- *
13
- * CWE-347: Improper Verification of Cryptographic Signature
14
- *
15
- * @see https://portswigger.net/web-security/jwt/algorithm-confusion
16
- */
17
- import type { TSESLint } from '@interlace/eslint-devkit';
18
- import type { NoAlgorithmConfusionOptions } from '../../types';
19
- type MessageIds = 'algorithmConfusion' | 'symmetricWithPublicKey' | 'useAsymmetricAlgorithm';
20
- type RuleOptions = [NoAlgorithmConfusionOptions?];
21
- export declare const noAlgorithmConfusion: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
22
- name: string;
23
- };
24
- export default noAlgorithmConfusion;
@@ -1,24 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-algorithm-none
8
- *
9
- * Detects attempts to use the 'none' algorithm which bypasses JWT signature verification.
10
- * This is a critical vulnerability (CVE-2022-23540) that allows attackers to forge JWT tokens.
11
- *
12
- * CWE-347: Improper Verification of Cryptographic Signature
13
- *
14
- * @see https://nvd.nist.gov/vuln/detail/CVE-2022-23540
15
- * @see https://tools.ietf.org/html/rfc8725
16
- */
17
- import type { TSESLint } from '@interlace/eslint-devkit';
18
- import type { NoAlgorithmNoneOptions } from '../../types';
19
- type MessageIds = 'algorithmNone' | 'algorithmNoneInArray' | 'emptyAlgorithms' | 'useSecureAlgorithm' | 'decodeWithoutVerify';
20
- type RuleOptions = [NoAlgorithmNoneOptions?];
21
- export declare const noAlgorithmNone: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
22
- name: string;
23
- };
24
- export default noAlgorithmNone;
@@ -1,23 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-decode-without-verify
8
- *
9
- * Detects usage of jwt.decode() or jwt-decode library without corresponding
10
- * verification. Decoded JWTs can be tampered with by attackers.
11
- *
12
- * CWE-345: Insufficient Verification of Data Authenticity
13
- *
14
- * @see https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/06-Session_Management_Testing/10-Testing_JSON_Web_Tokens
15
- */
16
- import type { TSESLint } from '@interlace/eslint-devkit';
17
- import type { NoDecodeWithoutVerifyOptions } from '../../types';
18
- type MessageIds = 'decodeWithoutVerify' | 'jwtDecodeLibrary' | 'useVerifyInstead';
19
- type RuleOptions = [NoDecodeWithoutVerifyOptions?];
20
- export declare const noDecodeWithoutVerify: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
21
- name: string;
22
- };
23
- export default noDecodeWithoutVerify;
@@ -1,23 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-hardcoded-secret
8
- *
9
- * Detects hardcoded secrets in JWT sign/verify operations.
10
- * Hardcoded secrets in source code are a critical security vulnerability.
11
- *
12
- * CWE-798: Use of Hard-coded Credentials
13
- *
14
- * @see https://cwe.mitre.org/data/definitions/798.html
15
- */
16
- import type { TSESLint } from '@interlace/eslint-devkit';
17
- import type { NoHardcodedSecretOptions } from '../../types';
18
- type MessageIds = 'hardcodedSecret' | 'useEnvVariable';
19
- type RuleOptions = [NoHardcodedSecretOptions?];
20
- export declare const noHardcodedSecret: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
21
- name: string;
22
- };
23
- export default noHardcodedSecret;
@@ -1,20 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-sensitive-payload
8
- *
9
- * Detects storage of sensitive data in JWT payload.
10
- * JWT payloads are only base64-encoded, not encrypted.
11
- *
12
- * CWE-359: Exposure of Private Personal Information
13
- */
14
- import type { TSESLint } from '@interlace/eslint-devkit';
15
- import type { NoSensitivePayloadOptions } from '../../types';
16
- type RuleOptions = [NoSensitivePayloadOptions?];
17
- export declare const noSensitivePayload: TSESLint.RuleModule<"sensitivePayloadField", RuleOptions, unknown, TSESLint.RuleListener> & {
18
- name: string;
19
- };
20
- export default noSensitivePayload;
@@ -1,23 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-timestamp-manipulation
8
- *
9
- * Detects patterns that disable automatic timestamp (iat) generation.
10
- * This enables the "Back to the Future" replay attack (LightSEC 2025).
11
- *
12
- * CWE-294: Authentication Bypass by Capture-replay
13
- *
14
- * @see https://securitypattern.com/post/jwt-back-to-the-future
15
- */
16
- import type { TSESLint } from '@interlace/eslint-devkit';
17
- import type { JwtRuleOptions } from '../../types';
18
- type MessageIds = 'timestampDisabled' | 'noTimestampTrue';
19
- type RuleOptions = [JwtRuleOptions?];
20
- export declare const noTimestampManipulation: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
21
- name: string;
22
- };
23
- export default noTimestampManipulation;
@@ -1,23 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: no-weak-secret
8
- *
9
- * Detects weak secrets used for HMAC-based JWT signing.
10
- * Weak secrets can be brute-forced, allowing attackers to forge tokens.
11
- *
12
- * CWE-326: Inadequate Encryption Strength
13
- *
14
- * @see https://tools.ietf.org/html/rfc8725
15
- */
16
- import type { TSESLint } from '@interlace/eslint-devkit';
17
- import type { NoWeakSecretOptions } from '../../types';
18
- type MessageIds = 'weakSecret' | 'shortSecret' | 'useStrongSecret';
19
- type RuleOptions = [NoWeakSecretOptions?];
20
- export declare const noWeakSecret: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
21
- name: string;
22
- };
23
- export default noWeakSecret;
@@ -1,24 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: require-algorithm-whitelist
8
- *
9
- * Enforces explicit algorithm specification in JWT verify operations.
10
- * Without explicit algorithms, the token's header algorithm is trusted,
11
- * enabling algorithm substitution attacks.
12
- *
13
- * CWE-757: Selection of Less-Secure Algorithm During Negotiation
14
- *
15
- * @see https://tools.ietf.org/html/rfc8725
16
- */
17
- import type { TSESLint } from '@interlace/eslint-devkit';
18
- import type { RequireAlgorithmWhitelistOptions } from '../../types';
19
- type MessageIds = 'missingAlgorithmWhitelist' | 'addAlgorithmWhitelist';
20
- type RuleOptions = [RequireAlgorithmWhitelistOptions?];
21
- export declare const requireAlgorithmWhitelist: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
22
- name: string;
23
- };
24
- export default requireAlgorithmWhitelist;
@@ -1,20 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: require-audience-validation
8
- *
9
- * Mandates audience (aud) claim validation in JWT verify operations.
10
- * Without audience validation, tokens intended for other services are accepted.
11
- *
12
- * CWE-287: Improper Authentication
13
- */
14
- import type { TSESLint } from '@interlace/eslint-devkit';
15
- import type { RequireAudienceValidationOptions } from '../../types';
16
- type RuleOptions = [RequireAudienceValidationOptions?];
17
- export declare const requireAudienceValidation: TSESLint.RuleModule<"missingAudienceValidation", RuleOptions, unknown, TSESLint.RuleListener> & {
18
- name: string;
19
- };
20
- export default requireAudienceValidation;
@@ -1,23 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: require-expiration
8
- *
9
- * Mandates expiration claim (exp) or expiresIn option in JWT sign operations.
10
- * Tokens without expiration are valid forever, creating security risks.
11
- *
12
- * CWE-613: Insufficient Session Expiration
13
- *
14
- * @see https://tools.ietf.org/html/rfc8725
15
- */
16
- import type { TSESLint } from '@interlace/eslint-devkit';
17
- import type { RequireExpirationOptions } from '../../types';
18
- type MessageIds = 'missingExpiration' | 'addExpiration';
19
- type RuleOptions = [RequireExpirationOptions?];
20
- export declare const requireExpiration: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
21
- name: string;
22
- };
23
- export default requireExpiration;
@@ -1,23 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: require-issued-at
8
- *
9
- * Mandates the `iat` (issued at) claim in JWT tokens for freshness validation.
10
- * Without `iat`, tokens cannot be validated for age, enabling the
11
- * "Back to the Future" replay attack (LightSEC 2025).
12
- *
13
- * CWE-294: Authentication Bypass by Capture-replay
14
- *
15
- * @see https://securitypattern.com/post/jwt-back-to-the-future
16
- */
17
- import type { TSESLint } from '@interlace/eslint-devkit';
18
- import type { JwtRuleOptions } from '../../types';
19
- type RuleOptions = [JwtRuleOptions?];
20
- export declare const requireIssuedAt: TSESLint.RuleModule<"missingIssuedAt", RuleOptions, unknown, TSESLint.RuleListener> & {
21
- name: string;
22
- };
23
- export default requireIssuedAt;
@@ -1,20 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: require-issuer-validation
8
- *
9
- * Mandates issuer (iss) claim validation in JWT verify operations.
10
- * Without issuer validation, tokens from any issuer are accepted.
11
- *
12
- * CWE-287: Improper Authentication
13
- */
14
- import type { TSESLint } from '@interlace/eslint-devkit';
15
- import type { RequireIssuerValidationOptions } from '../../types';
16
- type RuleOptions = [RequireIssuerValidationOptions?];
17
- export declare const requireIssuerValidation: TSESLint.RuleModule<"missingIssuerValidation", RuleOptions, unknown, TSESLint.RuleListener> & {
18
- name: string;
19
- };
20
- export default requireIssuerValidation;
@@ -1,24 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Ofri Peretz
3
- * Licensed under the MIT License. Use of this source code is governed by the
4
- * MIT license that can be found in the LICENSE file.
5
- */
6
- /**
7
- * ESLint Rule: require-max-age
8
- *
9
- * Mandates maxAge option in JWT verify operations to enforce token freshness.
10
- * This prevents the "Back to the Future" replay attack where tokens are
11
- * captured and replayed months or years later.
12
- *
13
- * CWE-294: Authentication Bypass by Capture-replay
14
- *
15
- * @see https://securitypattern.com/post/jwt-back-to-the-future
16
- * @see LightSEC 2025 - "JWT Back to the future: On the (ab)use of JWTs"
17
- */
18
- import type { TSESLint } from '@interlace/eslint-devkit';
19
- import type { JwtRuleOptions } from '../../types';
20
- type RuleOptions = [JwtRuleOptions?];
21
- export declare const requireMaxAge: TSESLint.RuleModule<"missingMaxAge", RuleOptions, unknown, TSESLint.RuleListener> & {
22
- name: string;
23
- };
24
- export default requireMaxAge;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2025 Ofri Peretz
4
- * Licensed under the MIT License. Use of this source code is governed by the
5
- * MIT license that can be found in the LICENSE file.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });