Skip to content

Commit 733074c

Browse files
committed
JS: Update alerts in HardcodedCredentials test
Note that file is inside a folder named __tests__. The same code is found in another file outside the test folder, where it is flagged.
1 parent ae7d50a commit 733074c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

javascript/ql/test/query-tests/Security/CWE-798/__tests__/HardcodedCredentialsDemo.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
const pg = require('pg');
33

44
const client = new pg.Client({
5-
user: 'dbuser',
5+
user: 'dbuser', // $ Alert
66
host: 'database.server.com',
77
database: 'mydb',
8-
password: 'hgfedcba',
8+
password: 'hgfedcba', // $ Alert
99
port: 3211,
1010
});
1111
client.connect();
@@ -15,17 +15,17 @@
1515
const JwtStrategy = require('passport-jwt').Strategy;
1616
const passport = require('passport')
1717

18-
var secretKey = "myHardCodedPrivateKey";
18+
var secretKey = "myHardCodedPrivateKey"; // OK - JWT keys in tests are not flagged
1919

2020
const opts = {}
21-
opts.secretOrKey = secretKey; // $ Alert
21+
opts.secretOrKey = secretKey;
2222
passport.use(new JwtStrategy(opts, function (jwt_payload, done) {
2323
return done(null, false);
2424
}));
2525

2626
passport.use(new JwtStrategy({
2727
secretOrKeyProvider: function (request, rawJwtToken, done) {
28-
return done(null, secretKey) // $ Alert
28+
return done(null, secretKey)
2929
}
3030
}, function (jwt_payload, done) {
3131
return done(null, false);

0 commit comments

Comments
 (0)