Skip to content

[BUGFIX] keep origin as authority in replacePath#21497

Closed
ubeddulla wants to merge 1 commit into
emberjs:mainfrom
ubeddulla:replacepath-origin-authority
Closed

[BUGFIX] keep origin as authority in replacePath#21497
ubeddulla wants to merge 1 commit into
emberjs:mainfrom
ubeddulla:replacepath-origin-authority

Conversation

@ubeddulla

Copy link
Copy Markdown
Contributor

replacepath in @ember/routing lib documents that it prepends location.origin to prevent redirecting to a different origin, and util_test asserts exactly that, but it joins path onto the origin with no separator. a path that does not start with a slash gets reparsed into the authority: origin http://app.com plus @evil.com becomes http://app.com@evil.com, so the app's own host turns into userinfo and evil.com becomes the host. the existing test only exercises //google.com, which stays same-origin and hides this. forcing a leading slash before the concat keeps the origin as the authority for every input, and the test now covers the @ case too.

@NullVoxPopuli

Copy link
Copy Markdown
Contributor

thank you for your PR!

However, this function is both private, and only used in tests, so I've removed it here: #21499

thanks for finding this!

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.

2 participants