Skip to content

Comments

Initial prod deploy#6

Merged
jmgasper merged 13 commits intomasterfrom
dev
Feb 19, 2026
Merged

Initial prod deploy#6
jmgasper merged 13 commits intomasterfrom
dev

Conversation

@jmgasper
Copy link
Contributor

No description provided.

}

private escapeSoqlLiteral(value: string): string {
return String(value).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 3 days ago

In general, when implementing a custom escaping function for string literals, you must escape backslashes themselves in addition to other meta-characters (like quotes) and ensure all occurrences are handled globally. A common safe pattern is to first escape all backslashes by replacing \ with \\, and then escape single quotes by replacing ' with \' (or whatever the literal syntax requires). Using regular expressions with the g flag guarantees that every instance is processed.

For this specific code, the best minimal fix is to update escapeSoqlLiteral to escape backslashes before escaping single quotes. This can be achieved by chaining two .replace calls: first value.replace(/\\/g, '\\\\') to double every backslash, then .replace(/'/g, "\\'") to prefix single quotes with a backslash. This keeps the function behavior the same for strings without backslashes while correctly handling inputs that contain them, and doesn’t require any changes elsewhere in the codebase. No new imports or helper methods are needed; the change is local to escapeSoqlLiteral in src/shared/services/billingAccount.service.ts around line 352–354.

Suggested changeset 1
src/shared/services/billingAccount.service.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/shared/services/billingAccount.service.ts b/src/shared/services/billingAccount.service.ts
--- a/src/shared/services/billingAccount.service.ts
+++ b/src/shared/services/billingAccount.service.ts
@@ -350,7 +350,9 @@
   }
 
   private escapeSoqlLiteral(value: string): string {
-    return String(value).replace(/'/g, "\\'");
+    return String(value)
+      .replace(/\\/g, '\\\\')
+      .replace(/'/g, "\\'");
   }
 
   private normalizePrivateKey(rawKey: string): string {
EOF
@@ -350,7 +350,9 @@
}

private escapeSoqlLiteral(value: string): string {
return String(value).replace(/'/g, "\\'");
return String(value)
.replace(/\\/g, '\\\\')
.replace(/'/g, "\\'");
}

private normalizePrivateKey(rawKey: string): string {
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
@jmgasper jmgasper merged commit cb2af26 into master Feb 19, 2026
2 of 4 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