Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New multi-file app #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

New multi-file app #24

wants to merge 1 commit into from

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.

1 participant