question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

usage of add-mask still echoes the value to the log

See original GitHub issue

Describe the bug According to https://github.com/actions/runner/issues/159, the issue where the add-mask workflow command echoes/leaks the secret was supposed to be fixed, but we still observe it. This was also mentioned on the GitHub forum by a Partner

To Reproduce Steps to reproduce the behavior: echo “::add-mask:😒{{ steps.mystep.outputs.myvalue }}”

Expected behavior raw output is not echoed to the log

Runner Version and Platform Hosted Ubuntu

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:54
  • Comments:53 (8 by maintainers)

github_iconTop GitHub Comments

30reactions
ZebraFleshcommented, May 29, 2020

I guess I’m back to my original post then: what is the point of add-mask if it inherently exposes secrets?

25reactions
sshymkocommented, Dec 10, 2020

Accidentally discovered the following undocumented feature that can be used as a workaround for masking sensitive data. GitHub Actions appears to automatically mask inputs / environment variables following certain naming conventions. For instance, a plaintext variable named WEBHOOK_TOKEN holding a JWT is masked same way as encrypted secrets would. It would be great to officially document this behavior along with the supported keywords to make it safe to rely upon.

GitHub Action configuration:

name: Test
on:
  workflow_dispatch:
    inputs:
      WEBHOOK_URL:
        description: 'Webhook URL'
        required: true
      WEBHOOK_METHOD:
        description: 'Webhook method'
        required: true
        default: 'GET'
      WEBHOOK_TOKEN:
        description: 'Webhook token'
        required: true
jobs:
  test:
    name: Test sensitive data masking
    runs-on: ubuntu-latest
    env:
      WEBHOOK_URL: ${{ github.event.inputs.WEBHOOK_URL }}
      WEBHOOK_METHOD: ${{ github.event.inputs.WEBHOOK_METHOD }}
      WEBHOOK_TOKEN: ${{ github.event.inputs.WEBHOOK_TOKEN }}
    steps:
      - name: Notify job start
        run: |
          curl -s -o /dev/null -w "%{http_code}\n" \
            -X "$WEBHOOK_METHOD" "$WEBHOOK_URL" \
            -H "Authorization: Bearer $WEBHOOK_TOKEN"

GitHub Action log: github_action_log_mask_token

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working With add-mask and GitHub Actions for ... - Aaron Powell
The way add-mask works is that it takes a value and from that point onwards when that value is to be written to...
Read more >
How to mask environment variables created in Github ...
I tried applying ::add-mask:: . Adding echo "ACCESS_TOKEN=::add-mask::$ACCESS_TOKEN" >> $GITHUB_ENV only added ::add-mask:: to the string.
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 the...
Read more >
Working With add-mask and GitHub Actions for dynamic secrets
The way add-mask works is that it takes a value and from that point onwards when that value is to be written to...
Read more >
Masking Input Parameters in GitHub Actions
In the step, "Mask Password", we'll make use of the workflow command ::ask-mask::{value}. Unfortunately, calling add-mask on the input directly ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found