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

Some way to pass configuration to SBOM generator #3791

Closed
blowfishpro opened this issue Apr 12, 2023 · 3 comments
Closed

Some way to pass configuration to SBOM generator #3791

blowfishpro opened this issue Apr 12, 2023 · 3 comments

Comments

@blowfishpro
Copy link

As one example, syft supports running multiple catalogers in parallel which can substantially speed up generating the SBOM on a system with more than one CPU core. buildkit-syft-scaner hardcodes the default config which forces parallelism to 1. I suppose it could look for the processor count but that's not always reliable or desirable. And since the generator runs in a container it's not possible to pass environment variables, CLI flags, etc without creating a new image.

While the syft scanner is the main one at the moment, it's hard to say if different scanners might need different options and what they might be. And passing arbitrary container configuration via attest:sbom could get horribly complex very fast. So this is kind of open-ended, I don't really know what the configuration interface should be.

@tonistiigi
Copy link
Member

@jedevc

@blowfishpro
Copy link
Author

So I thought about it a bit and maybe environment variables could be supported without adding too much complication. These attributes could look something like:

env.<ENV_VAR_NAME>=<ENV_VAR_VALUE>

Or as a full command line argument:

--opt attest:sbom=generator=example/image,env.EXAMPLE_ONE=value1,env.EXAMPLE_TWO=value2

Drawbacks

  • The allowed character set of environment variable names and values is rather limited (e.g. a comma would break parsing).
    • Generally speaking environment variable names considered portable are limited to letters, digits, and underscores anyway, it might be more problematic for values though.
    • Since the attribute parsing uses CSV under the hood, you could quote to get around this, but when combined with shell quote processing that gets really messy really fast.
      • Example: --opt 'attest:sbom=generator=example/image,"env.SOME_LIST=one,two,three"'
  • We're effectively defining a nested structure for this simple key/value attribute set.

@jedevc
Copy link
Member

jedevc commented Oct 4, 2024

Fixed by #5372 (thanks @LaurentGoderre 🎉)

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

No branches or pull requests

3 participants