Payloads are converted into DOM nodes via appendChild, using innerHTML under the hood to keep the sink realistic.
NOTE: This is the case where we can expect 4 additional findings for DOM-based JavaScript Injection (taint flow).
It happens due to createContextualFragment and appendChild combination being modelled as 2 separate sinks in the SAST engine.
In a real-world scenario, these 2 calls always happen together, so the findings are effectively duplicates. We keep both findings here to demonstrate the issue.
The appendChildUtils.appendChildSink utility function used in these test cases is defined as follows:
function appendChildSink(payload, targetId) {
var target = ensureTarget(targetId);
const fragment = document.createRange().createContextualFragment(payload);
target.appendChild(fragment);
}