Repository navigation
feat: redacting secrets in build logs. - #4311
Conversation
vito
left a comment
There was a problem hiding this comment.
Great start! Thanks for waiting, I was on vacation. 🙂
I like the idea of tracking used vars and using them to know what to filter out. I wonder if we could apply it more generally than to just tasks? For example, a credential may go into task A and then propagate to task B through the filesystem instead of through vars. Maybe we could have one big var tracker for an entire build?
Following on that, maybe we could apply the same redacting to put/get steps? Ideally resource authors know not to print any sensitive information, but it may be better to be safe than sorry.
4ccde7e to
cb9274c
Compare
|
Based on @vito 's comment, I enhanced the initial implementation. Highlights of the second implementation:
My test pipeline: The resource From the above screen shot, we can see all secrets have been redacted. @vito For the chunky build log issue, as you said, it's tricky to solve, and need more discussion. I think that issue can be implemented with a separate PR. Given this PR changes a lot of files, rebasing the changes is a big pain. Given the feature is by default turned off, if you are ok with my current code, can we get this PR merged first? If you are ok with the current design and my suggestion about chunky problem, then I'm going to update unit tests and raise the final version of code change. |
cb9274c to
ded9067
Compare
Totally fair. We can start small and iterate on it. 🙂 The new changes sound great, I'll try to review it today! In the meantime, it looks like there are a couple build failures (I think fakes just need to be regenerated), and the DCO bot is unhappy: https://github.com/concourse/concourse/pull/4311/checks?check_run_id=212761804 |
With this change, for all secrets fetched from credential manager, if they appear in build logs, then they will be automatically redacted as "[**redacted**]]". As this is currently an exprimental feature, a "concourse web" command option "--enable-redact-secrets" has been added to turn on this feature. Close concourse#4311 Signed-off-by: Chao Li <[email protected]>
ded9067 to
bc780a1
Compare
With this change, for all secrets fetched from credential manager, if they appear in build logs, then they will be automatically redacted as "[**redacted**]]". As this is currently an exprimental feature, a "concourse web" command option "--enable-redact-secrets" has been added to turn on this feature. Close concourse#4311 Signed-off-by: Chao Li <[email protected]>
bc780a1 to
fea7ba2
Compare
With this change, for all secrets fetched from credential manager, if they appear in build logs, then they will be automatically redacted as "[**redacted**]]". As this is currently an exprimental feature, a "concourse web" command option "--enable-redact-secrets" has been added to turn on this feature. Close concourse#4311 Signed-off-by: Chao Li <[email protected]>
fea7ba2 to
280b24b
Compare
With this change, for all secrets fetched from credential manager, if they appear in build logs, then they will be automatically redacted as "[**redacted**]]". As this is currently an exprimental feature, a "concourse web" command option "--enable-redact-secrets" has been added to turn on this feature. Close concourse#4311 Signed-off-by: Chao Li <[email protected]>
280b24b to
2e66694
Compare
With this change, for all secrets fetched from credential manager, if they appear in build logs, then they will be automatically redacted as "[**redacted**]]". As this is currently an exprimental feature, a "concourse web" command option "--enable-redact-secrets" has been added to turn on this feature. Close concourse#4311 Signed-off-by: Chao Li <[email protected]>
2e66694 to
805cd4e
Compare
With this change, for all secrets fetched from credential manager, if they appear in build logs, then they will be automatically redacted as "[**redacted**]]". As this is currently an exprimental feature, a "concourse web" command option "--enable-redact-secrets" has been added to turn on this feature. Close concourse#4311 Signed-off-by: Chao Li <[email protected]>
805cd4e to
48bc6f0
Compare
With this change, for all secrets fetched from credential manager, if they appear in build logs, then they will be automatically redacted as "[**redacted**]]". As this is currently an exprimental feature, a "concourse web" command option "--enable-redact-secrets" has been added to turn on this feature. Close concourse#4311 Signed-off-by: Chao Li <[email protected]>
48bc6f0 to
ebc23a7
Compare
vito
left a comment
There was a problem hiding this comment.
I noticed a tiny thing to clean up but everything else looks good so I'll just merge and fix it myself to save another review cycle. 🙂
Thanks!
I've opened #4389 to keep track of the problem with chunked secrets. We can address it some time in the future. I'm thinking it might be a requirement for removing the feature flag and making it the default.
| writtenBytes, writeErr = writer.Write([]byte("ok super-secret-source ok")) | ||
| }) | ||
|
|
||
| It("should be redacted", func() { |
There was a problem hiding this comment.
👍 Nice! These tests feel pretty descriptive and high-level.
| type engine struct { | ||
| builder StepBuilder | ||
| builder StepBuilder | ||
| secrets creds.Secrets |
There was a problem hiding this comment.
I think this can be rolled back now that the StepBuilder has them
| plan atc.CheckPlan | ||
| metadata StepMetadata | ||
| containerMetadata db.ContainerMetadata | ||
| secrets creds.Secrets |
There was a problem hiding this comment.
Looks like this never needed to be here, thanks for cleaning it up!
ref. #4311 and #4387 Signed-off-by: Alex Suraci <[email protected]>
ref. #4311 and #4387 Signed-off-by: Alex Suraci <[email protected]>


I have done an initial version. But since the change is big, I would call for an initial review from design perspective first before I spend time on updating tests.
My testing pipeline is:
Where
((test.pass))and((hello))are defined in Vault.Pipeline execution screen shot:

Highlights of the design:
Given not all users are sensitive with credential, and redact could lead to some performance drop, I'm thinking to add a CLI option to
concourse webprocess to control if or not enable this redacting feature, by default, the switch will be off.This PR will resolve issue #3972.
@vito Your comments are wanted.