Skip to content

fix: reject invalid URL matches - #117

Merged
vladimirvolek merged 1 commit into
mainfrom
fix/invalid-url-matches
Sep 8, 2026
Merged

vladimirvolek merged 1 commit into
mainfrom
fix/invalid-url-matches

Conversation

@michalrus

Copy link
Copy Markdown
Member

Follow up to:

Implementation

  • Route resolution preserves empty path segments.
  • An exact match requires a URL that resolves to an OpenAPI route.

Follow up to:
- #115

- Route resolution preserves empty path segments.
- An exact match requires a URL that resolves to an OpenAPI route.
@michalrus
michalrus requested review from slowbackspace and vladimirvolek and a lite review from Copilot September 8, 2026 12:23
@michalrus michalrus self-assigned this Sep 8, 2026
@michalrus michalrus added the bug Something isn't working label Sep 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

One existing test expectation (isUrlMatch('', '') === true) appears inconsistent with the PR’s stated new semantics and is likely to fail unless the OpenAPI spec defines a root / path.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR tightens URL allowlist matching by requiring that an “exact” URL match is only accepted when the URL can be resolved to a known OpenAPI route, and by ensuring route resolution does not collapse empty path segments (e.g., //).

Changes:

  • Preserve empty path segments during route segmentation to prevent accidental matches when URLs contain //.
  • Require a URL to resolve to an OpenAPI route before allowing an exact-match return path in isUrlMatch.
  • Add unit coverage for rejecting exact matches on unknown endpoints and for rejecting URLs with empty path segments.
File summaries
File Description
unit/index.test.ts Adds coverage for rejecting unknown endpoints and URLs containing empty path segments.
src/index.ts Updates URL segmentation and matching to preserve empty segments and require successful OpenAPI route resolution for exact matches.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread unit/index.test.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are small, well-covered by targeted unit tests, and align with the stated matching semantics without introducing observable regressions in the reviewed code paths.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@vladimirvolek
vladimirvolek merged commit 82641f9 into main Sep 8, 2026
4 checks passed
@michalrus
michalrus deleted the fix/invalid-url-matches branch September 8, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants