-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #467 from AikidoSec/fix-express
fix: Express handler wrapping
- Loading branch information
Showing
7 changed files
with
3,987 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const t = require("tap"); | ||
const { spawn } = require("child_process"); | ||
const { resolve } = require("path"); | ||
const timeout = require("../timeout"); | ||
|
||
const pathToApp = resolve(__dirname, "../../sample-apps/node-red"); | ||
|
||
t.test("it serves debug script", (t) => { | ||
const server = spawn(`node_modules/.bin/node-red`, { | ||
env: { | ||
...process.env, | ||
AIKIDO_DEBUG: "true", | ||
AIKIDO_BLOCK: "true", | ||
NODE_OPTIONS: "-r @aikidosec/firewall", | ||
}, | ||
cwd: pathToApp, | ||
}); | ||
|
||
server.on("close", () => { | ||
t.end(); | ||
}); | ||
|
||
server.on("error", (err) => { | ||
t.fail(err); | ||
}); | ||
|
||
let stdout = ""; | ||
server.stdout.on("data", (data) => { | ||
stdout += data.toString(); | ||
}); | ||
|
||
let stderr = ""; | ||
server.stderr.on("data", (data) => { | ||
stderr += data.toString(); | ||
}); | ||
|
||
// Wait for the server to start | ||
timeout(5000) | ||
.then(() => { | ||
return Promise.all([ | ||
fetch(`http://127.0.0.1:1880/debug/view/debug-utils.js`, { | ||
Check failure Code scanning / CodeQL Download of sensitive file through insecure connection High test Download Error loading related location Loading HTTP source Error loading related location Loading |
||
signal: AbortSignal.timeout(5000), | ||
}), | ||
]); | ||
}) | ||
.then(([script]) => { | ||
t.equal(script.status, 200); | ||
}) | ||
.catch((error) => { | ||
t.fail(error); | ||
}) | ||
.finally(() => { | ||
server.kill(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Testfile |
Oops, something went wrong.