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

fix(pom): don't remove excluded deps from upper pom's #282

Merged
merged 3 commits into from
Dec 29, 2023

Conversation

DmitriyLewen
Copy link
Collaborator

@DmitriyLewen DmitriyLewen commented Dec 27, 2023

Description

Fixed cases where we were removing excluded deps from upper pom's.
Example - aquasecurity/trivy#5827
Test to better understand the fix -

{
name: "exclusions with wildcards",
inputFile: filepath.Join("testdata", "wildcard-exclusions", "pom.xml"),
local: true,
want: []types.Library{
{
ID: "com.example:wildcard-exclusions:4.0.0",
Name: "com.example:wildcard-exclusions",
Version: "4.0.0",
},
{
ID: "org.example:example-dependency2:2.3.4",
Name: "org.example:example-dependency2",
Version: "2.3.4",
},
{
ID: "org.example:example-dependency:1.2.3",
Name: "org.example:example-dependency",
Version: "1.2.3",
},
{
ID: "org.example:example-nested:3.3.3",
Name: "org.example:example-nested",
Version: "3.3.3",
},
},
wantDeps: []types.Dependency{
{
ID: "com.example:wildcard-exclusions:4.0.0",
DependsOn: []string{
"org.example:example-dependency2:2.3.4",
"org.example:example-dependency:1.2.3",
"org.example:example-nested:3.3.3",
},
},
},
},

@DmitriyLewen DmitriyLewen self-assigned this Dec 27, 2023
@DmitriyLewen DmitriyLewen marked this pull request as ready for review December 27, 2023 08:48
Comment on lines 261 to 262
exclusions := map[string]struct{}{}
maps.Copy(exclusions, ex)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about maps.Clone?

Suggested change
exclusions := map[string]struct{}{}
maps.Copy(exclusions, ex)
exclusions := maps.Clone(ex)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we will have enough of a hallow clone. Thank you!
Changed in cdc2c7f

@knqyf263 knqyf263 merged commit 5f09031 into aquasecurity:main Dec 29, 2023
2 checks passed
@DmitriyLewen DmitriyLewen deleted the fix-pom/nested-exlusions branch December 29, 2023 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants