Skip to content

Commit 3a4a57f

Browse files
committed
Merged test cases from CorsPermissiveConfig to CorsMisconfigurationForCredentials
1 parent 021aa13 commit 3a4a57f

File tree

4 files changed

+9
-45
lines changed

4 files changed

+9
-45
lines changed

javascript/ql/test/query-tests/Security/CWE-942/apollo-test.js renamed to javascript/ql/test/query-tests/Security/CWE-346/apollo-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ var https = require('https'),
55
var server = https.createServer(function () { });
66

77
server.on('request', function (req, res) {
8-
let user_origin = url.parse(req.url, true).query.origin; // $ Source
8+
let user_origin = url.parse(req.url, true).query.origin; // $ MISSING: Source
99
// BAD: CORS too permissive
1010
const server_1 = new ApolloServer({
11-
cors: { origin: true } // $ Alert
11+
cors: { origin: true } // $ MISSING: Alert
1212
});
1313

1414
// GOOD: restrictive CORS
@@ -18,11 +18,11 @@ server.on('request', function (req, res) {
1818

1919
// BAD: CORS too permissive
2020
const server_3 = new ApolloServer({
21-
cors: { origin: null } // $ Alert
21+
cors: { origin: null } // $ MISSING: Alert
2222
});
2323

2424
// BAD: CORS is controlled by user
2525
const server_4 = new ApolloServer({
26-
cors: { origin: user_origin } // $ Alert
26+
cors: { origin: user_origin } // $ MISSING: Alert
2727
});
28-
});
28+
});

javascript/ql/test/query-tests/Security/CWE-942/express-test.js renamed to javascript/ql/test/query-tests/Security/CWE-346/express-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var https = require('https'),
77
var server = https.createServer(function () { });
88

99
server.on('request', function (req, res) {
10-
let user_origin = url.parse(req.url, true).query.origin; // $ Source
10+
let user_origin = url.parse(req.url, true).query.origin; // $ MISSING: Source
1111

1212
// BAD: CORS too permissive, default value is *
1313
var app1 = express();
@@ -23,14 +23,14 @@ server.on('request', function (req, res) {
2323
// BAD: CORS too permissive
2424
var app3 = express();
2525
var corsOption3 = {
26-
origin: '*' // $ Alert
26+
origin: '*' // $ MISSING: Alert
2727
};
2828
app3.use(cors(corsOption3));
2929

3030
// BAD: CORS is controlled by user
3131
var app4 = express();
3232
var corsOption4 = {
33-
origin: user_origin // $ Alert
33+
origin: user_origin // $ MISSING: Alert
3434
};
3535
app4.use(cors(corsOption4));
36-
});
36+
});

javascript/ql/test/query-tests/Security/CWE-942/CorsPermissiveConfiguration.expected

Lines changed: 0 additions & 34 deletions
This file was deleted.

javascript/ql/test/query-tests/Security/CWE-942/CorsPermissiveConfiguration.qlref

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)