Files
codeql/javascript/ql/test/experimental/Security/CWE-099/EnvValueAndKeyInjection/test.js
2026-07-05 17:41:04 +01:00

19 lines
475 B
JavaScript

const http = require('node:http');
http.createServer((req, res) => {
const { EnvValue, EnvKey } = req.body; // $ Source
process.env[EnvKey] = EnvValue; // $ Alert // NOT OK
process.env[EnvKey] = EnvValue; // $ Alert // NOT OK
res.end('env has been injected!');
});
http.createServer((req, res) => {
const { EnvValue, EnvKey } = req.body;
process.env[EnvKey] = "constant" // OK
process.env.constant = EnvValue // OK
res.end('env has been injected!');
});