-
Notifications
You must be signed in to change notification settings - Fork 976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add-mask doesn't work with workflow_dispatch inputs #643
Comments
I also confirm the bug. A possible solution to this could be the workflow_dispatch inputs to be enhanced with INPUT_* environment variables as it is described in the documentation. This is also discussed in the Github Community. Provided the env variables are automatically set, we can then use |
Seems to be related to #475. |
Any updates on this? This is a major blocker for my company. We planned to use the input parameter as passphrase to decrypt files needed in the workflow that are user-specific. |
My use case is slightly different but I think my workaround will work for others as well. curl would produce output that contained secret data; but it was data i needed to parse with my workaround was to write to a file and just read from that for future actions:
and then later steps i can just get a value from the response like so. This'll be different depending on what you're parsing and how you need to pass the data between tasks.
Doing it this way kept the output clean. |
my workarround
|
Thank you! (MY_SECRET can be shortened to |
For the record, inputs / environment variables following certain naming conventions are being masked automatically. |
Full example with inputs and outputs. Leaving for reference. InputsWorkflow file:
OutputTest masking inputs:
Check output from another step (WRONG):
Check environment variables 1 (WRONG):
Check environment variables 2: (CORRECT?)
As I understand last case is the correct usage of masked input (use it as environment variable after placing it into |
The solutions that I'm seeing here result in the secret being written to event.json. I'm not entirely sure on the lifecycle of this file, but at least for a period of time your secret is written in plain text and possibly ends up in server logs. The event.json file is the POST payload that triggered the workflow. An alternative solution would be to use a vault, such as HashiCorp Vault. Your input would be the secret id and the vault credentials would be stored as a repository secret (these are not sent as plain text, unlike using the input). Then, just make an API call to vault to retrieve the secret. Note that Github recommends registering retrieved secret values as a secret. For more on hardening see the following: https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-secrets and examples are here: https://github.com/actions/toolkit/tree/main/packages/core#setting-a-secret |
Use hack described here: actions/runner#643 (comment)
Use hack described here: actions/runner#643 (comment)
This is actually masked well, but the output you are seeing and labeled wrong is actually due to the command being executed. |
Hey everyone, I labelled this issue as a feature request. Currently, we log everything that is executed, so using variables like in your workarounds is a good way to bypass this. We have added this issue to the enhancement backlog and it will be considered in the future 😊 |
This is still an issue - I've recently found a large number of workflows that should have had their secrets masked as they were correctly using I'm aware that people probably shouldn't be entering things that might contain secrets as inputs - but we should be designing systems to be safe by default. |
This issue was the most helpful resource I could find on how to solve this problem. Thanks everyone! Thanks to the comments in here, I was able to get this working in a repo of mine recently. But, the solution was boilerplate heavy and I felt it was fragile/error-prone. I was hoping for a better solution. This is not meant to be a self-promotion, but I did want to share I just created a GitHub Action to help make this easy. I thought other frustrated folks in here would find an Action useful. |
found in issue comment: actions/runner#643 (comment)
@prateekg1703 this started happening to us too! |
It's really concerning that really basic stuff like this isn't handled properly in Actions. For example, if the secret comes from another step's output, it will print the value every single time. It just replaces the ${{ steps.blah.outputs.out... }} with its value in the action. The only thing that comes to mind is that the previous action creates a file in RUNNER_TEMP or GITHUB_WORKSPACE to share with the next step. It's all just hackery and brittle as thin ice. |
Bumping this feature as it's a bit ridiculous that it's not currently possible |
Describe the bug
Github actions workflow with inputs cannot be masked using add-mask.
To Reproduce
Expected behavior
The value in add-mask does not appear at all in the workflow log output
Runner Version and Platform
Current runner version: '2.272.0'
Operating System
Ubuntu
18.04.4
LTS
What's not working?
The value in add-mask appears twice without masking
Job Log Output
add-mask test
shell: /bin/bash -e {0}
Run echo "::add-mask::password"
echo "::add-mask::password"
shell: /bin/bash -e {0}
The text was updated successfully, but these errors were encountered: