-
Notifications
You must be signed in to change notification settings - Fork 69
Add same_site attribute and tests #30
base: master
Are you sure you want to change the base?
Conversation
@@ -74,6 +74,10 @@ | |||
higher = Cookie.from_set_cookie 'http://foo.com/bar/baz/', 'foo=bar;path=/bar/' | |||
CookieValidation.validate_cookie('http://foo.com/bar/baz/', higher) | |||
end | |||
it 'should accept SameSite attribute' do | |||
cookie = Cookie.from_set_cookie 'http://127.0.0.1/', 'foo=bar;samesite=strict' | |||
expect(CookieValidation.validate_cookie('http://127.0.0.1/', cookie)).to be_truthy |
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.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [88/80]
@@ -74,6 +74,10 @@ | |||
higher = Cookie.from_set_cookie 'http://foo.com/bar/baz/', 'foo=bar;path=/bar/' | |||
CookieValidation.validate_cookie('http://foo.com/bar/baz/', higher) | |||
end | |||
it 'should accept SameSite attribute' do | |||
cookie = Cookie.from_set_cookie 'http://127.0.0.1/', 'foo=bar;samesite=strict' |
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.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [84/80]
@@ -74,6 +74,10 @@ | |||
higher = Cookie.from_set_cookie 'http://foo.com/bar/baz/', 'foo=bar;path=/bar/' | |||
CookieValidation.validate_cookie('http://foo.com/bar/baz/', higher) | |||
end | |||
it 'should accept SameSite attribute' do |
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.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -43,6 +43,10 @@ | |||
expect(cookie.name).to eq 'GALX' | |||
expect(cookie.secure).to be_truthy | |||
end | |||
it 'should accept SameSite attribute' do | |||
cookie = Cookie.from_set_cookie 'https://www.google.com/a/blah', 'GALX=RgmSftjnbPM;samesite=strict' | |||
expect(cookie.same_site).to eq 'strict' |
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.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -43,6 +43,10 @@ | |||
expect(cookie.name).to eq 'GALX' | |||
expect(cookie.secure).to be_truthy | |||
end | |||
it 'should accept SameSite attribute' do | |||
cookie = Cookie.from_set_cookie 'https://www.google.com/a/blah', 'GALX=RgmSftjnbPM;samesite=strict' |
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.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [105/80]
@@ -43,6 +43,10 @@ | |||
expect(cookie.name).to eq 'GALX' | |||
expect(cookie.secure).to be_truthy | |||
end | |||
it 'should accept SameSite attribute' do |
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.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
The commit adb79c0 has as its message "add support for samesite cookie". It actually only makes the validator recognize the samesite attribute, but does not expose the value via the cookie object and does not add any tests.
This PR adds the same_site attribute (note that the instance variable name was changed to
@same_site
from@samesite
to be consistent with http_only/httponly) and adds tests.