Skip to content

fix(wujie): add boundary check for URL rewrite to prevent path escape - #270

Merged
Gaubee merged 1 commit into
mainfrom
fix/wujie-url-rewrite-v3
Jan 21, 2026
Merged

Gaubee merged 1 commit into
mainfrom
fix/wujie-url-rewrite-v3

Conversation

@Gaubee

@Gaubee Gaubee commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

Problem

When a request's origin matches the target origin but the path is outside the target base path, it could cause path escape issues.

Fix

Added boundary check:

if (normalized.origin === targetBase.origin && normalized.href.startsWith(targetBaseHref) === false) {
  normalized = new URL(normalized.href.replace(normalized.origin, ''), PLACEHOLDER_ORIGIN);
}

This ensures requests that would escape the miniapp's base path are properly rewritten back.

@Gaubee
Gaubee merged commit 3692b54 into main Jan 21, 2026
5 checks passed
@Gaubee
Gaubee deleted the fix/wujie-url-rewrite-v3 branch January 21, 2026 10:47
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