Skip to content

Commit e401e69

Browse files
ci: split tests into separate workflow to avoid running on irrelevant changes
Moved the `prepare_test_image_testdata`, `tests`, and `docker` jobs from `checks.yml` into a new `tests.yml` workflow file. Configured `paths-ignore` for the `tests.yml` workflow so that these long-running tests are skipped if changes only affect markdown files, documentation, or other unrelated GitHub Actions workflows. This prevents unnecessary test runs while still executing quick lint and formatting checks in `checks.yml`. Additionally, fixed zizmor alerts for cache poisoning and credential persistence in the docker job, and formatted the new file with prettier. Co-authored-by: another-rex <106129829+another-rex@users.noreply.github.com>
1 parent c02fe52 commit e401e69

30 files changed

Lines changed: 1654 additions & 574 deletions

File tree

.github/workflows/tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ jobs:
7878
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
7979
with:
8080
pattern: image-testdata-${{ github.run_number }}-*
81-
merge-multiple: true
8281
path: cmd/osv-scanner/scan/image/testdata/
8382
- name: Set up Go
8483
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0

cmd/osv-scanner/fix/__snapshots__/command_test.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9204,7 +9204,7 @@ Guided remediation (the fix command) can be risky when run on untrusted projects
92049204
{
92059205
"name": "org.codehaus.plexus:plexus-utils",
92069206
"versionFrom": "3.0",
9207-
"versionTo": "4.0.3",
9207+
"versionTo": "3.6.1",
92089208
"transitive": false
92099209
}
92109210
],
@@ -9358,7 +9358,7 @@ Guided remediation (the fix command) can be risky when run on untrusted projects
93589358
<dependency>
93599359
<groupId>org.codehaus.plexus</groupId>
93609360
<artifactId>plexus-utils</artifactId>
9361-
<version>4.0.3</version>
9361+
<version>3.6.1</version>
93629362
</dependency>
93639363
</dependencies>
93649364
</project>
@@ -9512,7 +9512,7 @@ Guided remediation (the fix command) can be risky when run on untrusted projects
95129512
Found 13 vulnerabilities matching the filter
95139513
Can fix 13/13 matching vulnerabilities by overriding 4 dependencies
95149514
OVERRIDE-PACKAGE: org.apache.httpcomponents:httpclient,4.5.13
9515-
OVERRIDE-PACKAGE: org.codehaus.plexus:plexus-utils,4.0.3
9515+
OVERRIDE-PACKAGE: org.codehaus.plexus:plexus-utils,3.6.1
95169516
OVERRIDE-PACKAGE: commons-io:commons-io,2.14.0
95179517
OVERRIDE-PACKAGE: org.jsoup:jsoup,1.15.3
95189518
FIXED-VULN-IDS: GHSA-2x83-r56g-cv47,GHSA-6fmv-xxpf-w3cw,GHSA-78wr-2p64-hpwj,GHSA-7r82-7xv7-xcpj,GHSA-8vhq-qq4p-grq3,GHSA-cfh5-3ghh-wfjx,GHSA-fmj5-wv96-r2ch,GHSA-g6ph-x5wf-g337,GHSA-gp7f-rwcx-9369,GHSA-gw85-4gmf-m7rh,GHSA-gwrp-pvrq-jmwv,GHSA-jcwr-x25h-x5fh,GHSA-m72m-mhq2-9p6c
@@ -9566,7 +9566,7 @@ UNFIXABLE-VULNS: 0
95669566
<dependency>
95679567
<groupId>org.codehaus.plexus</groupId>
95689568
<artifactId>plexus-utils</artifactId>
9569-
<version>4.0.3</version>
9569+
<version>3.6.1</version>
95709570
</dependency>
95719571
</dependencies>
95729572
</project>
@@ -11354,7 +11354,7 @@ Guided remediation (the fix command) can be risky when run on untrusted projects
1135411354
Found 13 vulnerabilities matching the filter
1135511355
Can fix 13/13 matching vulnerabilities by overriding 4 dependencies
1135611356
OVERRIDE-PACKAGE: org.apache.httpcomponents:httpclient,4.5.13
11357-
OVERRIDE-PACKAGE: org.codehaus.plexus:plexus-utils,4.0.3
11357+
OVERRIDE-PACKAGE: org.codehaus.plexus:plexus-utils,3.6.1
1135811358
OVERRIDE-PACKAGE: commons-io:commons-io,2.14.0
1135911359
OVERRIDE-PACKAGE: org.jsoup:jsoup,1.15.3
1136011360
FIXED-VULN-IDS: GHSA-2x83-r56g-cv47,GHSA-6fmv-xxpf-w3cw,GHSA-78wr-2p64-hpwj,GHSA-7r82-7xv7-xcpj,GHSA-8vhq-qq4p-grq3,GHSA-cfh5-3ghh-wfjx,GHSA-fmj5-wv96-r2ch,GHSA-g6ph-x5wf-g337,GHSA-gp7f-rwcx-9369,GHSA-gw85-4gmf-m7rh,GHSA-gwrp-pvrq-jmwv,GHSA-jcwr-x25h-x5fh,GHSA-m72m-mhq2-9p6c
@@ -11408,7 +11408,7 @@ UNFIXABLE-VULNS: 0
1140811408
<dependency>
1140911409
<groupId>org.codehaus.plexus</groupId>
1141011410
<artifactId>plexus-utils</artifactId>
11411-
<version>4.0.3</version>
11411+
<version>3.6.1</version>
1141211412
</dependency>
1141311413
</dependencies>
1141411414
</project>

cmd/osv-scanner/mcp/__snapshots__/integration_test.snap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ lockfile:<rootdir>/testdata/go-project/go.mod: found 1 package with issues
2424
Severity: '5.9'; Minimal Fix Version: '1.1.0';
2525

2626
1 known vulnerability found in lockfile:<rootdir>/testdata/go-project/go.mod
27-
Hiding 9 number of vulnerabilities deemed unimportant, use --all-vulns to show them.
28-
27+
Hiding 15 number of vulnerabilities deemed unimportant, use --all-vulns to show them.
2928

3029
---

cmd/osv-scanner/scan/image/__snapshots__/command_test.snap

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,34 @@ You can also view the full vulnerability list in your terminal with: `osv-scanne
12021202
12031203
---
12041204
1205+
[TestCommand_OCIImage/scanning_ubuntu_image_with_homebrew_extractor - 1]
1206+
Scanning local image tarball "./testdata/test-ubuntu-homebrew.tar"
1207+
skipping file "home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/.git/objects/pack/pack-0113dab039640255baab5438994e90f67a4c482c.pack" because its size (1155620741 bytes) is larger than the max size (1073741824 bytes)
1208+
1209+
1210+
Container Scanning Result (Ubuntu 22.04.5 LTS):
1211+
Total 1 package affected by 3 known vulnerabilities (1 Critical, 1 High, 1 Medium, 0 Low, 0 Unknown) from 1 ecosystem.
1212+
0 vulnerabilities can be fixed.
1213+
1214+
1215+
GIT
1216+
+------------------------------------------------------------------------------------------------------------------------------------------------------+
1217+
| Source:os:/home/linuxbrew/.linuxbrew/Cellar/cjson/1.7.17/INSTALL_RECEIPT.json |
1218+
+-------------------------------------+-------------------+------------------+------------+-------------------------+------------------+---------------+
1219+
| SOURCE PACKAGE | INSTALLED VERSION | FIX AVAILABLE | VULN COUNT | BINARY PACKAGES (COUNT) | INTRODUCED LAYER | IN BASE IMAGE |
1220+
+-------------------------------------+-------------------+------------------+------------+-------------------------+------------------+---------------+
1221+
| https://github.com/DaveGamble/cJSON | 1.7.17 | No fix available | 3 | | # 19 Layer | -- |
1222+
+-------------------------------------+-------------------+------------------+------------+-------------------------+------------------+---------------+
1223+
1224+
For the most comprehensive scan results, we recommend using the HTML output: `osv-scanner scan image --serve <image_name>`.
1225+
You can also view the full vulnerability list in your terminal with: `osv-scanner scan image --format vertical <image_name>`.
1226+
1227+
---
1228+
1229+
[TestCommand_OCIImage/scanning_ubuntu_image_with_homebrew_extractor - 2]
1230+
1231+
---
1232+
12051233
[TestCommand_OCIImage_JSONFormat/Scanning_python_image_with_some_packages - 1]
12061234
{
12071235
"results": [

cmd/osv-scanner/scan/image/command_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,17 @@ func TestCommand_OCIImage(t *testing.T) {
352352
},
353353
Exit: 1,
354354
},
355+
{
356+
Name: "scanning_ubuntu_image_with_homebrew_extractor",
357+
Args: []string{
358+
"", "image",
359+
"--experimental-plugins", "os/homebrew",
360+
"--experimental-plugins", "misc/brew-source",
361+
"--experimental-no-default-plugins",
362+
"--archive", "./testdata/test-ubuntu-homebrew.tar",
363+
},
364+
Exit: 1,
365+
},
355366
}
356367
for _, tt := range tests {
357368
t.Run(tt.Name, func(t *testing.T) {

cmd/osv-scanner/scan/image/testdata/cassettes/TestCommand_OCIImage.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15602,3 +15602,62 @@ interactions:
1560215602
status: 200 OK
1560315603
code: 200
1560415604
duration: 0s
15605+
- request:
15606+
proto: HTTP/1.1
15607+
proto_major: 1
15608+
proto_minor: 1
15609+
content_length: 171
15610+
host: api.osv.dev
15611+
body: |
15612+
{
15613+
"queries": [
15614+
{
15615+
"package": {
15616+
"ecosystem": "GIT",
15617+
"name": "https://github.com/davegamble/cjson"
15618+
},
15619+
"version": "1.7.17"
15620+
}
15621+
]
15622+
}
15623+
headers:
15624+
Content-Type:
15625+
- application/json
15626+
X-Test-Name:
15627+
- TestCommand_OCIImage/scanning_ubuntu_image_with_homebrew_extractor
15628+
url: https://api.osv.dev/v1/querybatch
15629+
method: POST
15630+
response:
15631+
proto: HTTP/1.1
15632+
proto_major: 1
15633+
proto_minor: 1
15634+
content_length: 220
15635+
body: |
15636+
{
15637+
"results": [
15638+
{
15639+
"vulns": [
15640+
{
15641+
"id": "CVE-2023-53154",
15642+
"modified": "2026-03-14T12:23:16.581554Z"
15643+
},
15644+
{
15645+
"id": "CVE-2024-31755",
15646+
"modified": "2026-03-14T12:30:30.932017Z"
15647+
},
15648+
{
15649+
"id": "CVE-2025-57052",
15650+
"modified": "2026-03-23T05:11:28.908372Z"
15651+
}
15652+
]
15653+
}
15654+
]
15655+
}
15656+
headers:
15657+
Content-Length:
15658+
- "220"
15659+
Content-Type:
15660+
- application/json
15661+
status: 200 OK
15662+
code: 200
15663+
duration: 0s
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ghcr.io/homebrew/ubuntu22.04:5.1.4@sha256:6b3c4bc0a7128cf5a78d2e641da6e88ac4195714e1315c4d2b522532d7fb1e7a
2+
3+
USER linuxbrew
4+
WORKDIR /home/linuxbrew
5+
6+
ENV HOMEBREW_NO_AUTO_UPDATE=1 \
7+
NONINTERACTIVE=1
8+
9+
# Install vulnerable package
10+
RUN brew install cjson
11+
12+
# Make it vulnerable :)
13+
RUN mv .linuxbrew/Cellar/cjson/* .linuxbrew/Cellar/cjson/1.7.17

0 commit comments

Comments
 (0)