dagger: Create secrets from a file without leaking into the cache
Problem
Dagger can create new secrets from the contents of an artifact or container (File { secret }). But the resulting secret is then leaked in the cache. For this reason, File { secret } is currently considered unsafe. The risk can be mitigated, for example by only using this method for secrets that carry an acceptable risk (ie not production credentials), rigorously scoping and rotating them, limiting cache sharing, etc. But unless you are confident that you know what you are doing, this method should not be used.
That is very inconvenient, because at the moment File { secret } is the only available method for creating secrets dynamically.
Solution
-
Fix the implementation of
File { secret }, such that it doesn’t leak secrets in the cache. -
Better document the fact that
File { secret }is unsafe.
Design considerations
There is probably no easy fix for this. But we don’t know for sure, because we haven’t invested the effort to explore possible solutions.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 16 (16 by maintainers)
It was potentially 😃 My biggest issue was about the security. Less about the API. Keeping the API while making it safe was a way to be good everywhere.
Talking with @vikram-dagger we had some confusion around the 3 way to set secret and how they map with the 2 way to inject secrets. With 1 way to set secret, there is no confusion anymore. It’s more lines of code for the user, but less confusing in the end. That’s good in my book. We’re good.
Yes. Pulumi supports
--show-secretsonpulumi stack outputand we can get secrets to stdout; but there’s no way to keep them secure, as documented with other issues.I don’t think we do want these cached, though I do need dependent layers to run when the secret has changed.
^ I was also thinking about this as a quick solution. Having a special ephemeral dir inside each container and raise a warning if you’re trying to create a secret outside that dir that will leak into the cache.