Rewrite escape/unescape for SQL#1245
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders Open Preview |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit df97ffd:
|
cc3d619 to
566572b
Compare
| // escape \ -> \\\\ | ||
| res = res.replace(/(\\\\)/g, "\\\\$&"); | ||
| // escape % and _ with \ | ||
| res = res.replace(/[%_]/g, "\\$&"); |
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding High
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1245 +/- ##
==========================================
- Coverage 79.62% 8.05% -71.58%
==========================================
Files 246 246
Lines 13145 13312 +167
Branches 1743 1749 +6
==========================================
- Hits 10467 1072 -9395
- Misses 1800 12230 +10430
+ Partials 878 10 -868 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
1ae4589 to
f3082b7
Compare
f3082b7 to
6b5c131
Compare
6b5c131 to
f0003b9
Compare
f0003b9 to
1638ea8
Compare
1638ea8 to
16828b7
Compare
|
Deployment failed with the following error: |
…ing or encoding Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This reverts commit 566572b.
16828b7 to
df97ffd
Compare
|
Deployment failed with the following error: |
Potential fix for https://github.com/ukrbublik/react-awesome-query-builder/security/code-scanning/10
To fix the issue, we need to ensure that backslashes are properly escaped in the default branch of the
escapeLikefunction. This can be achieved by modifying the regular expression in theres.replacecall on line 40 to include backslashes (\\) as part of the characters to escape. The replacement string should also escape backslashes correctly.The updated regular expression will be
/[%_\\]/g, and the replacement string will be"\\\\$&". This ensures that all occurrences of%,_, and\are escaped consistently.Suggested fixes powered by Copilot Autofix. Review carefully before merging.