mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
When determining the target of `msbuild` or `dotnet build`, first look for `.proj` files, then `.sln` files, and finally `.csproj`/`.vcxproj` files. In all three cases, choose the project/solution file closest to the root.
2.7 KiB
2.7 KiB
Improvements to C# analysis
General improvements
- Control flow graph improvements:
- The control flow graph construction now takes simple Boolean conditions on local scope variables into account. For example, in
if (b) x = 0; if (b) x = 1;, the control flow graph will reflect that taking thetrue(resp.false) branch in the first condition implies taking the same branch in the second condition. In effect, the first assignment toxwill now be identified as being dead. - Code that is only reachable from a constant failing assertion, such as
Debug.Assert(false), is considered to be unreachable.
- The control flow graph construction now takes simple Boolean conditions on local scope variables into account. For example, in
New queries
| Query | Tags | Purpose |
|---|---|---|
| Using a package with a known vulnerability (cs/use-of-vulnerable-package) | security, external/cwe/cwe-937 | Finds project build files that import packages with known vulnerabilities. This is included by default. |
Changes to existing queries
| Inconsistent lock sequence (cs/inconsistent-lock-sequence) | More results | This query now finds inconsistent lock sequences globally across calls. |
| Local scope variable shadows member (cs/local-shadows-member) | Fewer results | Results have been removed where a constructor parameter shadows a member, because the parameter is probably used to initialize the member. |
| Cross-site scripting (cs/web/xss) | More results | This query now finds cross-site scripting vulnerabilities in ASP.NET Core applications. |
| @name of query (Query ID)| Impact on results | How/why the query has changed |
Changes to code extraction
- Arguments passed using
inare now extracted. - Fix a bug where the
dynamictype name was not extracted correctly in certain circumstances.
Changes to QL libraries
getArgument()onAccessorCallhas been improved so it now takes tuple assignments into account. For example, the argument for the implicitvalueparameter in the setter of propertyPis0in(P, x) = (0, 1). Additionally, the argument for thevalueparameter in compound assignments is now only the expanded value, for example, inP += 7the argument isP + 7and not7.- The predicate
isInArgument()has been added to theAssignableAccessclass. This holds for expressions that are passed as arguments usingin.
Changes to the autobuilder
- When determining the target of
msbuildordotnet build, first look for.projfiles, then.slnfiles, and finally.csproj/.vcxprojfiles. In all three cases, choose the project/solution file closest to the root.