Repository navigation
chore : Add annotation for Redaction Failure - #50
Conversation
chrisnavar
left a comment
There was a problem hiding this comment.
I see this as a clear and concise way to fix this. I'd say this would work but could you test it before merge? Would be helpful to have an specific unit test where it simulates this scenario?
chrisnavar
left a comment
There was a problem hiding this comment.
The change looks good to me. Thanks for testing this.
|
|
||
| set +x | ||
| if check_buildkite_agent_version_for_redaction; then | ||
| echo "${secret}" | buildkite-agent redactor add |
There was a problem hiding this comment.
IIUC, the redaction command has been removed, and as a result, I can no longer see any redactor executions.
@craig-lind, could you clarify why this behaviour was changed?
cc @chrisnavar
There was a problem hiding this comment.
I can see
vault-secrets-buildkite-plugin/hooks/environment
Lines 49 to 52 in d4f7da8
I guess that the _SECRET enforcement, L51 is enough for this case, regardless what the user's input is.
However, I think the docs don't say anything about this particular behaviour:
When env_var is not specified, the name of the environment variable will be generated using this scheme: <UPPERCASE_SECRET_NAME>[_<UPPERCASE_FIELD_NAME>]_SECRET. Note that if you do specify an env_var, you should use one of the patterns that will ensure Buildkite will redact the secret, see the docs for details.
Wonder if reflecting that behaviour could help users here
There was a problem hiding this comment.
Shouldn't be removed, what this PR did was to annotate the reason for the redaction skipping.
It checks with check_buildkite_agent_version_for_redaction if the buildkite-agent version has the redactor subcommand available (>3.66.0), if not it sets the reason on redaction_skip_reason.
Then it redacts the secret on line 93 and if it fails it sets that the redaction command failed on redaction_skip_reason.
Finally, if the redaction_skip_reason is not empty then it does annotate with the actual reason as to why the redaction failed or why it wasn't available.
There was a problem hiding this comment.
Gotcha, I totally misread it! I just wanted to see if I could use the latest version and was curious about the new changes.
That totally makes sense, and thanks for helping me clear up my blind spot here 🙇
There was a problem hiding this comment.
No worries Victor! Feel free to ask any other doubts that may arise as you use it!
Info
Relates to: https://github.com/elastic/platform-engineering-productivity/issues/1479
While we do somewhat check if redaction is possible sometimes we can fail silently. Because of this, we want to add some clarity to the issue by using an annotation.
Some important background on this is that we have some pipelines that utilize old OS versions that don't run the
3.66.0or up of the buildkite agent. If we switch this to hard fail instead then we would break the pipelines that use these old images. This is a "rock and a hard place" so I chose to just make it a warning with some clarifying comments about what we could change in the future.Testing
I moved over a secret over to
ci-devand then used the plugin reference to this branch to use it:The subscription ID really isn't a secret, it just happens to be there which is why I chose it and is ok if it shows.
This test build shows the annotation that appears for the Windows 10 instance.