Skip to content

Conversation

@Rushabhshroff
Copy link
Collaborator

No description provided.

Comment on lines +129 to +130
pPath
.replace(/\//g, "\\/")

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This does not escape backslash characters in the input.

Copilot Autofix

AI 7 days ago

To fix the incomplete string escaping, add an additional .replace(/\\/g, "\\\\") call before the existing .replace(/\//g, "\\/") sequence on pPath. This ensures that any backslash is properly escaped when building the regex, preventing malformed patterns or potential vulnerabilities if the set of command map keys changes in the future. Only edit the chain of .replace calls inside the resolveCommandName function, at the construction of the regex source string.

No new methods or imports are needed, as this is a mechanical and standard string operation.


Suggested changeset 1
src/utils/text-logs-parser.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/utils/text-logs-parser.ts b/src/utils/text-logs-parser.ts
--- a/src/utils/text-logs-parser.ts
+++ b/src/utils/text-logs-parser.ts
@@ -127,6 +127,7 @@
         const regex = new RegExp(
             "^" +
             pPath
+                .replace(/\\/g, "\\\\")
                 .replace(/\//g, "\\/")
                 .replace(/:sessionId/g, "[^/]+")
                 .replace(/:id/g, "[^/]+")
EOF
@@ -127,6 +127,7 @@
const regex = new RegExp(
"^" +
pPath
.replace(/\\/g, "\\\\")
.replace(/\//g, "\\/")
.replace(/:sessionId/g, "[^/]+")
.replace(/:id/g, "[^/]+")
Copilot is powered by AI and may make mistakes. Always verify output.
@Rushabhshroff Rushabhshroff merged commit 168810a into main Dec 18, 2025
6 of 7 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.

3 participants