fix(ci): clear the security/detect-unsafe-regex error blocking every PR - #122
Merged
Conversation
The Azure Key Vault host check used `^\d{1,3}(\.\d{1,3}){3}$` to reject raw
IPv4. That pattern is linear in practice — every quantifier is bounded and
both ends are anchored — but security/detect-unsafe-regex flags the repeated
group, and `npx eslint .` is a required job, so the error failed CI on every
open PR regardless of what the PR touched.
State the same rule by splitting on '.' instead: no regex ambiguity to argue
about, and the intent reads more plainly. Verified behaviourally identical to
the old pattern across 17 cases (valid/invalid octet counts, trailing and
leading dots, over-long octets, hostnames, empty string).
Repo-wide eslint now reports 0 errors (50 warnings remain; CI runs
`npx eslint .` without --max-warnings, so warnings do not fail the job).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_ffbbd7f3-3ae3-4498-83ea-8feaa6932070) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
ESLint securityjob (npx eslint .) has been failing on every open PR, including ones that touch nothing related — e.g. #120, which only changesindex.html,vite.config.tsand a doc.The sole error is in
cloud-secrets.ts, on main:The pattern
^\d{1,3}(\.\d{1,3}){3}$rejects raw IPv4 vault hostnames. It is linear in practice — every quantifier is bounded and both ends are anchored — so this is a false positive from the rule's star-height heuristic. Rather than silence it with a disable comment, this states the same rule by splitting on., which removes the construct the heuristic objects to and reads more plainly.Behaviour is unchanged. Verified identical to the old pattern across 17 cases: valid IPv4, wrong octet counts, leading/trailing dots, over-long octets, hostnames, non-numeric octets, and the empty string.
After this, repo-wide
npx eslint .reports 0 errors (50 warnings remain, and CI does not pass--max-warnings 0, so they don't fail the job).Gates:
tsc --noEmitclean, 570 tests pass.Small and self-contained so it can go in ahead of the PRs it unblocks.
🤖 Generated with Claude Code
Note
Low Risk
Small refactor inside existing SSRF validation with equivalent intent; no auth or secret-resolution flow changes beyond how IPv4 hostnames are detected.
Overview
Unblocks repo-wide ESLint by rewriting raw IPv4 hostname detection in
assertAzureVaultUrl(cloud-secrets.ts). The old anchored pattern^\d{1,3}(\.\d{1,3}){3}$triggeredsecurity/detect-unsafe-regexand failed the security job on every PR.The check now splits the hostname on
.and treats four all-numeric octet segments as IPv4; IPv6 rejection viahost.includes(':')is unchanged. Validation behavior is intended to be the same for Azure Key Vault SSRF guards—no new endpoints or credential paths.Reviewed by Cursor Bugbot for commit a5c83c0. Bugbot is set up for automated code reviews on this repo. Configure here.