Skip to content

Conversation

@Fdawgs
Copy link
Member

@Fdawgs Fdawgs commented Sep 22, 2025

The action contains code injection where values from external sources are directly interpolated into JavaScript code without proper sanitisation.

While these values come from the dependabot/fetch-metadata action rather than direct user input, they still represent external data that could potentially contain malicious content if the metadata action were compromised or if dependency names contained special characters that could break JavaScript syntax.

Closes https://github.com/fastify/github-action-merge-dependabot/security/code-scanning/9, https://github.com/fastify/github-action-merge-dependabot/security/code-scanning/8, https://github.com/fastify/github-action-merge-dependabot/security/code-scanning/7, and https://github.com/fastify/github-action-merge-dependabot/security/code-scanning/6.

@github-actions
Copy link

No linked issues found. Please add the corresponding issues in the pull request description.
Use GitHub automation to close the issue when a PR is merged

@Fdawgs Fdawgs requested review from Eomm and Copilot September 24, 2025 10:57
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

Refactor GitHub Action to prevent potential code injection vulnerabilities by moving external data from direct string interpolation in JavaScript to environment variables.

  • Replaces direct string interpolation of dependabot metadata outputs with environment variable access
  • Adds environment variable declarations for action path and dependabot metadata fields
  • Modifies JavaScript code to use process.env instead of template literals for external values

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

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Frazer Smith <[email protected]>
@simoneb
Copy link
Collaborator

simoneb commented Sep 24, 2025

What kind of malicious input are we guarding against, and how does proxying those values through environment variables address the issue?

@Fdawgs
Copy link
Member Author

Fdawgs commented Oct 3, 2025

What kind of malicious input are we guarding against, and how does proxying those values through environment variables address the issue?

Linked code scanning alerts cover this, are you not able to open them?

@simoneb
Copy link
Collaborator

simoneb commented Oct 3, 2025

What kind of malicious input are we guarding against, and how does proxying those values through environment variables address the issue?

Linked code scanning alerts cover this, are you not able to open them?

Yes, I hadn't seen the links.

@Fdawgs Fdawgs merged commit fab3ec1 into main Oct 3, 2025
5 of 6 checks passed
@Fdawgs Fdawgs deleted the ref/action-injection branch October 3, 2025 12:14
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.

3 participants