sonarjs/no-weak-keys
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-weak-keys": "error",
},
},
];var { privateKey, publicKey } = crypto.generateKeyPairSync('rsa', {
modulusLength: 1024, // Noncompliant
publicKeyEncoding: { type: 'spki', format: 'pem' },
privateKeyEncoding: { type: 'pkcs8', format: 'pem' }
}); // Noncompliant: 1024 bits is too short for a RSA key pair
crypto.generateKeyPair('ec', {
namedCurve: 'secp112r2',
publicKeyEncoding: { type: 'spki', format: 'pem' },
privateKeyEncoding: { type: 'pkcs8', format: 'pem' }
}, callback); // Noncompliant: secp112r2 curve doesn't provide enough securitycrypto.generateKeyPair('rsa', {
modulusLength: 2048, // Compliant
publicKeyEncoding: { type: 'spki', format: 'pem' },
privateKeyEncoding: { type: 'pkcs8', format: 'pem' }
}, callback); // Compliant
crypto.generateKeyPair('ec', {
namedCurve: 'secp224k1',
publicKeyEncoding: { type: 'spki', format: 'pem' },
privateKeyEncoding: { type: 'pkcs8', format: 'pem' }
}, callback); // compliantExamples from the ESLint documentation.
sonarjs/no-weak-keys
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-weak-keys": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Non-existent operators '=+', '=-' and '=!' should not be used
Properties of variables with "null" or "undefined" values should not be accessed
Vue components should not use the deprecated "vue-class-component" or "vue-property-decorator" libraries
"<object>" tags should provide an alternative content