Skip to content

Conversation

@SFARPak
Copy link
Owner

@SFARPak SFARPak commented Sep 14, 2025

Potential fix for https://github.com/SFARPak/ACode/security/code-scanning/16

To fix the issue, avoid constructing the attrib shell command by string interpolation and passing it to execSync, which will spawn a subshell and allow possible injection via the interpolated path.
Instead, invoke the attrib.exe command directly with its arguments using execFileSync, passing the arguments as an array so that no shell interpretation occurs. This avoids special character problems and command injection risks. Specifically, in rmDir, replace:

execSync(`attrib -R "${dirPath}\\*.*" /S /D`, { stdio: "ignore" })

with:

execFileSync("attrib", ["-R", `${dirPath}\\*.*`, "/S", "/D"], { stdio: "ignore" })

Additionally, import execFileSync from child_process at the top of the file.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…m environment values

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@SFARPak SFARPak marked this pull request as ready for review September 14, 2025 19:53
@SFARPak SFARPak merged commit e2ea932 into feature/extension-improvements Sep 14, 2025
5 checks passed
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