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

Fix code injection warnings in check-codescanning-config internal Action #2781

Merged
merged 8 commits into from
Feb 25, 2025

Conversation

angelapwen
Copy link
Contributor

  • Use environment variable for EXPECTED_CONFIG_FILE_CONTENTS to escape any injected input
  • Use $RUNNER_TEMP rather than ${{ runner.temp }} for good measure, even though runner.temp should not be user-controlled input anyway.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

`runner.temp` is not user-controlled but we replace it with `$RUNNER_TEMP` in any case.
@Copilot Copilot bot review requested due to automatic review settings February 24, 2025 20:37
@angelapwen angelapwen requested a review from a team as a code owner February 24, 2025 20:37
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR fixes code injection warnings in the check-codescanning-config Action by switching to environment variables and safer temporary directory references.

  • Replace user-supplied inline inputs with environment variables for improved security.
  • Update temporary directory references to use $RUNNER_TEMP.

Reviewed Changes

File Description
.github/actions/check-codescanning-config/action.yml Updated to use environment variable EXPECTED_CONFIG_FILE_CONTENTS and $RUNNER_TEMP for file paths in commands and cleanup steps.

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more

Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See copilot's comment.

aeisenberg
aeisenberg previously approved these changes Feb 24, 2025
@aeisenberg
Copy link
Contributor

Oh...now it looks like the tests need to be updated. I'm not sure if this is a semantic change or just some artifact of how the quoting has changed.

@angelapwen
Copy link
Contributor Author

Hrm.. looks like the "{}" input is now being parsed as undefined. Let me try to debug..

@angelapwen angelapwen force-pushed the angelapwen/fix-code-injection-warning branch from 0bbfcad to e12eb8d Compare February 24, 2025 21:24
@angelapwen
Copy link
Contributor Author

Okay, figured it out... I had declared the environment variable in the wrong block 🤦

@angelapwen angelapwen merged commit a8849fb into main Feb 25, 2025
270 checks passed
@angelapwen angelapwen deleted the angelapwen/fix-code-injection-warning branch February 25, 2025 00:53
@github-actions github-actions bot mentioned this pull request Mar 7, 2025
8 tasks
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