Skip to content

Conversation

@knqyf263
Copy link
Collaborator

@knqyf263 knqyf263 commented Sep 4, 2025

Description

This PR improves the security of the backport GitHub Actions workflow by using environment variables instead of direct context interpolation in shell commands.

Testing

Successfully tested in aquasecurity/trivy-test repository:

Changes

  • Replace direct GitHub context interpolation (${{ github.repository }}, ${{ github.actor }}) with built-in environment variables ($GITHUB_REPOSITORY, $GITHUB_ACTOR)
  • Pass issue number via environment variable instead of direct interpolation
  • Add proper shell quoting for script arguments

Security Improvements

This change follows GitHub Actions security best practices by:

  1. Using environment variables to prevent expression injection attacks
  2. Properly quoting shell arguments
  3. Eliminating direct interpolation of user-controlled data in shell commands

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

…d security

- Replace direct GitHub context interpolation with environment variables
- Use built-in GITHUB_REPOSITORY and GITHUB_ACTOR variables
- Pass issue number via environment variable
- Add proper shell quoting for script arguments
@knqyf263 knqyf263 self-assigned this Sep 4, 2025
@knqyf263 knqyf263 requested a review from Copilot September 4, 2025 07:41
Copy link
Contributor

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.

Pull Request Overview

This PR enhances the security of the GitHub Actions backport workflow by replacing direct context interpolation with environment variables to prevent expression injection attacks.

  • Replace direct GitHub context interpolation with built-in environment variables for repository and actor
  • Use environment variables for issue number instead of direct interpolation
  • Add proper shell quoting for script arguments

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@knqyf263 knqyf263 added the autoready Automatically mark PR as ready for review when all checks pass label Sep 4, 2025
@github-actions github-actions bot marked this pull request as ready for review September 4, 2025 08:02
@github-actions github-actions bot removed the autoready Automatically mark PR as ready for review when all checks pass label Sep 4, 2025
@DmitriyLewen DmitriyLewen added this pull request to the merge queue Sep 5, 2025
Merged via the queue into aquasecurity:main with commit 4359fe0 Sep 5, 2025
14 checks passed
@knqyf263 knqyf263 deleted the fix/use-env-vars-in-github-actions branch September 5, 2025 08:50
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