add-mask doesn't work with workflow_dispatch inputs
See original GitHub issueDescribe the bug Github actions workflow with inputs cannot be masked using add-mask.
To Reproduce
- Create workflow
name: add-mask-test
on:
workflow_dispatch:
inputs:
secret:
description: 'secret value'
required: true
jobs:
my-job:
runs-on: ubuntu-latest
steps:
- name: add-mask test
run: |
echo "::add-mask::${{ github.event.inputs.secret }}"
- Run workflow entering secret value “password” as input
- Look at workflow log and see value “password” appears twice without masking
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}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:16
- Comments:13 (2 by maintainers)
Top Results From Across the Web
GitHub Actions: How to mask workflow_dispatch inputs ...
The problem is that it prints TEST_PASSWORD input in the log. Is there a way to encrypt/mask this, similar to ${{secrets.test_password }}?. A ......
Read more >Working With add-mask and GitHub Actions for ... - Aaron Powell
The `add-mask` thing in the workflow is only running against the local log stream, it doesn't push anything to secrets. Tero • 6...
Read more >Masking Input Parameters in GitHub Actions
GitHub actions allow you to add input parameters, which will then be used during runtime of the workflow. The inputs can be passed...
Read more >How to Hide Sensitive Things in GitHub Actions Logs
add -mask is one of these actions. When you call it from a Workflow, with a string, it will hide that string in...
Read more >Add Inputs to GitHub Actions Workflows - YouTube
In this GitHub Actions Tutorial, we'll walk through how to add user inputs to workflow_dispatch triggers in your GitHub Actions workflow so ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
my workarround create a shell variable from your input:
Full example with inputs and outputs. Leaving for reference.
Inputs
Workflow file:
Output
Test 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
GITHUB_ENV
duringadd_mask
step), as opposed to two previous steps where stars appear only because variable contains aSECRET
substring in its name.