fix(utils): fail closed in site-scope checks when siteBaseUrl is missing#1766
Open
dhavkuma wants to merge 2 commits into
Open
fix(utils): fail closed in site-scope checks when siteBaseUrl is missing#1766dhavkuma wants to merge 2 commits into
dhavkuma wants to merge 2 commits into
Conversation
isWithinSiteScope and isPathPatternWithinSiteScope returned true when siteBaseUrl was falsy, treating URLs/patterns as in-scope by default. Fail closed instead, consistent with isPathPatternWithinSiteScope's existing fail-closed behavior for unverifiable regex patterns. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
This PR will trigger a patch release when merged. |
MysticatBot
approved these changes
Jul 2, 2026
There was a problem hiding this comment.
Hey @dhavkuma,
Verdict: Approve - clean security hardening, no issues found.
Complexity: TRIVIAL - 2-line behavior flip, 2 files.
Changes: Switches site-scope check functions from fail-open to fail-closed when siteBaseUrl is missing (2 files).
Non-blocking (1): minor issues and suggestions
- suggestion: Add an explicit
undefinedassertion to theisWithinSiteScopenull/empty test case (the falsy guard already handles it, but pinning the case prevents a future refactor from regressing it) -packages/spacecat-shared-utils/test/url-helpers.test.js:1256
Skill: pr-review | Model: us.anthropic.claude-opus-4-6-v1[1m] | Duration: 1m 21s | Cost: $2.27 | Commit: cdf39f617c55c747265fcf0fb69186f71bc46ff8
If this code review was useful, please react with 👍. Otherwise, react with 👎.
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.
Summary
isWithinSiteScopeandisPathPatternWithinSiteScopereturnedtruewhensiteBaseUrlwas missing/empty, treating every URL or pattern as in-scope by default.false) instead, consistent withisPathPatternWithinSiteScope's existing fail-closed behavior for patterns it can't verify as scoped.isWithinSiteScope,isPathPatternWithinSiteScope,filterBySiteScope).Test plan
npm test -w packages/spacecat-shared-utils— 1254 passing, 100% coverage onurl-helpers.jsnpm run lint -w packages/spacecat-shared-utils— clean🤖 Generated with Claude Code