Skip to content

CLI/Library Upgrade: 2.25.5#21928

Closed
dilanbhalla wants to merge 1532 commits into
github:mainfrom
microsoft:dilan/upgrade-2.25.5
Closed

CLI/Library Upgrade: 2.25.5#21928
dilanbhalla wants to merge 1532 commits into
github:mainfrom
microsoft:dilan/upgrade-2.25.5

Conversation

@dilanbhalla
Copy link
Copy Markdown
Contributor

No description provided.

MathiasVP and others added 30 commits December 16, 2025 15:08
* False positive fix regarding common type check idioms.

* Simplifying sizeof query output messages, and making both consistent with each other.
* adding bad wchar query

* Update BadWchar.ql

Fixing description

---------

Co-authored-by: elbiazo <elbiazo@icloud.com>
Co-authored-by: Ben Rodes <brodes@microsoft.com>
GOOD since it didnt normalize the path after the
concat. The logic added in 4dfa886
was flawed since `Path.Combine(x, y)` is not a normalized
path even when `x` is normalized (since `y` may contain
`..` segments).
…sly checking a type checker pattern and checking an operand is a DerivedType or a PointerType, but pointer derives from DerivedType, so the PointerType check is unnecessary.
…ion_in_sizeof_fix

Minor fix to the query that should not alter prior semantics. Previou…
…thQuery-2

C#: Fix an incorrect merge conflict resolution.
…to a more precise ignorable operation analysis. Ignorable operations that flow to a possible source also invalidate that source. Also added a root source finder to get the earliest source if many exist. Modified the leap year checker finder to use a new dataflow mechanic that flows from a YearFieldAccess.
MathiasVP and others added 12 commits May 5, 2026 16:48
…se-direction

PS: Optimize `ChildMapping` using forward+reverse pruning
…with ConditionKind definition which was added in upstream base QL.
Rename ConditionKind to BinaryConditionKind to resolve name conflict with ConditionKind definition which was added in upstream base QL.
Explicitly add iac to workspace
* Add parameter type signatures for IL methods/calls

Extract and propagate parenthesized parameter type signatures to enable overload-precise identification and matching of methods and unresolved call targets.

- Extractor: ILExtractor now emits il_method_param_signature and il_call_target_param_signature tuples.
- DB schema: Added il_method_param_signature and il_call_target_param_signature to semmlecode.binary.dbscheme.
- QL API/AST: Exposed/getters for param signatures across CilInstructions, IR, InstructionSig, TranslatedElement/Function/Instruction and transform layers so signatures flow through translation.
- Translated implementations: TranslatedCilMethod and relevant translated call/new-object logic return the extracted signatures; non-CIL backends return wildcards where appropriate.
- VulnerableCalls: Expanded the vulnerableCallModel and related predicates to include paramSignature and updated matching logic to accept exact signatures or wildcard '*'.
- Models: Updated example YAML models to include a '*' paramSignature for existing entries.

This change improves precision when matching overloaded methods for analyses such as vulnerable-call detection.

* Add method param signatures and JVM stack metadata

Expose a getParamSignature API on InstructionSig (and the TransformInstruction implementation) to return parenthesized parameter-type signatures (e.g. "(System.String,System.Int32)"). Extend the extraction DB schema with il_method_param_signature and il_call_target_param_signature to enable overload-precise method identification, and add jvm_stack_height and jvm_stack_slot tables to record JVM stack heights and map stack slots to producer instructions to simplify stack-based dataflow analysis.

* Include same-assembly method definitions in vulnerable method closure

For root cause mode analysis, where the vulnerable methods being traced are
defined in the same binary being analyzed (not referenced cross-assembly),
getAVulnerableMethod needs a base case that matches method definitions by
their fully-qualified name and parameter signature.

Previously, only cross-assembly calls via ExternalRefInstruction were matched
as the base case. Intra-assembly calls are handled by the existing transitive
getStaticTarget() clause, but the closure never started because the base case
only found external ref call sites.

The new clause matches methods defined in the current binary against the model,
respecting the paramSignature field (including wildcard '*'). For standard
cross-assembly analysis this is a no-op since the model methods won't be
defined in the binary being analyzed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Sync JVM extractor dbscheme with ql lib

The ql lib dbscheme was updated with il_method_param_signature,
il_call_target_param_signature, jvm_stack_height, and jvm_stack_slot tables
but the JVM extractor's copy was not updated. This causes a schema mismatch
when building a JVM database and then running the binary-ql queries against it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add parameter type signature extraction for JVM bytecode

The CIL extractor already emits il_method_param_signature and
il_call_target_param_signature for overload-precise method matching.
This commit adds the same capability to the JVM bytecode extractor.

JVM extractor changes:
- ParseParamSignature: converts JVM descriptors (e.g. '(Ljava/lang/Object;JJ)V')
  to human-readable signatures (e.g. '(Object,long,long)')
- ExtractMethod: emits il_method_param_signature for method definitions
- ExtractMethodRef: emits il_call_target_param_signature for call sites

QL library changes:
- JvmMethod: add getParamSignature() backed by il_method_param_signature
- JvmInvoke: add getParamSignature() backed by il_call_target_param_signature
- TranslatedJvmInvoke: wire getExternalParamSignature to instr.getParamSignature()
- TranslatedJvmFunction: use method.getParamSignature() instead of wildcard '*'

VulnerableCalls.qll:
- VulnerableMethodCall: handle case where extRef lacks param signature
  (backwards compat for databases built before this change)
- Root cause base case: handle functions with wildcard param signature

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix JVM param signature to use JVM-specific dbscheme table

il_call_target_param_signature references @il_instruction which is incompatible
with JVM's @jvm_instruction type. Add jvm_call_target_param_signature table for
JVM call target signatures and update the extractor and QL to use it.

Also sync all extractor dbschemes (JVM and CIL) with the canonical ql/lib copy.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update ApprovedCipherMode query and tests
Copilot AI review requested due to automatic review settings June 1, 2026 22:02
@dilanbhalla dilanbhalla requested review from a team as code owners June 1, 2026 22:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@dilanbhalla
Copy link
Copy Markdown
Contributor Author

Accidental PR, apologies. Closing now.

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.

9 participants