Avoiding accidental secret leaks in the BEP #20126
Replies: 2 comments
-
This is a great proposal. Over at BuildBuddy, we also had to go through similar secrets scrubbing on the server side https://www.buildbuddy.io/docs/guide-metadata#environment-variable-redacting to protect our customers from leaking sensitive data. It would be nice to have these configurable on the client side as well with a sane default. Personally, very often I encountered
It would be nice if the users could define their custom scrubbing logic instead of having to disable the feature entirely. |
Beta Was this translation helpful? Give feedback.
-
I'll be reviewing this proposal - at first glance it makes a lot of sense to have a well-defined story here. Thanks for writing this up! At Google we've historically disabled BEP for the "run" command for the same reasons you've given here. But very recently we've made some changes to support loosening this restriction, including adding new
We haven't done anything (or planned to do anything) regarding implicit/explicit flags, environment variables, or console outputs. Since the proposal focuses on Thanks again for sharing this! |
Beta Was this translation helpful? Give feedback.
-
Publishing build results via the BEP can result in the accidental disclosure of secrets to a remote service. The primary way in which this happens is due to the presence of secrets in environment variables because Bazel captures the full environment as part of the invocation. But this isn’t the only way secrets might be leaked.
While the BEP is not a security boundary—a determined user will be able to embed secrets in the BEP—Bazel should do its best to not leak secrets by accident when a typical user runs Bazel against a remote service. This is important because common tools today (e.g. the aws CLI) encourage users to store secrets in their environment, so we must assume that their environment is sensitive.
I've put together a design document that describes the problem in more detail and proposes changes to make using Bazel safer against accidental secret leaks. I talked to a few of you during BazelCon about this issue and I think we agreed that this was a problem worth addressing, so here is the design document for proper review: https://docs.google.com/document/d/1-ou6dLV9xsjSSrKf3uJdZKZo-BUlTqbf0OAmKoe_W1s/edit. Feel free to add comments in the document, or here.
Beta Was this translation helpful? Give feedback.
All reactions