Skip to content

JS: Handle barrier guards on phi inputs - #22873

Draft
owen-mc wants to merge 2 commits into
github:mainfrom
owen-mc:fix/js-barrier-guard-phi-inputs
Draft

owen-mc wants to merge 2 commits into
github:mainfrom
owen-mc:fix/js-barrier-guard-phi-inputs

Conversation

@owen-mc

@owen-mc owen-mc commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Barrier guards now block individual inputs to SSA phi nodes. This prevents false positives for patterns where an unsafe value is replaced with a safe default on the guard’s failing branch.

The shared SSA library represents phi inputs as synthetic data-flow nodes, allowing a guard to block one input without blocking the entire phi node. Languages that use shared SSA for ordinary SSA flow benefit from this directly.

JavaScript currently uses shared SSA only for use-use flow, while its legacy SSA implementation remains responsible for ordinary definition-to-use flow. That legacy graph had a direct definition -> phi edge which bypassed the guarded synthetic node in the shared graph.

This change adds equivalent phi-input nodes to the legacy JavaScript graph and routes flow as:

definition -> phi input -> phi

Barrier guards can then block the relevant input while preserving flow from other inputs.

This also fixes an existing false positive in a test for js/command-line-injection.

owen-mc and others added 2 commits October 22, 2026 14:52
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant