short url: ensure absolute path isn't persisted#6581
Merged
epixa merged 5 commits intoelastic:masterfrom Mar 22, 2016
Merged
Conversation
Contributor
There was a problem hiding this comment.
would like to see a test with urls that have basepaths, query strings, no hash, etc.
Contributor
|
Can we add some validation server side? |
Contributor
There was a problem hiding this comment.
I suggest using url.format()
Contributor
Author
|
jenkins, test it |
1 similar comment
Contributor
Author
|
jenkins, test it |
Contributor
|
LGTM |
Contributor
|
LGTM |
epixa
added a commit
that referenced
this pull request
Mar 22, 2016
short url: ensure absolute path isn't persisted
This was referenced Mar 22, 2016
epixa
added a commit
that referenced
this pull request
Mar 22, 2016
[Commit 1] short url: ensure absolute path isn't persisted Original sha: a8c1305 Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-18T20:02:53Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 2] [short url] use url.format when creating /goto link Original sha: 2a71673 Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T14:09:04Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 3] [short url] Add tests for query strings, no hashes Original sha: 690a140 Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T14:42:10Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 4] [short url] Cleanup Original sha: 49d297f Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:09:35Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 5] [short url] Add server tests Original sha: a612a0e Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:30:12Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T18:12:25Z
epixa
added a commit
that referenced
this pull request
Mar 22, 2016
[Commit 1] short url: ensure absolute path isn't persisted Original sha: a8c1305 Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-18T20:02:53Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 2] [short url] use url.format when creating /goto link Original sha: 2a71673 Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T14:09:04Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 3] [short url] Add tests for query strings, no hashes Original sha: 690a140 Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T14:42:10Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 4] [short url] Cleanup Original sha: 49d297f Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:09:35Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 5] [short url] Add server tests Original sha: a612a0e Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:30:12Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T18:12:25Z
epixa
added a commit
that referenced
this pull request
Mar 22, 2016
[Commit 1] short url: ensure absolute path isn't persisted Original sha: a8c1305 Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-18T20:02:53Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 2] [short url] use url.format when creating /goto link Original sha: 2a71673 Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T14:09:04Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 3] [short url] Add tests for query strings, no hashes Original sha: 690a140 Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T14:42:10Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 4] [short url] Cleanup Original sha: 49d297f Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:09:35Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 5] [short url] Add server tests Original sha: a612a0e Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:30:12Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T18:12:25Z
epixa
added a commit
that referenced
this pull request
Mar 22, 2016
…/6127 [backport] PR #6581 to 4.x
jbudz
pushed a commit
that referenced
this pull request
Mar 22, 2016
[Commit 1] short url: ensure absolute path isn't persisted Original sha: a8c1305 Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-18T20:02:53Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 2] [short url] use url.format when creating /goto link Original sha: 2a71673 Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T14:09:04Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 3] [short url] Add tests for query strings, no hashes Original sha: 690a140 Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T14:42:10Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 4] [short url] Cleanup Original sha: 49d297f Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:09:35Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:57:16Z [Commit 5] [short url] Add server tests Original sha: a612a0e Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T15:30:12Z Committed by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-21T18:12:25Z
epixa
added a commit
that referenced
this pull request
Mar 22, 2016
…/6127 [backport] PR #6581 to 4.5
epixa
added a commit
that referenced
this pull request
Mar 22, 2016
…es/6127 [backport] PR #6581 to 4.5.0
epixa
added a commit
that referenced
this pull request
Mar 22, 2016
…/6127 [backport] PR #6581 to 4.4
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.
The /shorten relative url was calculated by combing protocol, host, port, base url and removing the match from an absolute url. In cases when port was set to 443 or 80, the absolute url may not contain port causing the match to fail and resulting in absolute urls being persisted.
Instead of matching and removing, this parses the absolute url passed and constructs a relative url from the parts.
I changed shortenUrl to return an angular promise - I wasn't able to get past await when using $httpBackend to mock test responses.
Fixes #6127, although this is a different bug than the original issue.