Skip to content

Commit 16fb482

Browse files
authored
Merge branch 'main' into saritai/update-language-display-names
2 parents ee9873f + 3949914 commit 16fb482

File tree

565 files changed

+86449
-89648
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

565 files changed

+86449
-89648
lines changed

.github/workflows/csharp-qltest.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ jobs:
5353
slice: ["1/2", "2/2"]
5454
steps:
5555
- uses: actions/checkout@v4
56-
- uses: ./.github/actions/fetch-codeql
5756
- uses: ./csharp/actions/create-extractor-pack
5857
- name: Cache compilation cache
5958
id: query-cache
@@ -62,12 +61,7 @@ jobs:
6261
key: csharp-qltest-${{ matrix.slice }}
6362
- name: Run QL tests
6463
run: |
65-
CODEQL_PATH=$(gh codeql version --format=json | jq -r .unpackedLocation)
66-
# The legacy ASP extractor is not in this repo, so take the one from the nightly build
67-
mv "$CODEQL_PATH/csharp/tools/extractor-asp.jar" "${{ github.workspace }}/csharp/extractor-pack/tools"
68-
# Safe guard against using the bundled extractor
69-
rm -rf "$CODEQL_PATH/csharp"
70-
codeql test run --threads=0 --ram 50000 --slice ${{ matrix.slice }} --search-path "${{ github.workspace }}/csharp/extractor-pack" --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
64+
codeql test run --threads=0 --ram 50000 --slice ${{ matrix.slice }} --search-path extractor-pack --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
7165
env:
7266
GITHUB_TOKEN: ${{ github.token }}
7367
unit-tests:
@@ -80,7 +74,24 @@ jobs:
8074
dotnet-version: 7.0.102
8175
- name: Extractor unit tests
8276
run: |
83-
dotnet test -p:RuntimeFrameworkVersion=7.0.2 "${{ github.workspace }}/csharp/extractor/Semmle.Util.Tests"
84-
dotnet test -p:RuntimeFrameworkVersion=7.0.2 "${{ github.workspace }}/csharp/extractor/Semmle.Extraction.Tests"
85-
dotnet test -p:RuntimeFrameworkVersion=7.0.2 "${{ github.workspace }}/csharp/autobuilder/Semmle.Autobuild.CSharp.Tests"
77+
dotnet test -p:RuntimeFrameworkVersion=7.0.2 extractor/Semmle.Util.Tests
78+
dotnet test -p:RuntimeFrameworkVersion=7.0.2 extractor/Semmle.Extraction.Tests
79+
dotnet test -p:RuntimeFrameworkVersion=7.0.2 autobuilder/Semmle.Autobuild.CSharp.Tests
8680
dotnet test -p:RuntimeFrameworkVersion=7.0.2 "${{ github.workspace }}/cpp/autobuilder/Semmle.Autobuild.Cpp.Tests"
81+
stubgentest:
82+
runs-on: ubuntu-latest
83+
steps:
84+
- uses: actions/checkout@v4
85+
- uses: ./csharp/actions/create-extractor-pack
86+
- name: Run stub generator tests
87+
run: |
88+
# Generate (Asp)NetCore stubs
89+
STUBS_PATH=stubs_output
90+
python3 ql/src/Stubs/make_stubs_nuget.py webapp Swashbuckle.AspNetCore.Swagger latest "$STUBS_PATH"
91+
rm -rf ql/test/resources/stubs/_frameworks
92+
# Update existing stubs in the repo with the freshly generated ones
93+
mv "$STUBS_PATH/output/stubs/_frameworks" ql/test/resources/stubs/
94+
git status
95+
codeql test run --threads=0 --search-path extractor-pack --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries -- ql/test/library-tests/dataflow/flowsources/aspremote
96+
env:
97+
GITHUB_TOKEN: ${{ github.token }}

config/identical-files.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl4.qll",
2929
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl1.qll",
3030
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImpl2.qll",
31-
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForHttpClientLibraries.qll",
32-
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForPathname.qll",
3331
"swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImpl1.qll"
3432
],
3533
"TaintTracking Legacy Configuration Java/C++/C#/Go/Python/Ruby/Swift": [
@@ -552,4 +550,4 @@
552550
"python/ql/test/experimental/dataflow/model-summaries/InlineTaintTest.ext.yml",
553551
"python/ql/test/experimental/dataflow/model-summaries/NormalDataflowTest.ext.yml"
554552
]
555-
}
553+
}

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowDispatch.qll

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,3 @@ class ArgumentPosition extends int {
7979
/** Holds if arguments at position `apos` match parameters at position `ppos`. */
8080
pragma[inline]
8181
predicate parameterMatch(ParameterPosition ppos, ArgumentPosition apos) { ppos = apos }
82-
83-
/**
84-
* Holds if flow from `call`'s argument `arg` to parameter `p` is permissible.
85-
*
86-
* This is a temporary hook to support technical debt in the Go language; do not use.
87-
*/
88-
pragma[inline]
89-
predicate golangSpecificParamArgFilter(DataFlowCall call, ParameterNode p, ArgumentNode arg) {
90-
any()
91-
}

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowPrivate.qll

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ predicate expectsContent(Node n, ContentSet c) { none() }
208208

209209
predicate typeStrongerThan(DataFlowType t1, DataFlowType t2) { none() }
210210

211+
predicate localMustFlowStep(Node node1, Node node2) { none() }
212+
211213
/** Gets the type of `n` used for type pruning. */
212214
Type getNodeType(Node n) {
213215
suppressUnusedNode(n) and
@@ -295,12 +297,3 @@ class ContentApprox = Unit;
295297
/** Gets an approximated value for content `c`. */
296298
pragma[inline]
297299
ContentApprox getContentApprox(Content c) { any() }
298-
299-
/**
300-
* Gets an additional term that is added to the `join` and `branch` computations to reflect
301-
* an additional forward or backwards branching factor that is not taken into account
302-
* when calculating the (virtual) dispatch cost.
303-
*
304-
* Argument `arg` is part of a path from a source to a sink, and `p` is the target parameter.
305-
*/
306-
int getAdditionalFlowIntoCallNodeTerm(ArgumentNode arg, ParameterNode p) { none() }

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowDispatch.qll

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,3 @@ DataFlowCallable viableImplInCallContext(DataFlowCall call, DataFlowCall ctx) {
271271
/** Holds if arguments at position `apos` match parameters at position `ppos`. */
272272
pragma[inline]
273273
predicate parameterMatch(ParameterPosition ppos, ArgumentPosition apos) { ppos = apos }
274-
275-
/**
276-
* Holds if flow from `call`'s argument `arg` to parameter `p` is permissible.
277-
*
278-
* This is a temporary hook to support technical debt in the Go language; do not use.
279-
*/
280-
pragma[inline]
281-
predicate golangSpecificParamArgFilter(DataFlowCall call, ParameterNode p, ArgumentNode arg) {
282-
any()
283-
}

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplSpecific.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ module CppDataFlow implements InputSig {
1818
import Public
1919

2020
Node exprNode(DataFlowExpr e) { result = Public::exprNode(e) }
21+
22+
predicate getAdditionalFlowIntoCallNodeTerm = Private::getAdditionalFlowIntoCallNodeTerm/2;
2123
}

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,8 @@ predicate expectsContent(Node n, ContentSet c) { none() }
804804

805805
predicate typeStrongerThan(DataFlowType t1, DataFlowType t2) { none() }
806806

807+
predicate localMustFlowStep(Node node1, Node node2) { none() }
808+
807809
/** Gets the type of `n` used for type pruning. */
808810
DataFlowType getNodeType(Node n) {
809811
suppressUnusedNode(n) and

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,6 +1354,9 @@ class ParameterNode extends Node {
13541354
* pointer-indirection parameters are at further negative positions.
13551355
*/
13561356
predicate isParameterOf(Function f, ParameterPosition pos) { none() } // overridden by subclasses
1357+
1358+
/** Gets the `Parameter` associated with this node, if it exists. */
1359+
Parameter getParameter() { none() } // overridden by subclasses
13571360
}
13581361

13591362
/** An explicit positional parameter, including `this`, but not `...`. */
@@ -1376,10 +1379,9 @@ private class ExplicitParameterNode extends ParameterNode, DirectParameterNode {
13761379
f.getParameter(pos.(DirectPosition).getIndex()) = instr.getParameter()
13771380
}
13781381

1379-
/** Gets the `Parameter` associated with this node. */
1380-
Parameter getParameter() { result = instr.getParameter() }
1381-
13821382
override string toStringImpl() { result = instr.getParameter().toString() }
1383+
1384+
override Parameter getParameter() { result = instr.getParameter() }
13831385
}
13841386

13851387
/** An implicit `this` parameter. */

csharp/CSharp.sln

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
Microsoft Visual Studio Solution File, Format Version 12.00
1+
Microsoft Visual Studio Solution File, Format Version 12.00
32
# Visual Studio 15
43
VisualStudioVersion = 15.0.27130.2036
54
MinimumVisualStudioVersion = 10.0.40219.1
@@ -15,6 +14,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.CSharp.De
1514
EndProject
1615
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.CSharp.Standalone", "extractor\Semmle.Extraction.CSharp.Standalone\Semmle.Extraction.CSharp.Standalone.csproj", "{D00E7D25-0FA0-48EC-B048-CD60CE1B30D8}"
1716
EndProject
17+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.CSharp.StubGenerator", "extractor\Semmle.Extraction.CSharp.StubGenerator\Semmle.Extraction.CSharp.StubGenerator.csproj", "{B7C9FD47-A78C-4C20-AC29-B0AE638ADE9D}"
18+
EndProject
19+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.CSharp.Util", "extractor\Semmle.Extraction.CSharp.Util\Semmle.Extraction.CSharp.Util.csproj", "{998A0D4C-8BFC-4513-A28D-4816AFB89882}"
20+
EndProject
1821
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.CIL.Driver", "extractor\Semmle.Extraction.CIL.Driver\Semmle.Extraction.CIL.Driver.csproj", "{EFA400B3-C1CE-446F-A4E2-8B44E61EF47C}"
1922
EndProject
2023
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Semmle.Extraction.CSharp.Driver", "extractor\Semmle.Extraction.CSharp.Driver\Semmle.Extraction.CSharp.Driver.csproj", "{C36453BF-0C82-448A-B15D-26947503A2D3}"
@@ -29,6 +32,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Semmle.Autobuild.CSharp", "
2932
EndProject
3033
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Semmle.Autobuild.CSharp.Tests", "autobuilder\Semmle.Autobuild.CSharp.Tests\Semmle.Autobuild.CSharp.Tests.csproj", "{34256E8F-866A-46C1-800E-3DF69FD1DCB7}"
3134
EndProject
35+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Semmle.Extraction.CSharp.DependencyStubGenerator", "extractor\Semmle.Extraction.CSharp.DependencyStubGenerator\Semmle.Extraction.CSharp.DependencyStubGenerator.csproj", "{0EDA21A3-ADD8-4C10-B494-58B12B526B76}"
36+
EndProject
3237
Global
3338
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3439
Debug|Any CPU = Debug|Any CPU
@@ -85,6 +90,18 @@ Global
8590
{34256E8F-866A-46C1-800E-3DF69FD1DCB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
8691
{34256E8F-866A-46C1-800E-3DF69FD1DCB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
8792
{34256E8F-866A-46C1-800E-3DF69FD1DCB7}.Release|Any CPU.Build.0 = Release|Any CPU
93+
{B7C9FD47-A78C-4C20-AC29-B0AE638ADE9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
94+
{B7C9FD47-A78C-4C20-AC29-B0AE638ADE9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
95+
{B7C9FD47-A78C-4C20-AC29-B0AE638ADE9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
96+
{B7C9FD47-A78C-4C20-AC29-B0AE638ADE9D}.Release|Any CPU.Build.0 = Release|Any CPU
97+
{998A0D4C-8BFC-4513-A28D-4816AFB89882}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
98+
{998A0D4C-8BFC-4513-A28D-4816AFB89882}.Debug|Any CPU.Build.0 = Debug|Any CPU
99+
{998A0D4C-8BFC-4513-A28D-4816AFB89882}.Release|Any CPU.ActiveCfg = Release|Any CPU
100+
{998A0D4C-8BFC-4513-A28D-4816AFB89882}.Release|Any CPU.Build.0 = Release|Any CPU
101+
{0EDA21A3-ADD8-4C10-B494-58B12B526B76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
102+
{0EDA21A3-ADD8-4C10-B494-58B12B526B76}.Debug|Any CPU.Build.0 = Debug|Any CPU
103+
{0EDA21A3-ADD8-4C10-B494-58B12B526B76}.Release|Any CPU.ActiveCfg = Release|Any CPU
104+
{0EDA21A3-ADD8-4C10-B494-58B12B526B76}.Release|Any CPU.Build.0 = Release|Any CPU
88105
EndGlobalSection
89106
GlobalSection(SolutionProperties) = preSolution
90107
HideSolutionNode = FALSE

csharp/actions/create-extractor-pack/action.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ description: Builds the C# CodeQL pack
33
runs:
44
using: composite
55
steps:
6+
- uses: ./.github/actions/fetch-codeql
67
- name: Setup dotnet
78
uses: actions/setup-dotnet@v3
89
with:
@@ -11,3 +12,13 @@ runs:
1112
shell: bash
1213
run: scripts/create-extractor-pack.sh
1314
working-directory: csharp
15+
- name: Patch bundle to include ASP extractor
16+
shell: bash
17+
run: |
18+
CODEQL_PATH=$(gh codeql version --format=json | jq -r .unpackedLocation)
19+
# The legacy ASP extractor is not in this repo, so take the one from the nightly build
20+
mv "$CODEQL_PATH/csharp/tools/extractor-asp.jar" "${{ github.workspace }}/csharp/extractor-pack/tools"
21+
# Safe guard against using the bundled extractor
22+
rm -rf "$CODEQL_PATH/csharp"
23+
env:
24+
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)