mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
18 lines
559 B
JavaScript
18 lines
559 B
JavaScript
// Regression fixture: an arrow function captures a tainted variable
|
|||
// from its enclosing scope and later sinks it via child_process.exec.
|
|||
//
|
|||
// The engine must follow the closure boundary — i.e. recognise that the
|
|||
// inner arrow references `tainted` from `makeHandler` — and surface a
|
|||
// taint-unsanitised-flow finding from env to exec.
|
|||
function makeHandler() {
|
|||
const tainted = process.env.USER_INPUT;
|
|||
return (req) => {
|
|||
require('child_process').exec(tainted);
|
|||
};
|
|||
}
|
|||
|
|||
const h = makeHandler();
|
|||
h({});
|
|||
|
|||
module.exports = { makeHandler };
|