Skip to content

Commit 0ec8ce1

Browse files
committed
feat: add the non-regression suite on pinned repositories to CI
1 parent a18ffb1 commit 0ec8ce1

25 files changed

Lines changed: 824 additions & 1 deletion

‎.github/workflows/ci.yml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ jobs:
2020
- run: python -m ruff check .
2121
- run: python -m pytest
2222

23+
regression:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.12"
30+
- uses: actions/cache@v4
31+
with:
32+
path: .regression
33+
key: regression-${{ hashFiles('tests/regression/repositories.toml') }}
34+
- run: python -m pip install -e ".[dev]"
35+
- run: python -m pytest -m regression
36+
2337
package:
2438
runs-on: ubuntu-latest
2539
steps:

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ build/
88
dist/
99

1010
.DS_Store
11+
.regression/

‎README.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ python -m pytest
2424
python -m ruff check .
2525
```
2626

27+
The non-regression suite analyses the public repositories pinned in
28+
[`tests/regression/repositories.toml`](tests/regression/repositories.toml) and compares
29+
findings and coverage with the snapshots in `tests/regression/expected/`. It clones on
30+
first use, needs the network and runs in its own CI job:
31+
32+
```bash
33+
python -m pytest -m regression
34+
CORETRACE_REGRESSION_UPDATE=1 python -m pytest -m regression # record an intended change
35+
```
36+
2737
## Install
2838

2939
```bash

‎pyproject.toml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ coretrace-python-analyzer = "coretrace_python.cli:main"
4646
packages = ["src/coretrace_python"]
4747

4848
[tool.pytest.ini_options]
49-
addopts = "-q"
49+
addopts = "-q -m 'not regression'"
50+
markers = [
51+
"regression: analyses the pinned public repositories of tests/regression (network, slow)",
52+
]
5053
testpaths = ["tests"]
5154

5255
[tool.ruff]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"coverage": {
3+
"files": 16,
4+
"files_analysed": 16,
5+
"functions": 176,
6+
"functions_analysed": 176
7+
},
8+
"findings": [
9+
{
10+
"file": "chatbot/__init__.py",
11+
"line": 224,
12+
"rule": "missing-timeout",
13+
"function": "train"
14+
},
15+
{
16+
"file": "setup.py",
17+
"line": 48,
18+
"rule": "command-injection",
19+
"function": "install_ollama"
20+
}
21+
]
22+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"coverage": {
3+
"files": 29,
4+
"files_analysed": 29,
5+
"functions": 39,
6+
"functions_analysed": 39
7+
},
8+
"findings": [
9+
{
10+
"file": "authentication/views.py",
11+
"line": 33,
12+
"rule": "open-redirect",
13+
"function": "sign_up"
14+
},
15+
{
16+
"file": "authentication/views.py",
17+
"line": 57,
18+
"rule": "sql-injection",
19+
"function": "log_in"
20+
},
21+
{
22+
"file": "authentication/views.py",
23+
"line": 82,
24+
"rule": "open-redirect",
25+
"function": "profile_update"
26+
},
27+
{
28+
"file": "djangogoat/settings.py",
29+
"line": 24,
30+
"rule": "hardcoded-credential",
31+
"function": null
32+
},
33+
{
34+
"file": "features/environment.py",
35+
"line": 196,
36+
"rule": "hardcoded-credential",
37+
"function": "after_all"
38+
},
39+
{
40+
"file": "notes/views.py",
41+
"line": 86,
42+
"rule": "open-redirect",
43+
"function": "conversation"
44+
},
45+
{
46+
"file": "requirements_app.txt",
47+
"line": 2,
48+
"rule": "vulnerable-dependency",
49+
"function": null
50+
},
51+
{
52+
"file": "requirements_app.txt",
53+
"line": 3,
54+
"rule": "vulnerable-dependency",
55+
"function": null
56+
}
57+
]
58+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"coverage": {
3+
"files": 1,
4+
"files_analysed": 1,
5+
"functions": 4,
6+
"functions_analysed": 4
7+
},
8+
"findings": [
9+
{
10+
"file": "main.py",
11+
"line": 15,
12+
"rule": "hardcoded-credential",
13+
"function": null
14+
},
15+
{
16+
"file": "main.py",
17+
"line": 29,
18+
"rule": "reachable-vulnerability",
19+
"function": "processImage"
20+
},
21+
{
22+
"file": "main.py",
23+
"line": 79,
24+
"rule": "exploitable-vulnerability",
25+
"function": "edit"
26+
},
27+
{
28+
"file": "main.py",
29+
"line": 91,
30+
"rule": "debug-enabled",
31+
"function": null
32+
},
33+
{
34+
"file": "requirements.txt",
35+
"line": 9,
36+
"rule": "vulnerable-dependency",
37+
"function": null
38+
},
39+
{
40+
"file": "requirements.txt",
41+
"line": 10,
42+
"rule": "vulnerable-dependency",
43+
"function": null
44+
},
45+
{
46+
"file": "requirements.txt",
47+
"line": 10,
48+
"rule": "vulnerable-dependency",
49+
"function": null
50+
}
51+
]
52+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"coverage": {
3+
"files": 15,
4+
"files_analysed": 15,
5+
"functions": 15,
6+
"functions_analysed": 15
7+
},
8+
"findings": [
9+
{
10+
"file": "app/admin.py",
11+
"line": 45,
12+
"rule": "insecure-deserialization",
13+
"function": "insecure_deserialize"
14+
},
15+
{
16+
"file": "app/auth.py",
17+
"line": 40,
18+
"rule": "hardcoded-credential",
19+
"function": "login"
20+
},
21+
{
22+
"file": "app/command.py",
23+
"line": 12,
24+
"rule": "command-injection",
25+
"function": "execute"
26+
},
27+
{
28+
"file": "app/config.py",
29+
"line": 4,
30+
"rule": "hardcoded-credential",
31+
"function": null
32+
},
33+
{
34+
"file": "app/config.py",
35+
"line": 6,
36+
"rule": "hardcoded-credential",
37+
"function": null
38+
},
39+
{
40+
"file": "app/redirect.py",
41+
"line": 11,
42+
"rule": "open-redirect",
43+
"function": "redirect"
44+
},
45+
{
46+
"file": "app/ssrf.py",
47+
"line": 12,
48+
"rule": "ssrf",
49+
"function": "proxy"
50+
},
51+
{
52+
"file": "app/upload.py",
53+
"line": 36,
54+
"rule": "path-traversal",
55+
"function": "upload"
56+
},
57+
{
58+
"file": "app/users.py",
59+
"line": 36,
60+
"rule": "sql-injection",
61+
"function": "search_users"
62+
}
63+
]
64+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"coverage": {
3+
"files": 6,
4+
"files_analysed": 6,
5+
"functions": 40,
6+
"functions_analysed": 40
7+
},
8+
"findings": [
9+
{
10+
"file": "app.py",
11+
"line": 69,
12+
"rule": "path-traversal",
13+
"function": "get_img"
14+
},
15+
{
16+
"file": "app.py",
17+
"line": 100,
18+
"rule": "exploitable-vulnerability",
19+
"function": "new_book"
20+
},
21+
{
22+
"file": "config-example.json",
23+
"line": 3,
24+
"rule": "hardcoded-credential",
25+
"function": null
26+
},
27+
{
28+
"file": "config-example.json",
29+
"line": 4,
30+
"rule": "hardcoded-credential",
31+
"function": null
32+
},
33+
{
34+
"file": "docs/insomnia/insomnia_config_file.yaml",
35+
"line": 71,
36+
"rule": "high-entropy-string",
37+
"function": null
38+
},
39+
{
40+
"file": "docs/insomnia/insomnia_config_file.yaml",
41+
"line": 231,
42+
"rule": "hardcoded-credential",
43+
"function": null
44+
},
45+
{
46+
"file": "docs/insomnia/insomnia_config_file.yaml",
47+
"line": 232,
48+
"rule": "hardcoded-credential",
49+
"function": null
50+
},
51+
{
52+
"file": "requirements.txt",
53+
"line": 10,
54+
"rule": "vulnerable-dependency",
55+
"function": null
56+
},
57+
{
58+
"file": "res.py",
59+
"line": 29,
60+
"rule": "reachable-vulnerability",
61+
"function": "store_pic_from_base64"
62+
}
63+
]
64+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"coverage": {
3+
"files": 1,
4+
"files_analysed": 1,
5+
"functions": 9,
6+
"functions_analysed": 9
7+
},
8+
"findings": [
9+
{
10+
"file": "model.json",
11+
"line": 1,
12+
"rule": "hardcoded-credential",
13+
"function": null
14+
}
15+
]
16+
}

0 commit comments

Comments
 (0)