Skip to content

Commit 6bc12e8

Browse files
committed
Merge branch 'main' into formatTaint
2 parents 33cca29 + 45320d9 commit 6bc12e8

File tree

985 files changed

+17659
-4418
lines changed

Some content is hidden

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

985 files changed

+17659
-4418
lines changed

.github/labeler.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,11 @@ documentation:
4343
"QL-for-QL":
4444
- ql/**/*
4545
- .github/workflows/ql-for-ql*
46+
47+
# Since these are all shared files that need to be synced, just pick _one_ copy of each.
48+
"DataFlow Library":
49+
- "java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl.qll"
50+
- "java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll"
51+
- "java/ql/lib/semmle/code/java/dataflow/internal/tainttracking1/TaintTrackingImpl.qll"
52+
- "java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll"
53+
- "java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll"
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: ATM Check Queries Run
2+
3+
env:
4+
DB_PATH: test_db
5+
ATM_MODEL_PACK: javascript/ql/experimental/adaptivethreatmodeling/src
6+
QUERY_SUITE: codeql-suites/javascript-atm-code-scanning.qls
7+
8+
on:
9+
pull_request:
10+
paths:
11+
- ".github/workflows/atm-check-queries-run.yml"
12+
- "javascript/ql/experimental/adaptivethreatmodeling/**"
13+
workflow_dispatch:
14+
15+
jobs:
16+
run-atm-queries:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- name: Install CodeQL CLI
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
run: |
26+
gh extensions install github/gh-codeql
27+
gh codeql download
28+
29+
- name: Install ATM model pack
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
set -exu
34+
35+
# Install ATM model pack
36+
gh codeql pack install ${ATM_MODEL_PACK}
37+
38+
# Retrieve model checksum
39+
model_checksum=$(gh codeql resolve extensions ${ATM_MODEL_PACK}/${QUERY_SUITE} | jq -r '.models[0].checksum')
40+
41+
# Trust the model so that we can use it in the ATM boosted queries
42+
mkdir -p "$HOME/.config/codeql"
43+
echo "--insecurely-execute-ml-model-checksums ${model_checksum}" >> "$HOME/.config/codeql/config"
44+
45+
- name: Create test DB
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
run: |
49+
gh codeql database create ${RUNNER_TEMP}/${DB_PATH} --source-root config/atm/ --language javascript
50+
51+
- name: Run ATM query suite
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
run: |
55+
gh codeql database run-queries -vv -- ${RUNNER_TEMP}/${DB_PATH} ${ATM_MODEL_PACK}/${QUERY_SUITE}
56+

.github/workflows/ruby-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ jobs:
9696
- name: Build Query Pack
9797
run: |
9898
codeql pack create ../shared/ssa --output target/packs
99+
codeql pack create ../misc/suite-helpers --output target/packs
99100
codeql pack create ql/lib --output target/packs
100-
codeql pack install ql/src
101101
codeql pack create ql/src --output target/packs
102102
PACK_FOLDER=$(readlink -f target/packs/codeql/ruby-queries/*)
103103
codeql generate query-help --format=sarifv2.1.0 --output="${PACK_FOLDER}/rules.sarif" ql/src
@@ -202,7 +202,7 @@ jobs:
202202
echo 'name: sample-tests
203203
version: 0.0.0
204204
dependencies:
205-
codeql/ruby-all: 0.0.1
205+
codeql/ruby-all: "*"
206206
extractor: ruby
207207
tests: .
208208
' > qlpack.yml

.github/workflows/swift-qltest.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,23 @@ jobs:
2323
- uses: ./.github/actions/fetch-codeql
2424
- name: Check QL formatting
2525
run: find ql "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 codeql query format --check-only
26+
qltest-test:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v3
30+
- uses: bazelbuild/setup-bazelisk@v2
31+
- uses: actions/setup-python@v4
32+
with:
33+
python-version-file: 'swift/.python-version'
34+
- name: Test qltest.sh
35+
run: |
36+
bazel test //swift/tools/test/qltest
2637
qltest:
2738
runs-on: ${{ matrix.os }}
2839
strategy:
2940
fail-fast: false
3041
matrix:
31-
os : [ubuntu-20.04, macos-latest]
42+
os: [ ubuntu-20.04, macos-latest ]
3243
steps:
3344
- uses: actions/checkout@v3
3445
- uses: ./.github/actions/fetch-codeql

change-notes/1.20/analysis-javascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
| Unneeded defensive code | More true positive and fewer false positive results | This query now recognizes additional defensive code patterns. |
5353
| Unsafe dynamic method access | Fewer false positive results | This query no longer flags concatenated strings as unsafe method names. |
5454
| Unused parameter | Fewer false positive results | This query no longer flags parameters with leading underscore. |
55-
| Unused variable, import, function or class | Fewer false positive results | This query now flags fewer variables that are implictly used by JSX elements. It no longer flags variables with a leading underscore and variables in dead code. |
55+
| Unused variable, import, function or class | Fewer false positive results | This query now flags fewer variables that are implicitly used by JSX elements. It no longer flags variables with a leading underscore and variables in dead code. |
5656
| Unvalidated dynamic method call | More true positive results | This query now flags concatenated strings as unvalidated method names in more cases. |
5757
| Useless assignment to property. | Fewer false positive results | This query now treats assignments with complex right-hand sides correctly. |
5858
| Useless conditional | Fewer results | Additional defensive coding patterns are now ignored. |

change-notes/1.23/analysis-cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The following changes in version 1.23 affect C/C++ analysis in all applications.
1919
| Hard-coded Japanese era start date in call (`cpp/japanese-era/constructor-or-method-with-exact-era-date`) | Deprecated | This query has been deprecated. Use the new combined query Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) instead. |
2020
| Hard-coded Japanese era start date in struct (`cpp/japanese-era/struct-with-exact-era-date`) | Deprecated | This query has been deprecated. Use the new combined query Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) instead. |
2121
| Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) | More correct results | This query now checks for the beginning date of the Reiwa era (1st May 2019). |
22-
| Non-constant format string (`cpp/non-constant-format`) | Fewer false positive results | Fixed false positive results triggrered by mismatching declarations of a formatting function. |
22+
| Non-constant format string (`cpp/non-constant-format`) | Fewer false positive results | Fixed false positive results triggered by mismatching declarations of a formatting function. |
2323
| Sign check of bitwise operation (`cpp/bitwise-sign-check`) | Fewer false positive results | Results involving `>=` or `<=` are no longer reported. |
2424
| Too few arguments to formatting function (`cpp/wrong-number-format-arguments`) | Fewer false positive results | Fixed false positive results triggered by mismatching declarations of a formatting function. |
2525
| Too many arguments to formatting function (`cpp/too-many-format-arguments`) | Fewer false positive results | Fixed false positive results triggered by mismatching declarations of a formatting function. |

change-notes/1.24/analysis-javascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191

9292
## Changes to libraries
9393

94-
* The predicates `RegExpTerm.getSuccessor` and `RegExpTerm.getPredecessor` have been changed to reflect textual, not operational, matching order. This only makes a difference in lookbehind assertions, which are operationally matched backwards. Previously, `getSuccessor` would mimick this, so in an assertion `(?<=ab)` the term `b` would be considered the predecessor, not the successor, of `a`. Textually, however, `a` is still matched before `b`, and this is the order we now follow.
94+
* The predicates `RegExpTerm.getSuccessor` and `RegExpTerm.getPredecessor` have been changed to reflect textual, not operational, matching order. This only makes a difference in lookbehind assertions, which are operationally matched backwards. Previously, `getSuccessor` would mimic this, so in an assertion `(?<=ab)` the term `b` would be considered the predecessor, not the successor, of `a`. Textually, however, `a` is still matched before `b`, and this is the order we now follow.
9595
* An extensible model of the `EventEmitter` pattern has been implemented.
9696
* Taint-tracking configurations now interact differently with the `data` flow label, which may affect queries
9797
that combine taint-tracking and flow labels.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const mongoose = require('mongoose');
2+
3+
Logger = require('./logger').Logger;
4+
Note = require('./models/note').Note;
5+
6+
(async () => {
7+
if (process.argv.length != 5) {
8+
Logger.log("Creates a private note. Usage: node add-note.js <token> <title> <body>")
9+
return;
10+
}
11+
12+
// Open the default mongoose connection
13+
await mongoose.connect('mongodb://localhost:27017/notes', { useFindAndModify: false });
14+
15+
const [userToken, title, body] = process.argv.slice(2);
16+
await Note.create({ title, body, userToken });
17+
18+
Logger.log(`Created private note with title ${title} and body ${body} belonging to user with token ${userToken}.`);
19+
20+
await mongoose.connection.close();
21+
})();
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
const bodyParser = require('body-parser');
2+
const express = require('express');
3+
const mongoose = require('mongoose');
4+
5+
const notesApi = require('./notes-api');
6+
const usersApi = require('./users-api');
7+
8+
const addSampleData = module.exports.addSampleData = async () => {
9+
const [userA, userB] = await User.create([
10+
{
11+
name: "A",
12+
token: "tokenA"
13+
},
14+
{
15+
name: "B",
16+
token: "tokenB"
17+
}
18+
]);
19+
20+
await Note.create([
21+
{
22+
title: "Public note belonging to A",
23+
body: "This is a public note belonging to A",
24+
isPublic: true,
25+
ownerToken: userA.token
26+
},
27+
{
28+
title: "Public note belonging to B",
29+
body: "This is a public note belonging to B",
30+
isPublic: true,
31+
ownerToken: userB.token
32+
},
33+
{
34+
title: "Private note belonging to A",
35+
body: "This is a private note belonging to A",
36+
ownerToken: userA.token
37+
},
38+
{
39+
title: "Private note belonging to B",
40+
body: "This is a private note belonging to B",
41+
ownerToken: userB.token
42+
}
43+
]);
44+
}
45+
46+
module.exports.startApp = async () => {
47+
// Open the default mongoose connection
48+
await mongoose.connect('mongodb://mongo:27017/notes', { useFindAndModify: false });
49+
// Drop contents of DB
50+
mongoose.connection.dropDatabase();
51+
// Add some sample data
52+
await addSampleData();
53+
54+
const app = express();
55+
56+
app.use(bodyParser.json());
57+
app.use(bodyParser.urlencoded());
58+
59+
app.get('/', async (_req, res) => {
60+
res.send('Hello World');
61+
});
62+
63+
app.use('/api/notes', notesApi.router);
64+
app.use('/api/users', usersApi.router);
65+
66+
app.listen(3000);
67+
Logger.log('Express started on port 3000');
68+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const startApp = require('./app').startApp;
2+
3+
Logger = require('./logger').Logger;
4+
Note = require('./models/note').Note;
5+
User = require('./models/user').User;
6+
7+
startApp();

0 commit comments

Comments
 (0)