Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eed6f57

Browse filesBrowse files
committed
Merge branch 'main' into language-specific-field-flow-branch-limit-term
2 parents c575155 + fed504c commit eed6f57
Copy full SHA for eed6f57

File tree

907 files changed

+38993
-5248
lines changed
Filter options

Some content is hidden

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

907 files changed

+38993
-5248
lines changed

‎.github/actions/cache-query-compilation/action.yml

Copy file name to clipboardExpand all lines: .github/actions/cache-query-compilation/action.yml
+27-3Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ inputs:
99
outputs:
1010
cache-dir:
1111
description: "The directory where the cache was stored"
12-
value: ${{ steps.fill-compilation-dir.outputs.compdir }}
12+
value: ${{ steps.output-compilation-dir.outputs.compdir }}
1313

1414
runs:
1515
using: composite
@@ -27,7 +27,9 @@ runs:
2727
if: ${{ github.event_name == 'pull_request' }}
2828
uses: actions/cache/restore@v3
2929
with:
30-
path: '**/.cache'
30+
path: |
31+
**/.cache
32+
~/.codeql/compile-cache
3133
key: codeql-compile-${{ inputs.key }}-pr-${{ github.sha }}
3234
restore-keys: |
3335
codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-${{ env.merge_base }}
@@ -37,12 +39,22 @@ runs:
3739
if: ${{ github.event_name != 'pull_request' }}
3840
uses: actions/cache@v3
3941
with:
40-
path: '**/.cache'
42+
path: |
43+
**/.cache
44+
~/.codeql/compile-cache
4145
key: codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-${{ github.sha }} # just fill on main
4246
restore-keys: | # restore the latest cache if the exact cache is unavailable, to speed up compilation.
4347
codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-
4448
codeql-compile-${{ inputs.key }}-main-
49+
- name: Output-compilationdir
50+
id: output-compilation-dir
51+
shell: bash
52+
run: |
53+
echo "compdir=${COMBINED_CACHE_DIR}" >> $GITHUB_OUTPUT
54+
env:
55+
COMBINED_CACHE_DIR: ${{ runner.temp }}/compilation-dir
4556
- name: Fill compilation cache directory
57+
id: fill-compilation-dir
4658
uses: actions/github-script@v6
4759
env:
4860
COMBINED_CACHE_DIR: ${{ runner.temp }}/compilation-dir
@@ -58,6 +70,7 @@ runs:
5870
5971
const fs = require("fs");
6072
const path = require("path");
73+
const os = require("os");
6174
6275
// the first argv is the cache folder to create.
6376
const COMBINED_CACHE_DIR = process.env.COMBINED_CACHE_DIR;
@@ -97,6 +110,17 @@ runs:
97110
console.log(`Found .cache dir at ${dir}`);
98111
}
99112
113+
const globalCacheDir = path.join(os.homedir(), ".codeql", "compile-cache");
114+
if (fs.existsSync(globalCacheDir)) {
115+
console.log("Found global home dir: " + globalCacheDir);
116+
cacheDirs.push(globalCacheDir);
117+
}
118+
119+
if (cacheDirs.length === 0) {
120+
console.log("No cache dirs found");
121+
return;
122+
}
123+
100124
// mkdir -p ${COMBINED_CACHE_DIR}
101125
fs.mkdirSync(COMBINED_CACHE_DIR, { recursive: true });
102126

‎.github/workflows/compile-queries.yml

Copy file name to clipboardExpand all lines: .github/workflows/compile-queries.yml
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ jobs:
2424
with:
2525
key: all-queries
2626
- name: check formatting
27-
run: find */ql -type f \( -name "*.qll" -o -name "*.ql" \) -print0 | xargs -0 codeql query format --check-only
27+
run: find */ql -type f \( -name "*.qll" -o -name "*.ql" \) -print0 | xargs -0 -n 3000 -P 10 codeql query format -q --check-only
2828
- name: compile queries - check-only
2929
# run with --check-only if running in a PR (github.sha != main)
3030
if : ${{ github.event_name == 'pull_request' }}
3131
shell: bash
32-
run: codeql query compile -j0 */ql/{src,examples} --keep-going --warnings=error --check-only --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
32+
run: codeql query compile -q -j0 */ql/{src,examples} --keep-going --warnings=error --check-only --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
3333
- name: compile queries - full
3434
# do full compile if running on main - this populates the cache
3535
if : ${{ github.event_name != 'pull_request' }}
3636
shell: bash
37-
run: codeql query compile -j0 */ql/{src,examples} --keep-going --warnings=error --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
37+
run: codeql query compile -q -j0 */ql/{src,examples} --keep-going --warnings=error --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"

‎.github/workflows/ql-for-ql-build.yml

Copy file name to clipboardExpand all lines: .github/workflows/ql-for-ql-build.yml
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
steps:
1616
### Build the queries ###
1717
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
1820
- name: Find codeql
1921
id: find-codeql
2022
uses: github/codeql-action/init@v2
@@ -27,7 +29,9 @@ jobs:
2729
id: cache-extractor
2830
uses: actions/cache@v3
2931
with:
30-
path: ql/extractor-pack/
32+
path: |
33+
ql/extractor-pack/
34+
ql/target/release/buramu
3135
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-extractor-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}
3236
- name: Cache cargo
3337
if: steps.cache-extractor.outputs.cache-hit != 'true'
@@ -50,6 +54,7 @@ jobs:
5054
key: run-ql-for-ql
5155
- name: Make database and analyze
5256
run: |
57+
./ql/target/release/buramu | tee deprecated.blame # Add a blame file for the extractor to parse.
5358
${CODEQL} database create -l=ql --search-path ql/extractor-pack ${DB}
5459
${CODEQL} database analyze -j0 --format=sarif-latest --output=ql-for-ql.sarif ${DB} ql/ql/src/codeql-suites/ql-code-scanning.qls --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
5560
env:
@@ -58,6 +63,7 @@ jobs:
5863
LGTM_INDEX_FILTERS: |
5964
exclude:ql/ql/test
6065
exclude:*/ql/lib/upgrades/
66+
exclude:java/ql/integration-tests
6167
- name: Upload sarif to code-scanning
6268
uses: github/codeql-action/upload-sarif@v2
6369
with:

‎.github/workflows/swift.yml

Copy file name to clipboardExpand all lines: .github/workflows/swift.yml
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
paths:
66
- "swift/**"
77
- "misc/bazel/**"
8+
- "misc/codegen/**"
89
- "*.bazel*"
910
- .github/workflows/swift.yml
1011
- .github/actions/**
@@ -19,6 +20,7 @@ on:
1920
paths:
2021
- "swift/**"
2122
- "misc/bazel/**"
23+
- "misc/codegen/**"
2224
- "*.bazel*"
2325
- .github/workflows/swift.yml
2426
- .github/actions/**

‎.pre-commit-config.yaml

Copy file name to clipboardExpand all lines: .pre-commit-config.yaml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ repos:
5353
name: Run Swift code generation unit tests
5454
files: ^swift/codegen/.*\.py$
5555
language: system
56-
entry: bazel test //swift/codegen/test
56+
entry: bazel test //misc/codegen/test
5757
pass_filenames: false

‎CODEOWNERS

Copy file name to clipboardExpand all lines: CODEOWNERS
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
/csharp/ @github/codeql-csharp
33
/go/ @github/codeql-go
44
/java/ @github/codeql-java
5-
/javascript/ @github/codeql-javascript
6-
/python/ @github/codeql-python
7-
/ruby/ @github/codeql-ruby
5+
/javascript/ @github/codeql-dynamic
6+
/python/ @github/codeql-dynamic
7+
/ruby/ @github/codeql-dynamic
88
/swift/ @github/codeql-swift
9+
/misc/codegen/ @github/codeql-swift
910
/java/kotlin-extractor/ @github/codeql-kotlin
1011
/java/kotlin-explorer/ @github/codeql-kotlin
1112

‎cpp/ql/lib/CHANGELOG.md

Copy file name to clipboardExpand all lines: cpp/ql/lib/CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.3
2+
3+
No user-facing changes.
4+
15
## 0.5.2
26

37
No user-facing changes.
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.5.3
2+
3+
No user-facing changes.

‎cpp/ql/lib/codeql-pack.release.yml

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
lastReleaseVersion: 0.5.2
2+
lastReleaseVersion: 0.5.3

‎cpp/ql/lib/qlpack.yml

Copy file name to clipboardExpand all lines: cpp/ql/lib/qlpack.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cpp-all
2-
version: 0.5.3-dev
2+
version: 0.5.4-dev
33
groups: cpp
44
dbscheme: semmlecode.cpp.dbscheme
55
extractor: cpp

‎cpp/ql/src/CHANGELOG.md

Copy file name to clipboardExpand all lines: cpp/ql/src/CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.3
2+
3+
No user-facing changes.
4+
15
## 0.5.2
26

37
No user-facing changes.
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.5.3
2+
3+
No user-facing changes.

‎cpp/ql/src/codeql-pack.release.yml

Copy file name to clipboard
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
lastReleaseVersion: 0.5.2
2+
lastReleaseVersion: 0.5.3

‎cpp/ql/src/qlpack.yml

Copy file name to clipboardExpand all lines: cpp/ql/src/qlpack.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cpp-queries
2-
version: 0.5.3-dev
2+
version: 0.5.4-dev
33
groups:
44
- cpp
55
- queries

‎csharp/extractor/Semmle.Extraction.CSharp/Entities/Conversion.cs

Copy file name to clipboardExpand all lines: csharp/extractor/Semmle.Extraction.CSharp/Entities/Conversion.cs
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ internal class Conversion : UserOperator
1010
private Conversion(Context cx, IMethodSymbol init)
1111
: base(cx, init) { }
1212

13+
protected override MethodKind ExplicitlyImplementsKind => MethodKind.Conversion;
14+
1315
public static new Conversion Create(Context cx, IMethodSymbol symbol) =>
1416
ConversionFactory.Instance.CreateEntityFromSymbol(cx, symbol);
1517

‎csharp/extractor/Semmle.Extraction.CSharp/Entities/Method.cs

Copy file name to clipboardExpand all lines: csharp/extractor/Semmle.Extraction.CSharp/Entities/Method.cs
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@ public static void NumberOfLines(TextWriter trapFile, ISymbol symbol, IEntity ca
8383
}
8484
}
8585

86+
protected virtual MethodKind ExplicitlyImplementsKind => MethodKind.Ordinary;
87+
8688
public void Overrides(TextWriter trapFile)
8789
{
8890
foreach (var explicitInterface in Symbol.ExplicitInterfaceImplementations
89-
.Where(sym => sym.MethodKind == MethodKind.Ordinary)
91+
.Where(sym => sym.MethodKind == ExplicitlyImplementsKind)
9092
.Select(impl => Type.Create(Context, impl.ContainingType)))
9193
{
9294
trapFile.explicitly_implements(this, explicitInterface.TypeRef);

‎csharp/extractor/Semmle.Extraction.CSharp/Entities/Modifier.cs

Copy file name to clipboardExpand all lines: csharp/extractor/Semmle.Extraction.CSharp/Entities/Modifier.cs
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ private static void ExtractNamedTypeModifiers(Context cx, TextWriter trapFile, I
8585
if (nt.IsRecord)
8686
HasModifier(cx, trapFile, key, Modifiers.Record);
8787

88+
if (nt.IsFileLocal)
89+
HasModifier(cx, trapFile, key, Modifiers.File);
90+
8891
if (nt.TypeKind == TypeKind.Struct)
8992
{
9093
if (nt.IsReadOnly)
@@ -97,7 +100,11 @@ private static void ExtractNamedTypeModifiers(Context cx, TextWriter trapFile, I
97100

98101
public static void ExtractModifiers(Context cx, TextWriter trapFile, IEntity key, ISymbol symbol)
99102
{
100-
HasAccessibility(cx, trapFile, key, symbol.DeclaredAccessibility);
103+
// A file scoped type has declared accessibility `internal` which we shouldn't extract.
104+
// The file modifier is extracted as a source level modifier.
105+
if (symbol.Kind != SymbolKind.NamedType || !((INamedTypeSymbol)symbol).IsFileLocal)
106+
HasAccessibility(cx, trapFile, key, symbol.DeclaredAccessibility);
107+
101108
if (symbol.Kind == SymbolKind.ErrorType)
102109
trapFile.has_modifiers(key, Modifier.Create(cx, Accessibility.Public));
103110

‎csharp/extractor/Semmle.Extraction.CSharp/Entities/Modifiers.cs

Copy file name to clipboardExpand all lines: csharp/extractor/Semmle.Extraction.CSharp/Entities/Modifiers.cs
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ internal static class Modifiers
44
public const string Async = "async";
55
public const string Const = "const";
66
public const string Extern = "extern";
7+
public const string File = "file";
78
public const string Internal = "internal";
89
public const string New = "new";
910
public const string Override = "override";

‎csharp/extractor/Semmle.Extraction.CSharp/Entities/UserOperator.cs

Copy file name to clipboardExpand all lines: csharp/extractor/Semmle.Extraction.CSharp/Entities/UserOperator.cs
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ internal class UserOperator : Method
1111
protected UserOperator(Context cx, IMethodSymbol init)
1212
: base(cx, init) { }
1313

14+
protected override MethodKind ExplicitlyImplementsKind => MethodKind.UserDefinedOperator;
15+
1416
public override void Populate(TextWriter trapFile)
1517
{
1618
PopulateMethod(trapFile);
@@ -37,6 +39,7 @@ public override void Populate(TextWriter trapFile)
3739
}
3840

3941
ContainingType.PopulateGenerics();
42+
Overrides(trapFile);
4043
}
4144

4245
public override bool NeedsPopulation => Context.Defines(Symbol) || IsImplicitOperator(out _);

‎csharp/extractor/Semmle.Extraction.CSharp/SymbolExtensions.cs

Copy file name to clipboardExpand all lines: csharp/extractor/Semmle.Extraction.CSharp/SymbolExtensions.cs
+43-41Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,8 @@ private static IEnumerable<SyntaxToken> GetModifiers<T>(this ISymbol symbol, Fun
7777
/// <summary>
7878
/// Gets the source-level modifiers belonging to this symbol, if any.
7979
/// </summary>
80-
public static IEnumerable<string> GetSourceLevelModifiers(this ISymbol symbol)
81-
{
82-
var methodModifiers = symbol.GetModifiers<Microsoft.CodeAnalysis.CSharp.Syntax.BaseMethodDeclarationSyntax>(md => md.Modifiers);
83-
var typeModifiers = symbol.GetModifiers<Microsoft.CodeAnalysis.CSharp.Syntax.TypeDeclarationSyntax>(cd => cd.Modifiers);
84-
return methodModifiers.Concat(typeModifiers).Select(m => m.Text);
85-
}
80+
public static IEnumerable<string> GetSourceLevelModifiers(this ISymbol symbol) =>
81+
symbol.GetModifiers<Microsoft.CodeAnalysis.CSharp.Syntax.MemberDeclarationSyntax>(md => md.Modifiers).Select(m => m.Text);
8682

8783
/// <summary>
8884
/// Holds if the ID generated for `dependant` will contain a reference to
@@ -286,54 +282,60 @@ private static void BuildFunctionPointerTypeId(this IFunctionPointerTypeSymbol f
286282
public static IEnumerable<IFieldSymbol?> GetTupleElementsMaybeNull(this INamedTypeSymbol type) =>
287283
type.TupleElements;
288284

289-
private static void BuildNamedTypeId(this INamedTypeSymbol named, Context cx, EscapingTextWriter trapFile, ISymbol symbolBeingDefined, bool constructUnderlyingTupleType)
285+
private static void BuildQualifierAndName(INamedTypeSymbol named, Context cx, EscapingTextWriter trapFile, ISymbol symbolBeingDefined)
290286
{
291-
if (!constructUnderlyingTupleType && named.IsTupleType)
287+
if (named.ContainingType is not null)
292288
{
293-
trapFile.Write('(');
294-
trapFile.BuildList(",", named.GetTupleElementsMaybeNull(),
295-
(i, f) =>
296-
{
297-
if (f is null)
298-
{
299-
trapFile.Write($"null({i})");
300-
}
301-
else
302-
{
303-
trapFile.Write((f.CorrespondingTupleField ?? f).Name);
304-
trapFile.Write(":");
305-
f.Type.BuildOrWriteId(cx, trapFile, symbolBeingDefined, constructUnderlyingTupleType: false);
306-
}
307-
}
308-
);
309-
trapFile.Write(")");
310-
return;
289+
named.ContainingType.BuildOrWriteId(cx, trapFile, symbolBeingDefined, constructUnderlyingTupleType: false);
290+
trapFile.Write('.');
311291
}
312-
313-
void AddContaining()
292+
else if (named.ContainingNamespace is not null)
314293
{
315-
if (named.ContainingType is not null)
316-
{
317-
named.ContainingType.BuildOrWriteId(cx, trapFile, symbolBeingDefined, constructUnderlyingTupleType: false);
318-
trapFile.Write('.');
319-
}
320-
else if (named.ContainingNamespace is not null)
294+
if (cx.ShouldAddAssemblyTrapPrefix && named.ContainingAssembly is not null)
295+
BuildAssembly(named.ContainingAssembly, trapFile);
296+
named.ContainingNamespace.BuildNamespace(cx, trapFile);
297+
}
298+
299+
var name = named.IsFileLocal ? named.MetadataName : named.Name;
300+
trapFile.Write(name);
301+
}
302+
303+
private static void BuildTupleId(INamedTypeSymbol named, Context cx, EscapingTextWriter trapFile, ISymbol symbolBeingDefined)
304+
{
305+
trapFile.Write('(');
306+
trapFile.BuildList(",", named.GetTupleElementsMaybeNull(),
307+
(i, f) =>
321308
{
322-
if (cx.ShouldAddAssemblyTrapPrefix && named.ContainingAssembly is not null)
323-
BuildAssembly(named.ContainingAssembly, trapFile);
324-
named.ContainingNamespace.BuildNamespace(cx, trapFile);
309+
if (f is null)
310+
{
311+
trapFile.Write($"null({i})");
312+
}
313+
else
314+
{
315+
trapFile.Write((f.CorrespondingTupleField ?? f).Name);
316+
trapFile.Write(":");
317+
f.Type.BuildOrWriteId(cx, trapFile, symbolBeingDefined, constructUnderlyingTupleType: false);
318+
}
325319
}
320+
);
321+
trapFile.Write(")");
322+
}
323+
324+
private static void BuildNamedTypeId(this INamedTypeSymbol named, Context cx, EscapingTextWriter trapFile, ISymbol symbolBeingDefined, bool constructUnderlyingTupleType)
325+
{
326+
if (!constructUnderlyingTupleType && named.IsTupleType)
327+
{
328+
BuildTupleId(named, cx, trapFile, symbolBeingDefined);
329+
return;
326330
}
327331

328332
if (named.TypeParameters.IsEmpty)
329333
{
330-
AddContaining();
331-
trapFile.Write(named.Name);
334+
BuildQualifierAndName(named, cx, trapFile, symbolBeingDefined);
332335
}
333336
else if (named.IsReallyUnbound())
334337
{
335-
AddContaining();
336-
trapFile.Write(named.Name);
338+
BuildQualifierAndName(named, cx, trapFile, symbolBeingDefined);
337339
trapFile.Write("`");
338340
trapFile.Write(named.TypeParameters.Length);
339341
}

‎csharp/ql/campaigns/Solorigate/lib/CHANGELOG.md

Copy file name to clipboardExpand all lines: csharp/ql/campaigns/Solorigate/lib/CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.4.3
2+
3+
No user-facing changes.
4+
15
## 1.4.2
26

37
No user-facing changes.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.