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

template-injection: eliminate false positives with the env.* context #313

Closed
woodruffw opened this issue Dec 16, 2024 · 2 comments · Fixed by #318
Closed

template-injection: eliminate false positives with the env.* context #313

woodruffw opened this issue Dec 16, 2024 · 2 comments · Fixed by #318
Assignees
Labels
bug Something isn't working false-positive

Comments

@woodruffw
Copy link
Owner

Right now, there are a bunch of false positives when a run: context contains ${{ env.whatever }}. In particular, the following is entirely safe, but we treat it as a potential injection:

run: "echo ${{ env.foo }}"
env:
  foo: foo

We should do something similar to the static matrix check (but simplified, since there are thankfully no dimensions) for env. Specifically, we should not emit findings when the context is env and the referenced value is fully static (i.e. does not itself contain an expression).

@woodruffw woodruffw added bug Something isn't working false-positive labels Dec 16, 2024
@woodruffw woodruffw self-assigned this Dec 16, 2024
@woodruffw
Copy link
Owner Author

See curl/curl#15746 for some more context.

@woodruffw
Copy link
Owner Author

Thinking out loud: this isn't 100% trivial since each step/job/workflow env is a LoE<Env>, i.e. can be either a literal env mapping (with interior expressions) or a full-blown expression. So I think I'll start with just a Step::env_key_is_static API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working false-positive
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant