Skip to content

Commit 30cc2d6

Browse files
committed
feat(seal): add Ruby (RubyGems) ecosystem support
Seal Ruby packages follow the seal-$name naming pattern with versions in $version.0.1.sp$X format (e.g. seal-rack 2.0.7.0.1.sp1). The standard rubygems comparer handles .sp* pre-release segments correctly.
1 parent f056200 commit 30cc2d6

6 files changed

Lines changed: 68 additions & 10 deletions

File tree

docs/guide/coverage/others/seal.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Seal also provides patched versions of application dependencies with their own v
4141
| Node.js (npm) | `@seal-security/*` | `@seal-security/ejs` |
4242
| Go | `sealsecurity.io/*` | `sealsecurity.io/github.com/Masterminds/goutils` |
4343
| Java (Maven) | `seal.sp*` | `seal.sp1.org.eclipse.jetty:jetty-http` |
44+
| Ruby (RubyGems) | `seal-*` | `seal-rack` |
4445

4546
When Trivy detects packages matching these patterns, it automatically uses Seal Security advisories for vulnerability scanning.
4647

pkg/detector/library/driver_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,31 @@ func TestDriver_Detect(t *testing.T) {
264264
},
265265
},
266266
},
267+
{
268+
name: "seal security rubygems package",
269+
fixtures: []string{
270+
"testdata/fixtures/seal.yaml",
271+
"testdata/fixtures/data-source.yaml",
272+
},
273+
libType: ftypes.Bundler,
274+
args: args{
275+
pkgName: "seal-rack",
276+
pkgVer: "2.0.7.0.1.sp1",
277+
},
278+
want: []types.DetectedVulnerability{
279+
{
280+
VulnerabilityID: "CVE-2025-61780",
281+
PkgName: "seal-rack",
282+
InstalledVersion: "2.0.7.0.1.sp1",
283+
FixedVersion: "2.0.7.0.1.sp999",
284+
DataSource: &dbTypes.DataSource{
285+
ID: vulnerability.Seal,
286+
Name: "Seal Security Database",
287+
URL: "http://vulnfeed.sealsecurity.io/v1/osv/renamed/vulnerabilities.zip",
288+
},
289+
},
290+
},
291+
},
267292
{
268293
name: "seal security npm package",
269294
fixtures: []string{

pkg/detector/library/testdata/fixtures/data-source.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
ID: "seal"
4141
Name: "Seal Security Database"
4242
URL: "http://vulnfeed.sealsecurity.io/v1/osv/renamed/vulnerabilities.zip"
43+
- key: "seal rubygems::Seal Security Database"
44+
value:
45+
ID: "seal"
46+
Name: "Seal Security Database"
47+
URL: "http://vulnfeed.sealsecurity.io/v1/osv/renamed/vulnerabilities.zip"
4348
- key: "seal npm::Seal Security Database"
4449
value:
4550
ID: "seal"

pkg/detector/library/testdata/fixtures/seal.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@
3131
VulnerableVersions:
3232
- ">= 0.26.0-sp1, < 0.26.0-sp2"
3333

34+
- bucket: "seal rubygems::Seal Security Database"
35+
pairs:
36+
- bucket: "seal-rack"
37+
pairs:
38+
- key: "CVE-2025-61780"
39+
value:
40+
PatchedVersions:
41+
- "2.0.7.0.1.sp999"
42+
VulnerableVersions:
43+
- ">= 2.0.7.0.1.sp1, < 2.0.7.0.1.sp999"
44+
3445
- bucket: "seal maven::Seal Security Database"
3546
pairs:
3647
- bucket: "seal.sp1.org.apache.logging.log4j:log4j-core"

pkg/detector/library/vendors/seal/seal.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ import (
1313
// Seal Security provides patched versions of open source packages with their own
1414
// vulnerability advisories. Their packages are identified by ecosystem-specific
1515
// naming patterns:
16-
// - Maven: seal.sp*.$groupId:$artifactId (e.g. seal.sp1, seal.sp2)
17-
// - npm: @seal-security/$name
18-
// - Python: seal-$name
19-
// - Go: sealsecurity.io/$name
16+
// - Maven: seal.sp*.$groupId:$artifactId (e.g. seal.sp1, seal.sp2)
17+
// - npm: @seal-security/$name
18+
// - Python: seal-$name
19+
// - Go: sealsecurity.io/$name
20+
// - Ruby: seal-$name
2021
//
2122
// See also: pkg/detector/ospkg/seal/ for the OS package equivalent.
2223
type SealSecurity struct{}
@@ -35,8 +36,8 @@ func (SealSecurity) Match(eco ecosystem.Type, pkgName, _ string) bool {
3536
case ecosystem.Npm:
3637
// e.g. @seal-security/ejs, @seal-security/seal-ejs
3738
return strings.HasPrefix(normalized, "@seal-security/")
38-
case ecosystem.Pip:
39-
// e.g. seal-django
39+
case ecosystem.Pip, ecosystem.RubyGems:
40+
// e.g. seal-django (pip), seal-rack (rubygems)
4041
return strings.HasPrefix(normalized, "seal-")
4142
case ecosystem.Go:
4243
// e.g. sealsecurity.io/github.com/Masterminds/goutils

pkg/detector/library/vendors/seal/seal_test.go

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,27 @@ func TestSealSecurity_Match(t *testing.T) {
8888
pkgVer: "v1.1.1-sp1",
8989
want: false,
9090
},
91-
// Unsupported ecosystem
91+
// Ruby - name prefix seal-
92+
{
93+
name: "ruby seal package",
94+
eco: ecosystem.RubyGems,
95+
pkgName: "seal-rack",
96+
pkgVer: "2.0.7.0.1.sp1",
97+
want: true,
98+
},
9299
{
93-
name: "rubygems package is not supported",
100+
name: "ruby non-seal package",
94101
eco: ecosystem.RubyGems,
95-
pkgName: "activesupport",
96-
pkgVer: "7.0.0",
102+
pkgName: "rack",
103+
pkgVer: "2.0.7",
104+
want: false,
105+
},
106+
// Unsupported ecosystem
107+
{
108+
name: "erlang package is not supported",
109+
eco: ecosystem.Erlang,
110+
pkgName: "seal-cowboy",
111+
pkgVer: "2.9.0",
97112
want: false,
98113
},
99114
// Edge cases

0 commit comments

Comments
 (0)