Skip to content

test(security): escape every RegExp metacharacter in the icon-map matcher (CodeQL #1166, #1167) - #18081

Closed
diegosouzapw wants to merge 1 commit into
release/v3.8.53from
fix/codeql-1166-icon-map-regex-escape
Closed

diegosouzapw wants to merge 1 commit into
release/v3.8.53from
fix/codeql-1166-icon-map-regex-escape

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Summary

Fixes CodeQL alerts #1166 and #1167 (js/incomplete-sanitization) in tests/unit/icon-map-object-values.test.ts.

The icon-map scanner built a RegExp from an identifier and escaped only $. Identifiers matched by [A-Za-z_$][\w$]* cannot contain other metacharacters today, so this was not a live bug. The partial escape was still fragile, and it is the exact pattern the query flags. Both call sites now use a small escapeRegExp() helper that escapes every metacharacter. This is the same remedy as #1144 / PR #16832.

Test-only change, no production code touched.

Validation

  • node --import tsx/esm --test tests/unit/icon-map-object-values.test.ts: 3/3 pass before and after the change.
  • eslint --suppressions-location config/quality/eslint-suppressions.json and prettier --check are clean on the file.

⚠️ base-red inherited: #17219

@diegosouzapw

Copy link
Copy Markdown
Collaborator Author

Closing as a duplicate of #18057, which already landed the same fix for CodeQL #1166/#1167.

@diegosouzapw
diegosouzapw deleted the fix/codeql-1166-icon-map-regex-escape branch October 24, 2026 22:42
@github-actions

Copy link
Copy Markdown
Contributor

CI Coverage Report

  • Coverage job: skipped
  • PR test policy: success

Coverage artifact was not available for this run.

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