sonarjs/insecure-jwt-token
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/insecure-jwt-token": "error",
},
},
];JWT should be signed and verified with strong cipher algorithms
const jwt = require('jsonwebtoken');
let token = jwt.sign({ foo: 'bar' }, key, { algorithm: 'none' }); // Noncompliant: 'none' cipher doesn't sign the JWT (no signature will be included)
jwt.verify(token, key, { expiresIn: 360000 * 5, algorithms: ['RS256', 'none'] }, callbackcheck); // Noncompliant: 'none' cipher should not be used when verifying JWT signatureconst jwt = require('jsonwebtoken');
let token = jwt.sign({ foo: 'bar' }, key, { algorithm: 'HS256' }); // Compliant
jwt.verify(token, key, { expiresIn: 360000 * 5, algorithms: ['HS256'] }, callbackcheck); // CompliantExamples from the ESLint documentation.
sonarjs/insecure-jwt-token
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/insecure-jwt-token": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Assertion arguments should be passed in the correct order
"indexOf" checks should not be for positive numbers
React components should not render non-boolean condition values
Functions should be called consistently with or without "new"
Only "while", "do", "for" and "switch" statements should be labelled