-
Notifications
You must be signed in to change notification settings - Fork 39
refactor(action): avoid code injection #718
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
Conversation
|
No linked issues found. Please add the corresponding issues in the pull request description. |
There was a problem hiding this 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]>
|
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. |
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-metadataaction 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.