Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sections of interest for Gemfile.lock cataloger #1749

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion syft/pkg/cataloger/ruby/parse_gemfile_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

var _ generic.Parser = parseGemFileLockEntries

var sectionsOfInterest = internal.NewStringSet("GEM")
var sectionsOfInterest = internal.NewStringSet("GEM", "GIT", "PATH", "PLUGIN SOURCE")

// parseGemFileLockEntries is a parser function for Gemfile.lock contents, returning all Gems discovered.
func parseGemFileLockEntries(_ source.FileResolver, _ *generic.Environment, reader source.LocationReadCloser) ([]pkg.Package, []artifact.Relationship, error) {
Expand Down
3 changes: 2 additions & 1 deletion syft/pkg/cataloger/ruby/parse_gemfile_lock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestParseGemfileLockEntries(t *testing.T) {
{Name: "coffee-script-source", Version: "1.7.0", PURL: "pkg:gem/coffee-script-source@1.7.0", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
{Name: "erubis", Version: "2.7.0", PURL: "pkg:gem/erubis@2.7.0", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
{Name: "execjs", Version: "2.0.2", PURL: "pkg:gem/execjs@2.0.2", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
{Name: "google-cloud-errors", Version: "1.3.0", PURL: "pkg:gem/google-cloud-errors@1.3.0", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
{Name: "hike", Version: "1.2.3", PURL: "pkg:gem/hike@1.2.3", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
{Name: "i18n", Version: "0.6.9", PURL: "pkg:gem/i18n@0.6.9", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
{Name: "jbuilder", Version: "2.0.7", PURL: "pkg:gem/jbuilder@2.0.7", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
Expand Down Expand Up @@ -59,7 +60,7 @@ func TestParseGemfileLockEntries(t *testing.T) {
{Name: "thread_safe", Version: "0.3.3", PURL: "pkg:gem/thread_safe@0.3.3", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
{Name: "tilt", Version: "1.4.1", PURL: "pkg:gem/tilt@1.4.1", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
{Name: "treetop", Version: "1.4.15", PURL: "pkg:gem/treetop@1.4.15", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
{Name: "turbolinks", Version: "2.2.2", PURL: "pkg:gem/turbolinks@2.2.2", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
{Name: "turbolinks", Version: "3.0.0", PURL: "pkg:gem/turbolinks@3.0.0", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
{Name: "tzinfo", Version: "1.2.0", PURL: "pkg:gem/tzinfo@1.2.0", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
{Name: "uglifier", Version: "2.5.0", PURL: "pkg:gem/uglifier@2.5.0", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
{Name: "unicorn", Version: "4.8.3", PURL: "pkg:gem/unicorn@4.8.3", Locations: locations, Language: pkg.Ruby, Type: pkg.GemPkg},
Expand Down
17 changes: 14 additions & 3 deletions syft/pkg/cataloger/ruby/test-fixtures/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
PATH
remote: ../google-cloud-errors
specs:
google-cloud-errors (1.3.0)

GIT
remote: https://github.com/rails/turbolinks.git
revision: 80216ce9d89920bf073709405e3fce6d0a3ccd9a
specs:
turbolinks (3.0.0)
coffee-rails

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -111,8 +123,6 @@ GEM
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbolinks (2.2.2)
coffee-rails
tzinfo (1.2.0)
thread_safe (~> 0.1)
uglifier (2.5.0)
Expand All @@ -135,6 +145,7 @@ PLATFORMS
DEPENDENCIES
bootstrap-sass
coffee-rails (~> 4.0.0)
google-cloud-errors!
jbuilder (~> 2.0)
jquery-rails
mysql2 (~> 0.3.16)
Expand All @@ -144,6 +155,6 @@ DEPENDENCIES
spring
sqlite3
therubyracer
turbolinks
turbolinks!
uglifier (>= 1.3.0)
unicorn
3 changes: 2 additions & 1 deletion test/integration/catalog_packages_cases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ var dirOnlyTestCases = []testCase{
"coffee-script-source": "1.7.0",
"erubis": "2.7.0",
"execjs": "2.0.2",
"google-cloud-errors": "1.3.0",
"hike": "1.2.3",
"i18n": "0.6.9",
"jbuilder": "2.0.7",
Expand Down Expand Up @@ -138,7 +139,7 @@ var dirOnlyTestCases = []testCase{
"thread_safe": "0.3.3",
"tilt": "1.4.1",
"treetop": "1.4.15",
"turbolinks": "2.2.2",
"turbolinks": "3.0.0",
"tzinfo": "1.2.0",
"uglifier": "2.5.0",
"unicorn": "4.8.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
PATH
remote: ../google-cloud-errors
specs:
google-cloud-errors (1.3.0)

GIT
remote: https://github.com/rails/turbolinks.git
revision: 80216ce9d89920bf073709405e3fce6d0a3ccd9a
specs:
turbolinks (3.0.0)
coffee-rails

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -111,8 +123,6 @@ GEM
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbolinks (2.2.2)
coffee-rails
tzinfo (1.2.0)
thread_safe (~> 0.1)
uglifier (2.5.0)
Expand All @@ -135,6 +145,7 @@ PLATFORMS
DEPENDENCIES
bootstrap-sass
coffee-rails (~> 4.0.0)
google-cloud-errors!
jbuilder (~> 2.0)
jquery-rails
mysql2 (~> 0.3.16)
Expand All @@ -144,6 +155,6 @@ DEPENDENCIES
spring
sqlite3
therubyracer
turbolinks
turbolinks!
uglifier (>= 1.3.0)
unicorn