Skip to content

Unified: Model parameter/argument positions in data flow similar to type inference - #23180

Draft
hvitved wants to merge 1 commit into
github:mainfrom
hvitved:unified/param-arg-pos
Draft

hvitved wants to merge 1 commit into
github:mainfrom
hvitved:unified/param-arg-pos

Conversation

@hvitved

@hvitved hvitved commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

@hvitved hvitved changed the title Unified: Model parameter/argument positions in data flow similar to t… Unified: Model parameter/argument positions in data flow similar to type inference Nov 20, 2026
@hvitved
hvitved requested a max review from Copilot November 20, 2026 11:01
Comment on lines +38 to +44
/**
* Holds if this represents a parameter from source code at postion `pos` and
* with external name `name` and rank `rnk`.
*
* `name` is `""` when there is no external name, and `rnk` is the rank of the
* parameter among parameters with the same external name.
*/

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Argument-position matching can bind inputs to the wrong parameters and lose security-relevant data flow, while unchanged UnsafeJsEval expectations will cause a consistency-test failure.

6 open issues
What changed in this PR

Aligns unified CodeQL data-flow parameter and argument positions with type inference, distinguishing source parameters from summary positions and ranking repeated external names.

Changes:

  • Introduces separate parameter and argument representations with explicit matching rules.
  • Uses position helpers when constructing data-flow nodes.
  • Removes obsolete overlapping-parameter expectations from the type-inference consistency test.
File Description
unified/​ql/​test/​library-tests/​type-inference/​CONSISTENCY/​DataFlowConsistency.expected Removes obsolete overlapping-parameter diagnostics.
unified/​ql/​lib/​codeql/​unified/​internal/​dataflow/​ParameterPositions.qll Defines source, summary, and argument positions and their matching rules.
unified/​ql/​lib/​codeql/​unified/​internal/​dataflow/​DataFlowInstantiation.qll Connects parameter and argument nodes to the new position helpers.

Review effort: Max

or
name = any(Argument arg).getName()
}
TSourceParameter(int pos, string name, int rnk) { parameterPos(_, _, pos, name, rnk) } or
or
ppos.isCallee() and apos.isCallee()
or
ppos = TSourceParameter(apos.asPositional(), _, _)
private newtype TArgumentPosition =
TReceiverArgument() or
TCalleeArgument() or
TPositionalArgument(int pos) { positionalArgument(_, _, pos) } or
or
ppos.isCallee() and apos.isCallee()
or
ppos = TSourceParameter(apos.asPositional(), _, _)
or
ppos = TSourceParameter(apos.asPositional(), _, _)
or
ppos = TSummaryPositionalParameter(apos.asPositional())
or
ppos = TSummaryPositionalParameter(apos.asPositional())
or
exists(int rnk | ppos = TSourceParameter(_, apos.asNamed(rnk), rnk))

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants