Insecure Authentication
Why is this important?
Authentication is one of the most fundamental security requirements. Any issues with authentication can allow attackers to bypass business logic and impersonate users, or even access all data from other users.
Check out this video for a high-level explanation:
Fixing Insecure Authentication
Option A: Avoid 'none' algorithm in JWT
The 'none' algorithm assumes the integrity of the token has already been verified. This would allow a malicious actor to forge a JWT token that will automatically be verified. Do not explicitly use the 'none' algorithm. Instead, use a secure alternative algorithm such as 'HS256'.
- Go through the issues that GuardRails identified in the PR.
- Identify the pattern that looks like this:
var jwt = require("jsonwebtoken");
jwt.verify(token, cert, {algorithms:['none']}, function (err, payload){
});
- Replace them with an algrithm other than none, for example
HS256
. - Make sure that the authentication works correctly.
- Test it
- Ship it 🚢 and relax 🌴