Skip to content
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

chore(deps): update tj-actions/verify-changed-files action to v17 [security] #2301

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jan 2, 2024

Mend Renovate

This PR contains the following updates:

Package Type Update Change
tj-actions/verify-changed-files action major v16 -> v17

GitHub Vulnerability Alerts

CVE-2023-52137

Summary

The tj-actions/verify-changed-files action allows for command injection in changed filenames, allowing an attacker to execute arbitrary code and potentially leak secrets.

Details

The verify-changed-files workflow returns the list of files changed within a workflow execution.

This could potentially allow filenames that contain special characters such as ; and ` (backtick) which can be used by an attacker to take over the GitHub Runner if the output value is used in a raw fashion (thus being directly replaced before execution) inside a run block. By running custom commands an attacker may be able to steal secrets such as GITHUB_TOKEN if triggered on other events than pull_request. For example on push.

Proof of Concept

  1. Submit a pull request to the repository with a new file injecting a command. For example $(whoami).txt would be a valid filename.
  2. Upon approval of the workflow (triggered by the pull request), the action will get executed and the malicious pull request filename will flow into the List all changed files tracked and untracked files step.
- name: List all changed files tracked and untracked files
  run: |
    echo "Changed files: $"

Example output:

##[group]Run echo "Changed files: $(whoami).txt"
  echo "Changed files: $(whoami).txt"�[0m
shell: /usr/bin/bash -e {0}

##[endgroup]
Changed files: runner.txt

Impact

This issue may lead to arbitrary command execution in the GitHub Runner.

Resolution

  • A new safe_output input would be enabled by default and return filename paths escaping special characters like ;, ` (backtick), $, (), etc for bash environments.

  • A safe recommendation of using environment variables to store unsafe outputs.

- name: List all changed files tracked and untracked files
  env:
     CHANGED_FILES: $
  run: |
    echo "Changed files: $CHANGED_FILES"

Resources


Release Notes

tj-actions/verify-changed-files (tj-actions/verify-changed-files)

v17

Compare Source

Changes in v17.0.0

🔥 🔥 BREAKING CHANGE 🔥 🔥

A new safe_output input is now available to prevent outputting unsafe filename characters (Enabled by default). This would escape characters in the filename that could be used for command injection.

[!NOTE]
This can be disabled by setting the safe_output to false this comes with a recommendation to store all outputs generated in an environment variable first before using them.

Example
...
      - name: Verify Changed files
        uses: tj-actions/verify-changed-files@v16
        id: verify-changed-files
        with:
          safe_output: false # set to false because we are using an environment variable to store the output and avoid command injection.
      
      - name: List all changed tracked and untracked files
        env:
          FILES_CHANGED: ${{ steps.verify-changed-files.outputs.changed_files }}
        run: |
          echo "Changed files: $FILES_CHANGED
...

What's Changed

Full Changelog: tj-actions/verify-changed-files@v16...v17.0.0



Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot added the dependencies Pull requests that update a dependency label Jan 2, 2024
Copy link

netlify bot commented Jan 2, 2024

Deploy Preview for brilliant-pasca-3e80ec canceled.

Name Link
🔨 Latest commit 4c03f09
🔍 Latest deploy log https://app.netlify.com/sites/brilliant-pasca-3e80ec/deploys/659451dcfb457a00072fda1d

@github-actions github-actions bot added the type: ci Changes to the CI label Jan 2, 2024
@sabineschaller sabineschaller merged commit 3c5dd58 into main Jan 8, 2024
22 checks passed
@sabineschaller sabineschaller deleted the renovate-github-tags-tj-actions/verify-changed-files-vulnerability branch January 8, 2024 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency type: ci Changes to the CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant