Skip to content

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

Closed
ericethridge wants to merge 1 commit into
mainfrom
alert-autofix-5
Closed

ericethridge wants to merge 1 commit into
mainfrom
alert-autofix-5

Conversation

@ericethridge

Copy link
Copy Markdown
Collaborator

Potential fix for https://github.com/doitintl/annotato/security/code-scanning/5

To fix this, update escapeMarkdownCodeCell in src/summary.ts to escape backslashes before escaping pipe characters, then normalize newlines as it already does. This preserves existing functionality (table-safe one-line output) while closing the incomplete escaping gap identified by CodeQL.

Best single fix (no behavior change beyond safer escaping):

  • File: src/summary.ts
  • Region: function escapeMarkdownCodeCell (around lines 12–14)
  • Change:
    • From: .replace(/\|/g, '\\|').replace(/\r?\n/g, ' ');
    • To: .replace(/\\/g, '\\\\').replace(/\|/g, '\\|').replace(/\r?\n/g, ' ');

No new imports, methods, or dependencies are required.

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

…ng or encoding

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@ericethridge
ericethridge deleted the alert-autofix-5 branch October 29, 2026 16:41
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