-
Notifications
You must be signed in to change notification settings - Fork 128
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
[feature] Set an environment variable in docker-based generator #1811
Comments
@asraa Just to confirm, are you suggesting to add these to the user-provided config file? @tiziano88: Do you have any comments or concerns about (1) adding env variables, and (2) mounting custom volumes? |
Correct. One thing that might complicate security concerns is that often the env vars will need to be resolved in the workflow calling the builder. For example, the config may include:
where We do something like this to resolve the ldflags in the go build configuration dynamically in workflows by adding an evaluated-env inputs to the go builder: slsa-github-generator/internal/builders/go/README.md Lines 222 to 255 in bdcd932
But here we may have inputs that are sensitive (like the token). We may still use this |
I was hoping that we could separate the env variables passed to the GH action (which would contain the token, and other stuff) from those that are passed to the Docker command itself. Those are semantically very different IMO. Or is that not possible because of how GH Actions work? |
Oh yes, they are! In the scorecard container in particular, it requires this GH env var to be passed to the Docker command:
In our builders, I don't think env vars into the GH action would affect the build, so they wouldn't be necessary to pass. |
Ah I see, makes sense, thanks for the context! Though perhaps that's a sign that that particular action should be split into two: generating the scorecard results, and then uploading them (similar to what we are discussing in #1867 for arbitrary artifacts) |
Actually, the GH env var is required for generating the scorecard result, since the scorecard API relies on using a GH token to avoid rate limiting when querying for data. That docker run doesn't upload anything :) I think I'll still think about what to do with redacting sensitive environment variables though here.. |
Is your feature request related to a problem? Please describe.
In trying to demo scorecards runs with the docker-based generator, I ran into an issue where the GITHUB_TOKEN env var must be set.
Also, for Trivy scanning, setting a volume would be helpful.
The text was updated successfully, but these errors were encountered: