Projects STRLCPY syft Commits a81e0c80
🤬
  • ■ ■ ■ ■ ■ ■
    syft/pkg/cataloger/binary/cataloger_test.go
    skipped 514 lines
    515 515   Metadata: metadata("rust-standard-library-linux"),
    516 516   },
    517 517   },
     518 + {
     519 + name: "positive-ruby-3.2.1",
     520 + fixtureDir: "test-fixtures/classifiers/dynamic/ruby-library-3.2.1",
     521 + expected: pkg.Package{
     522 + Name: "ruby",
     523 + Version: "3.2.1",
     524 + Type: "binary",
     525 + PURL: "pkg:generic/[email protected]",
     526 + Locations: locations("ruby", "libruby.so.3.2.1"),
     527 + Metadata: pkg.BinaryMetadata{
     528 + Matches: []pkg.ClassifierMatch{
     529 + match("ruby-binary", "ruby"),
     530 + match("ruby-binary", "libruby.so.3.2.1"),
     531 + },
     532 + },
     533 + },
     534 + },
     535 + {
     536 + name: "positive-ruby-2.7.7",
     537 + fixtureDir: "test-fixtures/classifiers/dynamic/ruby-library-2.7.7",
     538 + expected: pkg.Package{
     539 + Name: "ruby",
     540 + Version: "2.7.7p221",
     541 + Type: "binary",
     542 + PURL: "pkg:generic/[email protected]",
     543 + Locations: locations("ruby", "libruby.so.2.7.7"),
     544 + Metadata: pkg.BinaryMetadata{
     545 + Matches: []pkg.ClassifierMatch{
     546 + match("ruby-binary", "ruby"),
     547 + match("ruby-binary", "libruby.so.2.7.7"),
     548 + },
     549 + },
     550 + },
     551 + },
     552 + {
     553 + name: "positive-ruby-1.9.3p551",
     554 + fixtureDir: "test-fixtures/classifiers/positive/ruby-1.9.3p551",
     555 + expected: pkg.Package{
     556 + Name: "ruby",
     557 + Version: "1.9.3p551",
     558 + Type: "binary",
     559 + PURL: "pkg:generic/[email protected]",
     560 + Locations: locations("ruby"),
     561 + Metadata: metadata("ruby-binary"),
     562 + },
     563 + },
    518 564   }
    519 565   
    520 566   for _, test := range tests {
    skipped 247 lines
  • ■ ■ ■ ■ ■ ■
    syft/pkg/cataloger/binary/default_classifiers.go
    skipped 219 lines
    220 220   PURL: mustPURL("pkg:generic/rust@version"),
    221 221   CPEs: singleCPE("cpe:2.3:a:rust-lang:rust:*:*:*:*:*:*:*:*"),
    222 222   },
     223 + {
     224 + Class: "ruby-binary",
     225 + FileGlob: "**/ruby",
     226 + EvidenceMatcher: evidenceMatchers(
     227 + rubyMatcher,
     228 + sharedLibraryLookup(
     229 + // try to find version information from libruby shared libraries
     230 + `^libruby\.so.*$`,
     231 + rubyMatcher),
     232 + ),
     233 + Package: "ruby",
     234 + PURL: mustPURL("pkg:generic/ruby@version"),
     235 + CPEs: singleCPE("cpe:2.3:a:ruby-lang:ruby:*:*:*:*:*:*:*:*"),
     236 + },
    223 237  }
    224 238   
    225 239  // in both binaries and shared libraries, the version pattern is [NUL]3.11.2[NUL]
    skipped 4 lines
    230 244   pythonVersionTemplate,
    231 245  )
    232 246   
     247 +var rubyMatcher = fileContentsVersionMatcher(
     248 + // ruby 3.2.1 (2023-02-08 revision 31819e82c8) [x86_64-linux]
     249 + // ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5) [x86_64-linux]
     250 + `(?m)ruby (?P<version>[0-9]\.[0-9]\.[0-9](p[0-9]+)?) `)
     251 + 
  • ■ ■ ■ ■ ■ ■
    syft/pkg/cataloger/binary/test-fixtures/Makefile
    skipped 1 lines
    2 2  all: \
    3 3   classifiers/dynamic/python-binary-shared-lib-3.11 \
    4 4   classifiers/dynamic/python-binary-shared-lib-redhat-3.9 \
    5  - classifiers/dynamic/python-binary-with-version-3.9
     5 + classifiers/dynamic/python-binary-with-version-3.9 \
     6 + classifiers/dynamic/ruby-library-3.2.1 \
     7 + classifiers/dynamic/ruby-library-2.7.7
    6 8   
    7 9  classifiers/dynamic/python-binary-shared-lib-3.11:
    8 10   $(eval $@_image := "python:3.11-slim@sha256:0b106e1d2bf485c2a41474bc9cd5103e9eea4e179f40f10741b53b127059221e")
    skipped 18 lines
    27 29   ./get-image-file.sh $($@_image) \
    28 30   /usr/bin/python3.9 \
    29 31   $@/python3.9
     32 + 
     33 +classifiers/dynamic/ruby-library-3.2.1:
     34 + $(eval $@_image := "ruby:3.2.1-bullseye@sha256:b4a140656b0c5d26c0a80559b228b4d343f3fdbf56682fcbe88f6db1fa9afa6b")
     35 + ./get-image-file.sh $($@_image) \
     36 + /usr/local/bin/ruby \
     37 + $@/ruby
     38 + ./get-image-file.sh $($@_image) \
     39 + /usr/local/lib/libruby.so.3.2.1 \
     40 + $@/libruby.so.3.2.1
     41 + ./get-image-file.sh $($@_image) \
     42 + /usr/local/lib/libruby.so.3.2 \
     43 + $@/libruby.so.3.2
     44 + 
     45 +classifiers/dynamic/ruby-library-2.7.7:
     46 + $(eval $@_image := "ruby:2.7.7-bullseye@sha256:055191740a063f33fef1f09423e5ed8f91143aae62a3772a90910118464c5120")
     47 + ./get-image-file.sh $($@_image) \
     48 + /usr/local/bin/ruby \
     49 + $@/ruby
     50 + ./get-image-file.sh $($@_image) \
     51 + /usr/local/lib/libruby.so.2.7.7 \
     52 + $@/libruby.so.2.7.7
     53 + ./get-image-file.sh $($@_image) \
     54 + /usr/local/lib/libruby.so.2.7 \
     55 + $@/libruby.so.2.7
    30 56   
    31 57  .PHONY: clean
    32 58  clean:
    skipped 7 lines
  • ■ ■ ■ ■ ■ ■
    syft/pkg/cataloger/binary/test-fixtures/classifiers/positive/ruby-1.9.3p551/ruby
     1 +super from singleton method that is defined to multiple classes is not supported; this will be fixed in 1.9.3 or later
     2 +/usr/local/lib/ruby/site_ruby/1.9.1
     3 +/usr/local/lib/ruby/site_ruby/1.9.1/x86_64-linux
     4 +/usr/local/lib/ruby/vendor_ruby/1.9.1
     5 +/usr/local/lib/ruby/vendor_ruby/1.9.1/x86_64-linux
     6 +/usr/local/lib/ruby/1.9.1
     7 +/usr/local/lib/ruby/1.9.1/x86_64-linux
     8 +ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
     9 +1.9.3
     10 + 
Please wait...
Page is in error, reload to recover