mirror of
https://github.com/github/codeql.git
synced 2026-04-25 08:45:14 +02:00
Tests for InsecureHelmet
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
| InsecureHelmetBad.js:7:5:7:32 | content ... : false | Helmet route handler, called with $@ set to 'false' | InsecureHelmetBad.js:7:5:7:32 | content ... : false | contentSecurityPolicy |
|
||||
| InsecureHelmetBad.js:8:5:8:21 | frameguard: false | Helmet route handler, called with $@ set to 'false' | InsecureHelmetBad.js:8:5:8:21 | frameguard: false | frameguard |
|
||||
@@ -0,0 +1 @@
|
||||
Security/CWE-693/InsecureHelmet.ql
|
||||
@@ -0,0 +1,17 @@
|
||||
const express = require("express");
|
||||
const helmet = require("helmet");
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(helmet({
|
||||
contentSecurityPolicy: false, // BAD: switch off default CSP
|
||||
frameguard: false // BAD: switch off default frameguard
|
||||
}));
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.send("Hello, world!");
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log("App is listening on port 3000");
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
const express = require("express");
|
||||
const helmet = require("helmet");
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(helmet()); // GOOD: use the defaults
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.send("Hello, world!");
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log("App is listening on port 3000");
|
||||
});
|
||||
Reference in New Issue
Block a user