mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-24 20:28:06 +02:00
23 lines
824 B
JavaScript
23 lines
824 B
JavaScript
|
|
// Branched helper with two return paths.
|
||
|
|
//
|
||
|
|
// Both paths return the input (neither strips taint — the toUpperCase
|
||
|
|
// call on one branch is a no-op for XSS). With per-return-path
|
||
|
|
// decomposition the SSA summary records two distinct
|
||
|
|
// [`ReturnPathTransform`] entries in `param_return_paths` when
|
||
|
|
// extraction succeeds, or falls back to the aggregate
|
||
|
|
// `param_to_return` entry. Either way, taint must propagate through
|
||
|
|
// this helper so downstream sinks fire.
|
||
|
|
//
|
||
|
|
// This fixture is a *regression guard*: the per-path decomposition must
|
||
|
|
// not over-attribute sanitation to a branch that does not sanitise,
|
||
|
|
// which would drop the XSS finding on the caller side.
|
||
|
|
|
||
|
|
function maybeSanitise(input, upper) {
|
||
|
|
if (upper) {
|
||
|
|
return input.toUpperCase();
|
||
|
|
}
|
||
|
|
return input;
|
||
|
|
}
|
||
|
|
|
||
|
|
module.exports = { maybeSanitise };
|