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 dependency groups filter for PackageOverrides config #1211

Closed
kmohrf opened this issue Aug 27, 2024 · 2 comments · Fixed by #1214
Closed

Add dependency groups filter for PackageOverrides config #1211

kmohrf opened this issue Aug 27, 2024 · 2 comments · Fixed by #1214
Labels
enhancement New feature or request

Comments

@kmohrf
Copy link

kmohrf commented Aug 27, 2024

Hi,

I think it would be nice if the PackageOverrides config would support matches on the package dependency groups (dev, optional, etc). The simplest solution would be a simple exact match like it is used for name or ecosystem.

Examples:

Ignore a dependency group entirely

This may be useful for projects that don’t care about any issues in a certain dependency group.

[[PackageOverrides]]
dependency_group = "dev"
ignore = true

Ignore a package only if it is in a certain dependency group

This is useful if vulnerabilities for a package should only be ignored as long as the package is part of a certain dependency group. Example: One might want to ignore a package if it is a dev dependency but it should raise errors if it is a production dependency.

[[PackageOverrides]]
name = "axios"
ecosystem = "npm"
dependency_group = "dev"
ignore = true

Thanks for your work on osv-scanner!

Cheers

@cuixq cuixq added the enhancement New feature or request label Aug 27, 2024
@cuixq
Copy link
Contributor

cuixq commented Aug 28, 2024

@G-Rath do you think you would be interested to work on this as well?

@G-Rath
Copy link
Collaborator

G-Rath commented Aug 28, 2024

I can at least have a look while I'm also looking at #1155

another-rex pushed a commit that referenced this issue Sep 9, 2024
This rewrites the package overrides logic to be composition based,
granting a lot more flexibility:

```
# ignore everything
[[PackageOverrides]]
ignore = true

# ignore everything in this group
[[PackageOverrides]]
group = "dev"
ignore = true

# ignore everything in this ecosystem
[[PackageOverrides]]
ecosystem = "go"
ignore = true

# ignore all packages named "axios" regardless of ecosystem or group
[[PackageOverrides]]
name = "axios"
ignore = true

# ignore all packages named "axios" in the npm ecosystem that are in the dev group
[[PackageOverrides]]
name = "axios"
ecosystem = "npm"
group = "dev"
ignore = true

# ... and so on
```

While some of these might seem a bit extreme, ultimately I think this is
probably the way to go as the logic itself is very straightforward and
it gives a lot more power to the people.

Since `config` is a public package, I've had to deprecated the related
existing public methods and there's a bit of naming & structural yuck
but I figure that's not a big deal since v2 is right around the corner
and again the logic itself is very straightforward.

Resolves #1211
Resolves #1155
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants