Skip to content

Potential fix for code scanning alert no. 4: Incomplete string escaping or encoding - #58

Merged
davidbuzinski merged 7 commits into
mainfrom
codeql-fixes
Sep 4, 2025
Merged

Potential fix for code scanning alert no. 4: Incomplete string escaping or encoding#58
davidbuzinski merged 7 commits into
mainfrom
codeql-fixes

Conversation

@davidbuzinski

@davidbuzinski davidbuzinski commented Sep 4, 2025

Copy link
Copy Markdown
Collaborator

Wanted to try out the Copilot Autofix feature for these changes because they're pretty small. Seems pretty cool!

Below is the generated text for the PR:

Potential fix for https://github.com/matlab-actions/run-build/security/code-scanning/4

To fix the problem, every occurrence of a single quote in the returned path string should be replaced with two single quotes, not just the first. Replace the use of path.join(__dirname, "plugins").replace("'", "''") with path.join(__dirname, "plugins").replace(/'/g, "''"). Only this line (line 7) needs to be changed. No new imports or external libraries are needed since the global replace using regular expressions is well-supported in JavaScript/TypeScript. No other code changes are required in this file.

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

davidbuzinski and others added 2 commits September 4, 2025 13:36
…ng or encoding

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ng or encoding

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@davidbuzinski
davidbuzinski marked this pull request as ready for review September 4, 2025 17:42
Comment thread src/buildtool.ts
}

export function generateCommand(options: RunBuildOptions): string {
const pluginsPath = path.join(__dirname,"plugins").replace("'","''");

@davidbuzinski davidbuzinski Sep 4, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: why did we need this in the first place? In case the repo name or agent workspace has a single quote in it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, because this path is being injected into a MATLAB char array.

Comment thread src/buildtool.ts Outdated
Comment thread tsconfig.json Outdated
@davidbuzinski
davidbuzinski merged commit acfb587 into main Sep 4, 2025
8 checks passed
@davidbuzinski
davidbuzinski deleted the codeql-fixes branch September 4, 2025 18:19
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.

5 participants