Use action to hide sensitive inputs #74
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For some reason, the
workflow_dispatch
action is somewhat of a second-class citizen, and does not receive a lot of the "safe by default" behavior that other action types do.For example, there's not clear or obvious way to keep inputs secret & masked from the logs. GitHub's
add-mask
functionality doesn't work because the echo statement required to create the mask logs the value (see this demo repo run).If these inputs were automatically injected as environment variables like the documentation suggest it does with
$INPUT_
, we wouldn't have to worry about the values being logged, but as of right now,workflow_dispatch
actions do not receive that behavior.The common workaround seems to be to parse out the inputs from the
GITHUB_EVENT
JSON and put those into an env var which then doesn't get logged. Something like:This is suggested a few times here, here and here.
Instead, I stumbled on this GitHub Community Action which goes a step further and uses a node script to access GitHub action's core's
setSecret
method. This felt like a less hacky way to go about protecting the sensitive information. You can see the results of using it in this demo repo.