Skip to content

Commit b03f24e

Browse files
shinoclaude
andauthored
feat(detector): detect Seal Security patched library packages (#2596)
* feat(detector): detect Seal Security patched library packages Trivy v0.71.0 introduced vendor-specific advisory detection for libraries (aquasecurity/trivy#10297), which routes packages patched by Seal Security (e.g. @seal-security/ejs, seal-django) to dedicated advisory buckets such as "seal npm::" in trivy-db. The vendor matchers are registered via a side-effect import of pkg/detector/library/all, which trivy itself does in pkg/scan/langpkg. Import it in detector so that library.NewDriver picks up the vendor routing and vuls report can detect CVEs for Seal-patched packages found in lockfiles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(scanner): add Seal Security lockfile fixtures to golden test and make diff Add the seal/* lockfiles introduced in vulsio/integration#42 to the AnalyzeLibrary golden test and to the LIBS servers used by make diff / diff-redis / diff-rdb-redis (server entries seal-npm/seal-pip/seal-gomod were added to int-config.toml in the same integration PR). The CI integration checkout is pinned to the integration PR head for now; re-pin to the vulsio/integration main SHA once #42 is merged, together with the submodule pointer bump. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore: bump integration submodule to the seal lockfiles commit The test workflow checks out vulsio/integration at the SHA pinned in test.yml, so the committed submodule gitlink must match that pin or "go mod tidy && git diff --exit-code" fails on the dirty submodule. Point both at the vulsio/integration#42 head; re-pin both to the merged main SHA once that PR lands. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore: re-pin integration test data to the merged vulsio/integration main vulsio/integration#42 is merged; point both the CI checkout pin and the submodule gitlink at the squash-merged main commit instead of the PR head. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * docs(detector): clarify the vendor registration import comment Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 77a2bfc commit b03f24e

8 files changed

Lines changed: 77 additions & 3 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2727
with:
2828
repository: vulsio/integration
29-
ref: 9b7a17582cd4f4521f71fe64757c7397a47a36c3
29+
ref: f1e643c892c9b2445a1a87c7b9cc56647bc40184
3030
path: integration
3131
persist-credentials: false
3232
- name: Set up Go 1.x

GNUmakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ NOW=$(shell date '+%Y-%m-%dT%H-%M-%S%z')
9191
NOW_JSON_DIR := '${BASE_DIR}/$(NOW)'
9292
ONE_SEC_AFTER=$(shell date -d '+1 second' '+%Y-%m-%dT%H-%M-%S%z')
9393
ONE_SEC_AFTER_JSON_DIR := '${BASE_DIR}/$(ONE_SEC_AFTER)'
94-
LIBS := 'bundler' 'dart' 'elixir' 'pip' 'pipenv' 'poetry-v1' 'poetry-v2' 'pylock' 'uv' 'composer' 'composer-vendor-pear' 'composer-vendor-packagist' 'npm-v1' 'npm-v2' 'npm-v3' 'yarn' 'pnpm' 'pnpm-v9' 'bun' 'cargo' 'gomod' 'gosum' 'gobinary' 'jar' 'jar-wrong-name-log4j-core' 'war' 'pom' 'gradle' 'nuget-lock' 'nuget-config' 'dotnet-deps' 'dotnet-package-props' 'conan-v1' 'conan-v2' 'swift-cocoapods' 'swift-swift' 'rust-binary'
94+
LIBS := 'bundler' 'dart' 'elixir' 'pip' 'pipenv' 'poetry-v1' 'poetry-v2' 'pylock' 'uv' 'composer' 'composer-vendor-pear' 'composer-vendor-packagist' 'npm-v1' 'npm-v2' 'npm-v3' 'yarn' 'pnpm' 'pnpm-v9' 'bun' 'cargo' 'gomod' 'gosum' 'gobinary' 'jar' 'jar-wrong-name-log4j-core' 'war' 'pom' 'gradle' 'nuget-lock' 'nuget-config' 'dotnet-deps' 'dotnet-package-props' 'conan-v1' 'conan-v2' 'swift-cocoapods' 'swift-swift' 'rust-binary' 'seal-npm' 'seal-pip' 'seal-gomod'
9595

9696
diff:
9797
# git clone git@github.com:vulsio/vulsctl.git

detector/library.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ import (
1717
"github.com/aquasecurity/trivy/pkg/db"
1818
"github.com/aquasecurity/trivy/pkg/dependency/parser/java/jar"
1919
"github.com/aquasecurity/trivy/pkg/detector/library"
20+
21+
// Register vendor-specific advisory matchers (e.g. Seal Security) so
22+
// that drivers created by library.NewDriver route vendor-patched
23+
// packages to their vendor advisory buckets, as trivy does in
24+
// pkg/scan/langpkg.
25+
_ "github.com/aquasecurity/trivy/pkg/detector/library/all"
2026
ftypes "github.com/aquasecurity/trivy/pkg/fanal/types"
2127
"github.com/aquasecurity/trivy/pkg/log"
2228
"github.com/aquasecurity/trivy/pkg/purl"

scanner/analyze_golden_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ var lockfiles = []lockfileEntry{
8888
// Swift
8989
{"Podfile.lock", 0644, false},
9090
{"Package.resolved", 0644, false},
91+
92+
// Seal Security patched packages (mixed with standard packages;
93+
// detection via the "seal <eco>::" trivy-db buckets happens at report
94+
// time, here we only pin the parsed package names/versions)
95+
{"seal/package-lock.json", 0644, false},
96+
{"seal/requirements.txt", 0644, false},
97+
{"seal/go.mod", 0644, false},
9198
}
9299

93100
// goldenFileName converts a lockfile path to a golden file name.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[
2+
{
3+
"type": "gomod",
4+
"lockfilePath": "seal/go.mod",
5+
"libs": [
6+
{
7+
"name": "example.com/seal-demo-app",
8+
"version": "",
9+
"purl": "pkg:golang/example.com/seal-demo-app",
10+
"id": "example.com/seal-demo-app",
11+
"dependsOn": [
12+
"sealsecurity.io/golang.org/x/crypto@v0.26.0-sp1"
13+
]
14+
},
15+
{
16+
"name": "sealsecurity.io/golang.org/x/crypto",
17+
"version": "v0.26.0-sp1",
18+
"purl": "pkg:golang/sealsecurity.io/golang.org/x/crypto@v0.26.0-sp1",
19+
"id": "sealsecurity.io/golang.org/x/crypto@v0.26.0-sp1"
20+
}
21+
]
22+
}
23+
]

scanner/testdata/golden/seal_package-lock.json.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[
2+
{
3+
"type": "pip",
4+
"lockfilePath": "seal/requirements.txt",
5+
"libs": [
6+
{
7+
"name": "requests",
8+
"version": "2.32.3",
9+
"purl": "pkg:pypi/requests@2.32.3"
10+
},
11+
{
12+
"name": "seal-django",
13+
"version": "3.2.18+sp1",
14+
"purl": "pkg:pypi/seal-django@3.2.18%2Bsp1"
15+
}
16+
]
17+
}
18+
]

0 commit comments

Comments
 (0)