Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

amitie10g
Copy link

Passing secret to env may potentially leak the token on the logs. Using it directly into the command line will ofuscate it.

Passing secret to env may potentially leak the token on the logs. Using it directly into the command line will ofuscate it.
@imjasonh
Copy link
Owner

imjasonh commented Dec 20, 2024

I'm not sure there's a difference either way.

With this workflow:

on:
  workflow_dispatch:

jobs:
  test:
    name: test secret obfuscation
    runs-on: ubuntu-latest

    steps:
    - run: echo ${{secrets.TEST}}
    
    - env:
        TEST: ${{secrets.TEST}}
      run: echo ${TEST}
Screenshot 2024-12-20 at 12 00 23 PM

More docs about this here: https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#accessing-your-secrets

edit: workflows can also tell GitHub that a value is sensitive: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#masking-a-value-in-a-log

@imjasonh imjasonh closed this Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants