-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix Cookie processing problem related to applications running on 'localhost' with non-default port
(close #1491)
#1563
Conversation
✅ Tests for the commit fd561c4 have passed. See details: |
src/utils/url.js
Outdated
@@ -20,6 +20,8 @@ export const REQUEST_DESCRIPTOR_VALUES_SEPARATOR = '!'; | |||
export const TRAILING_SLASH_RE = /\/$/; | |||
export const SPECIAL_PAGES = ['about:blank', 'about:error']; | |||
|
|||
export const DEFAULT_PORT = ':80'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't duplicate constants.
Create a shared function omitDefaultPort ()
and use it on client and server.
Use implementation from server side -
_omitDefaultPort (dest) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests for http
and https
protocol values.
@@ -31,6 +31,9 @@ export function sameOriginCheck (location, checkedUrl, rejectForSubdomains) { | |||
if (checkedUrl) | |||
checkedUrl = resolveUrl(checkedUrl); | |||
|
|||
// NOTE: exclude the default port from 'same origin check' | |||
location = location.replace(sharedUrlUtils.DEFAULT_PORT, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should omit default port inside sameOriginCheck
function.
✅ Tests for the commit b10589e have passed. See details: |
✅ Tests for the commit 277ea66 have passed. See details: |
❌ Tests for the commit acb0a72 have failed. See details: |
❌ Tests for the commit d111874 have failed. See details: |
@testcafe-build-bot \retest |
✅ Tests for the commit d111874 have passed. See details: |
✅ Tests for the commit 3e9900e have passed. See details: |
Cookie processing problem related to applications running on 'localhost' with non-default port
(close #1491)Cookie processing problem related to applications running on 'localhost' with non-default port
(close #1491)
❌ Tests for the commit e4dce4b have failed. See details: |
❌ Tests for the commit b86b5a6 have failed. See details: |
@testcafe-build-bot \retest |
✅ Tests for the commit b86b5a6 have passed. See details: |
❌ Tests for the commit 9066365 have failed. See details: |
@testcafe-build-bot \retest |
✅ Tests for the commit 9066365 have passed. See details: |
✅ Tests for the commit 4b11e7f have passed. See details: |
…calhost' with non-default port`
✅ Tests for the commit b62488c have passed. See details: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor changes
src/session/cookies.js
Outdated
import BYTES_PER_COOKIE_LIMIT from './cookie-limit'; | ||
import { castArray } from 'lodash'; | ||
import { parseUrl } from '../utils/url'; | ||
|
||
const LOCALHOST_NAME = 'localhost'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const LOCALHOST_DOMAIN = ...
src/session/cookies.js
Outdated
// NOTE: If cookie.domain and url hostname are equal to localhost/127.0.0.1, | ||
// we should remove 'Domain=...' form cookieStr (GH-1491) | ||
if (cookie && cookie.domain) { | ||
const isCookieDomainLocalhost = cookie.domain === LOCALHOST_NAME || cookie.domain === LOCALHOST_IP; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to separate function _hasLocalhostDomain (cookie)
❌ Tests for the commit 6cb421c have failed. See details: |
@testcafe-build-bot \retest |
✅ Tests for the commit 6cb421c have passed. See details: |
…calhost' with non-default port` (close DevExpress#1491) (DevExpress#1563) * fix `Cookie processing problem related to applications running on 'localhost' with non-default port` * refactor default port omitting * fix omitDefaultPort * localhost/127.0.0.1 case * non-default localhost/127.0.0.1 (http) case * add location test for default port omitting * requested changes * rename test function * add tests * rename tests * requested changes
Example
#1491
Changes:
_isValidCookie()
instead of same origin checkReference:
#659