Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Support deeper levels of subdomains from RFC 6265 #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

markcatley
Copy link

Closes #25

@@ -211,6 +211,9 @@
it 'should return nil for a root domain' do
expect(CookieValidation.hostname_reach('github.com')).to be_nil
end
it 'should return nil for a two part tld' do
expect(CookieValidation.hostname_reach('co.nz')).to be_nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -211,6 +211,9 @@
it 'should return nil for a root domain' do
expect(CookieValidation.hostname_reach('github.com')).to be_nil
end
it 'should return nil for a two part tld' do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

it 'should not match superdomains, or illegal domains' do
expect(CookieValidation.domains_match('.z.foo.com', 'x.y.z.foo.com')).to be_nil
it 'should not match tlds, or illegal domains' do
expect(CookieValidation.domains_match('.com', 'x.y.z.foo.com')).to be_nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end
it 'should not match superdomains, or illegal domains' do
expect(CookieValidation.domains_match('.z.foo.com', 'x.y.z.foo.com')).to be_nil
it 'should not match tlds, or illegal domains' do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -190,9 +189,10 @@
it 'should handle matching a superdomain' do
expect(CookieValidation.domains_match('.foo.com', 'auth.foo.com')).to eq '.foo.com'
expect(CookieValidation.domains_match('.y.z.foo.com', 'x.y.z.foo.com')).to eq '.y.z.foo.com'
expect(CookieValidation.domains_match('.z.foo.com', 'x.y.z.foo.com')).to eq '.z.foo.com'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [94/80]

@@ -129,6 +124,10 @@
expect(CookieValidation.compute_search_domains('http://zero/')).to eq(
['zero.local', '.zero.local', '.local'])
end
it 'should handle multi-part tlds' do
expect(CookieValidation.compute_search_domains('http://foo.co.nz/')).to eq(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [81/80]

@@ -129,6 +124,10 @@
expect(CookieValidation.compute_search_domains('http://zero/')).to eq(
['zero.local', '.zero.local', '.local'])
end
it 'should handle multi-part tlds' do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -111,7 +106,7 @@
describe '#compute_search_domains' do
it 'should handle subdomains' do
expect(CookieValidation.compute_search_domains('http://www.auth.foo.com/')).to eq(
['www.auth.foo.com', '.www.auth.foo.com', '.auth.foo.com'])
['www.auth.foo.com', '.www.auth.foo.com', '.auth.foo.com', '.foo.com'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Layout/MultilineMethodCallBraceLayout: Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.

@@ -107,7 +108,7 @@ def self.hostname_reach(hostname)
host = to_domain hostname
host = host.downcase
match = BASE_HOSTNAME.match host
match[1] if match
match[1] if match && (PublicSuffix.valid?(match[1]) || match[1] == 'local')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [81/80]

@@ -1,6 +1,7 @@
# frozen_string_literal: true
require 'cgi'
require 'uri'
require 'public_suffix'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@rywall
Copy link

rywall commented Oct 8, 2020

@dwaite Can I do anything to help get this merged?

@michaelwnyc
Copy link

Possible to get this one merged?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support deeper levels of subdomains according to RFC 6265
4 participants