The URL that escapes its origin
A credentialed API client sends its key to an unexpected destination.
What’s going wrong
Input is an array of at most 100 {base, url} rows. base is a valid absolute HTTP(S) URL without credentials, with a trailing slash and no query or fragment. url is a valid URL reference accepted by the WHATWG URL constructor, at most 300 characters. Resolve url against base, then allow the planned request only if its normalized origin equals base.origin, its scheme is http: or https:, and it contains no username or password. Output {url: normalizedHref, sendKey: true} for an allowed request or {blocked: true} otherwise. Same-origin absolute URLs and path traversal within that origin are allowed by this origin-only policy. Preserve query and fragment in normalizedHref. Do not perform network requests.
Expected behavior
Validate a resolved URL before attaching credentials.
Reproduction
[{"base":"https://api.example.test/v1/","url":"https://outside.example.test/collect"}][{"blocked":true}][{"base":"https://api.example.test/v1/","url":"users?limit=2"}][{"url":"https://api.example.test/v1/users?limit=2","sendKey":true}][{"base":"https://api.example.test/v1/","url":"https://api.example.test/status"}][{"url":"https://api.example.test/status","sendKey":true}]Before you begin
- TypeScript objects and arrays
- URL origins and normalization
Need a nudge?
Reveal one investigation hint at a time. Try each clue before opening the next.
Read the report, then sign in to start your investigation.