Skip to content

Potential fix for code scanning alert no. 45: Incomplete string escaping or encoding#791

Merged
alienx5499 merged 3 commits intomainfrom
alert-autofix-45
Mar 30, 2026
Merged

Potential fix for code scanning alert no. 45: Incomplete string escaping or encoding#791
alienx5499 merged 3 commits intomainfrom
alert-autofix-45

Conversation

@alienx5499
Copy link
Copy Markdown
Owner

Potential fix for https://github.com/alienx5499/SortVision/security/code-scanning/45

In general, when escaping characters for a specific output format (here, Markdown tables), you should escape the escape character itself (backslash) before escaping other metacharacters like |. This ensures that an existing backslash in the input cannot neutralize or otherwise interfere with the escaping you apply later.

The best minimal fix here is to update the construction of safeName and safeDetails so they escape backslashes first, then escape pipes. That avoids any change in intended content beyond making Markdown parsing more predictable, and keeps all other logic (slicing to 200 chars, etc.) unchanged. Concretely, in SortVision/tests/quality-assurance.mjs around lines 139–141, change:

const safeName = String(name).replace(/\|/g, '\\|');
const safeDetails = String(details || '').replace(/\|/g, '\\|').slice(0, 200);

to perform two replacements each: first \\ to \\\\, then | to \|. No new imports or helper functions are required; we can chain replace calls with regular expressions using the global g flag.

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

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sortvision Ready Ready Preview, Comment Mar 30, 2026 0:04am

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 29, 2026

QA suite report

Metric Value
Total tests 517
Passed 517
Failed 0
Warnings 0
Pass rate 100.0%
Grade S+
Duration 3.51s

Result: passed.

View workflow run

…ing or encoding

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 29, 2026

Lighthouse (CI)

View workflow run

Lighthouse (mobile)

URL Performance Accessibility Best practices SEO
http://localhost:3000/ 64 96 93 100
http://localhost:3000/algorithms/config/bubble 75 96 93 100
http://localhost:3000/es 76 96 93 100
http://localhost:3000/contributions/overview 68 96 96 100

Lighthouse (desktop)

URL Performance Accessibility Best practices SEO
http://localhost:3000/ 98 96 96 100
http://localhost:3000/algorithms/config/bubble 99 96 96 100
http://localhost:3000/es 98 96 96 100
http://localhost:3000/contributions/overview 97 96 96 100

…, enhance Lighthouse reporting with matrix strategy for mobile and desktop, and improve summary handling in CI workflows
@alienx5499 alienx5499 merged commit f85af4a into main Mar 30, 2026
19 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.

1 participant