Skip to content

Fix possible using variable interpolation `${{ in phpcs.yml - #95

Open
begininvoke wants to merge 1 commit into
10up:developfrom
begininvoke:redgem/security-fix-729d8500
Open

Fix possible using variable interpolation `${{ in phpcs.yml#95
begininvoke wants to merge 1 commit into
10up:developfrom
begininvoke:redgem/security-fix-729d8500

Conversation

@begininvoke

Copy link
Copy Markdown

Proposing a fix for something flagged in .github/workflows/phpcs.yml. It is around line 54.

The workflow step directly interpolates the github context (github.base_ref) and an output from another step into a shell command without validation. Since the GitHub context can contain user‑controlled data, an attacker who can influence those values could inject arbitrary commands, leading to OS command injection (CWE‑78). This can be exploited to steal secrets or exfiltrate repository code. The fix is to treat these values as untrusted by storing them in environment variables and using quoted variable references in the shell script.

Added intermediate environment variable to safely pass github.base_ref to the run step, eliminating OS command injection risk from untrusted context interpolation.

For reference: rule yaml.github-actions.security.run-shell-injection.run-shell-injection, CWE-78 (Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')). Rated high.

I may well be missing context here — if the current code is deliberate, feel free to close this.


Found with automated scanning (RedGem) and reviewed before opening. If it is not useful, closing it is completely fine.

…context data in a `run:` step could allow an attack
@begininvoke
begininvoke requested a review from jeffpaul as a code owner August 19, 2026 07:34
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.

1 participant