-
Notifications
You must be signed in to change notification settings - Fork 13
ROX-12350: Detect CVE-2022-22978 #930
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
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
fd562b5
update
RTann ec898a7
update
RTann fcd84f7
Merge branch 'master' into ROX-12350
RTann e1f77fb
update
RTann 5bb668d
Merge branch 'master' into ROX-12350
RTann 03450ba
Merge branch 'master' into ROX-12350
RTann 0bb0a26
Merge branch 'master' into ROX-12350
RTann 45205ad
Merge branch 'master' into ROX-12350
RTann 958b9fa
update
RTann 8d84ec0
update
RTann c4cab3f
Merge branch 'master' into ROX-12350
RTann 7a48dbb
update
RTann 2de153e
update
RTann a258c22
Merge branch 'master' into ROX-12350
RTann d97d7e0
Merge branch 'master' into ROX-12350
RTann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -35,6 +35,36 @@ var ( | |||||||||||||||||||
immutableIndicators = []string{ | ||||||||||||||||||||
"agent", | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
knownSpringVendors = []string{"pivotal", "pivotal_software", "vmware"} | ||||||||||||||||||||
knownSpringComponents = set.NewFrozenStringSet( | ||||||||||||||||||||
"spring_advanced_message_queuing_protocol", | ||||||||||||||||||||
"spring_aop", | ||||||||||||||||||||
"spring_beans", | ||||||||||||||||||||
"spring_boot", | ||||||||||||||||||||
"spring_boot_autoconfigure", | ||||||||||||||||||||
"spring_boot_jarmode_layertools", | ||||||||||||||||||||
"spring_cloud_function", | ||||||||||||||||||||
"spring_cloud_function_core", | ||||||||||||||||||||
"spring_cloud_gateway", | ||||||||||||||||||||
"spring_cloud_netflix", | ||||||||||||||||||||
"spring_cloud_openfeign", | ||||||||||||||||||||
"spring_context", | ||||||||||||||||||||
"spring_core", | ||||||||||||||||||||
"spring_data_mongodb", | ||||||||||||||||||||
"spring_data_rest", | ||||||||||||||||||||
"spring_expression", | ||||||||||||||||||||
"spring_jcl", | ||||||||||||||||||||
"spring_security", | ||||||||||||||||||||
"spring_security_core", | ||||||||||||||||||||
"spring_security_crypto", | ||||||||||||||||||||
"spring_security_oath", | ||||||||||||||||||||
"spring_security_web", | ||||||||||||||||||||
"spring_web", | ||||||||||||||||||||
"spring_web_flow", | ||||||||||||||||||||
"spring_webflux", | ||||||||||||||||||||
"spring_webmvc", | ||||||||||||||||||||
) | ||||||||||||||||||||
) | ||||||||||||||||||||
|
||||||||||||||||||||
func isMutableName(name string) bool { | ||||||||||||||||||||
|
@@ -70,7 +100,7 @@ func ignored(c *component.Component) bool { | |||||||||||||||||||
return false | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
func getPossibleVendors(origins []string) set.StringSet { | ||||||||||||||||||||
func getPossibleVendors(origins []string, names set.StringSet) set.StringSet { | ||||||||||||||||||||
// Try splitting on periods | ||||||||||||||||||||
vendorSet := set.NewStringSet() | ||||||||||||||||||||
for _, orig := range origins { | ||||||||||||||||||||
|
@@ -90,6 +120,15 @@ func getPossibleVendors(origins []string) set.StringSet { | |||||||||||||||||||
if vendorSet.Cardinality() == 0 { | ||||||||||||||||||||
vendorSet.Add("apache") | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
// Add Spring-specific vendors. | ||||||||||||||||||||
for name := range names { | ||||||||||||||||||||
if knownSpringComponents.Contains(name) { | ||||||||||||||||||||
vendorSet.AddAll(knownSpringVendors...) | ||||||||||||||||||||
break | ||||||||||||||||||||
} | ||||||||||||||||||||
} | ||||||||||||||||||||
Comment on lines
+125
to
+130
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If performance is not a strong concern (it might be, though), you could also do
Suggested change
Or, to address the performance issue, maybe it would also be nice to add a |
||||||||||||||||||||
|
||||||||||||||||||||
return vendorSet | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
|
@@ -109,8 +148,8 @@ func GetJavaAttributes(c *component.Component) []*wfn.Attributes { | |||||||||||||||||||
return nil | ||||||||||||||||||||
} | ||||||||||||||||||||
|
||||||||||||||||||||
vendorSet := getPossibleVendors(java.Origins) | ||||||||||||||||||||
nameSet := common.GenerateNameKeys(c) | ||||||||||||||||||||
vendorSet := getPossibleVendors(java.Origins, nameSet) | ||||||||||||||||||||
versionSet := common.GenerateVersionKeys(c) | ||||||||||||||||||||
for k := range versionSet { | ||||||||||||||||||||
versionSet.Add(extensionRegex.ReplaceAllString(k, "")) | ||||||||||||||||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to do this only after adding
"apache"
based on nothing but hope? Isn't theknownSpringComponents
check more precise than the"apache"
default and therefore should suppress the latter?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess another question would be, is it adequate to do this here even when
vendorSet
is non-empty (and wasn't populated via the apache fallback)?