Skip to content

Conversation

@try-panwiac
Copy link
Owner

No description provided.

Copy link

@prisma-cloud-devsecops prisma-cloud-devsecops bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prisma Cloud has found errors in this PR ⬇️

Issuer: "server",
Subject: "Paz",
}
const token = jwt.sign(payload, SECRET, algo);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MEDIUM  Ensure Usage of JWT Algo
    Source File: UseEnsureJwtAlgo.js, Sink File: DefEnsureJwtAlgo.js | Checkov ID: CKV3_SAST_146

Data Flow

     UseEnsureJwtAlgo.js
     3 | let myInSecureAlgo = { algorithm: 'none' }
     UseEnsureJwtAlgo.js
     6 | GenerateJWT(myInSecureAlgo);
     DefEnsureJwtAlgo.js
    10 | const token = jwt.sign(payload, SECRET, algo);

Description

CWE: CWE-327: Use of a Broken or Risky Cryptographic Algorithm
OWASP: A02:2021 - Cryptographic Failures

This policy detects the usage of JWT (JSON Web Token) with a non-secure algorithm.

Vulnerable code example:

const jwt = require('jsonwebtoken');

const payload = {
  user: 'admin',
  role: 'admin'
};

const token = jwt.sign(payload, 'secret', { algorithm: 'none' });

console.log(token);

In the above code, the algorithm option for JWT signing is set to 'none'. This means that the JWT token is not encrypted and can be easily tampered with or read by unauthorized parties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants