Skip to content

fix(settings): use function matchers for account rows and cells - #774

Merged
catinspace-au merged 1 commit into
mainfrom
fix/test-regexp-matcher
Nov 21, 2026
Merged

catinspace-au merged 1 commit into
mainfrom
fix/test-regexp-matcher

Conversation

@catinspace-au

Copy link
Copy Markdown
Contributor

Semgrep flagged three new RegExp(...) calls in AccountManagement.test.tsx under detect-non-literal-regexp. The fixture usernames and names posed no ReDoS risk here. The CI warning was still open.

The role and cell queries use function matchers. The two row lookups keep partial matching with includes(). The cell lookup uses startsWith() to keep the ^ match at the start.

On the remote build host, yarn workspace dfe-core-ui vitest run src/Settings/components/AccountManagement passed all 47 tests across 9 files. prettier --check passed on the same host. Semgrep rule r/javascript.lang.security.audit.detect-non-literal-regexp reports 3 findings before the change and 0 after.

The AccountManagement tests built RegExp objects from usernames and display names for Testing Library role name queries. Semgrep flags each RegExp with detect-non-literal-regexp.

The tests pass function matchers. The two substring lookups still match with includes(). The cell lookup uses startsWith() to keep the ^ anchor.
@catinspace-au
catinspace-au merged commit 161c6cb into main Nov 21, 2026
18 checks passed
@catinspace-au
catinspace-au deleted the fix/test-regexp-matcher branch November 21, 2026 11:04
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