Skip to content

feat: add option to specify one or more grype config files - #589

Merged
kzantow merged 3 commits into
anchore:mainfrom
sam-super:feat/specify-configs
Feb 4, 2026
Merged

feat: add option to specify one or more grype config files#589
kzantow merged 3 commits into
anchore:mainfrom
sam-super:feat/specify-configs

Conversation

@sam-super

Copy link
Copy Markdown
Contributor

Fixes: #217

Signed-off-by: Sam Adams <sam.adams@superpayments.com>
@sam-super
sam-super force-pushed the feat/specify-configs branch from aa7bf45 to 373e863 Compare January 30, 2026 15:27
@sam-super

Copy link
Copy Markdown
Contributor Author

Similar PR that didn't make it:
#427

Signed-off-by: Sam Adams <sam.adams@superpayments.com>
@kzantow

kzantow commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Hi @sam-super, I should note there are currently 2 ways to use Grype configuration in scan action:

  • pass grype environment variables e.g. the env: key with GRYPE_ENV_VAR=... or even: GRYPE_CONFIG=<path-to-config>
  • place a config file in a standard location, e.g. <repo-root>/.grype.yaml

While I'm not necessarily opposed to specifying a grype configuration file, I think a small part of the issue is that there is a mismatch between some of the configuration for the scan action and grype itself. But sbom-action does support a config file, so if we accept this it would need to use the same options

@sam-super

Copy link
Copy Markdown
Contributor Author

Hi @kzantow,

For context we have a global grype config file and a local one, and currently we can't use both at the same time (which is the desired state). I originally tried passing GRYPE_CONFIG=one.yaml,two.yaml but it didn't work.

The individual grype env vars are unmaintainable as we are largely using this for ignores (which are a bit too complex).

So our only real option left is to merge the two configs ourselves (and then replace .grype.yaml with the merged one), but this seems unnecessary and error prone, considering grype cli already has the logic to handle multiple files.

I confess i don't really understand why the sbom-action inputs needs to be aligned with scan-action, unless it's just for consistency?
Either way i'm happy to change the name of the input to config if that is the issue?

Thanks for responding!

Hi @sam-super, I should note there are currently 2 ways to use Grype configuration in scan action:

* pass grype environment variables e.g. the `env:` key with `GRYPE_ENV_VAR=...` or even: `GRYPE_CONFIG=<path-to-config>`

* place a config file in a standard location, e.g. `<repo-root>/.grype.yaml`

While I'm not necessarily opposed to specifying a grype configuration file, I think a small part of the issue is that there is a mismatch between some of the configuration for the scan action and grype itself. But sbom-action does support a config file, so if we accept this it would need to use the same options

Signed-off-by: Sam Adams <sam.adams@superpayments.com>
@sam-super
sam-super force-pushed the feat/specify-configs branch from d57b36e to 907382b Compare February 3, 2026 10:15
@sam-super

Copy link
Copy Markdown
Contributor Author

FWIW have changed to config to match anyway: 907382b

@kzantow kzantow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks @sam-super

@kzantow
kzantow merged commit e573fa1 into anchore:main Feb 4, 2026
31 checks passed
@sam-super

Copy link
Copy Markdown
Contributor Author

Thanks @kzantow !

spiffcs added a commit to pen-pal/scan-action that referenced this pull request Feb 4, 2026
* main: (21 commits)
  chore(deps): bump @actions/cache from 5.0.3 to 5.0.5 (anchore#592)
  chore(deps): bump @actions/tool-cache from 3.0.0 to 3.0.1 (anchore#593)
  chore(deps): update Grype to v0.107.1 (anchore#594)
  feat: add option to specify one or more grype config files (anchore#589)
  chore(deps): bump fast-xml-parser from 5.3.3 to 5.3.4 (anchore#590)
  chore(deps): bump release-drafter/release-drafter from 6.1.0 to 6.2.0 (anchore#587)
  chore(deps): update Grype to v0.107.0 (anchore#588)
  chore(deps-dev): bump prettier from 3.8.0 to 3.8.1 (anchore#584)
  chore(deps): bump peter-evans/create-pull-request from 8.0.0 to 8.1.0 (anchore#585)
  chore(deps-dev): bump tar from 7.5.6 to 7.5.7 (anchore#586)
  chore(deps): update Grype to v0.106.0 (anchore#583)
  chore(deps): bump zizmorcore/zizmor-action from 0.3.0 to 0.4.1 (anchore#582)
  chore(deps): bump actions/checkout from 6.0.1 to 6.0.2 (anchore#581)
  chore(deps): bump lodash from 4.17.21 to 4.17.23 (anchore#580)
  chore: tweak release drafter author and husky (anchore#579)
  chore: update release drafter permissions (anchore#578)
  chore: update release drafter to include appropriate dependencies (anchore#577)
  chore(deps): bump @actions/tool-cache from 2.0.2 to 3.0.0 (anchore#567)
  chore(deps): bump @actions/cache from 5.0.1 to 5.0.2 (anchore#568)
  chore(deps): bump @actions/core from 2.0.1 to 2.0.2 (anchore#569)
  ...

Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
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.

Add config as an option

2 participants