Skip to content

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

Draft
srgooglo wants to merge 1 commit into
masterfrom
alert-autofix-14
Draft

Potential fix for code scanning alert no. 14: Incomplete string escaping or encoding#368
srgooglo wants to merge 1 commit into
masterfrom
alert-autofix-14

Conversation

@srgooglo

Copy link
Copy Markdown
Collaborator

Potential fix for https://github.com/ragestudio/comty/security/code-scanning/14

General fix: avoid manual piecemeal escaping (/ and * only). Instead, first escape all regex-special characters (including backslash), then intentionally translate supported wildcard syntax (*) into regex equivalents.

Best fix here (without changing broader functionality): in scripts/utils/getPackages.js, line 21 region, replace the current chained replace logic with:

  1. Escape all regex metacharacters using a standard pattern: /[.*+?^${}()|[\]\\]/g
  2. Convert escaped \* back into wildcard regex (.*) so existing * behavior is preserved.

This keeps current behavior intent (treat gitignore * as wildcard) while removing incomplete escaping risks. No new imports or dependencies are required.

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

…ing or encoding

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

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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