Skip to content

Commit

Permalink
Fix #9334 Cookie Compliance
Browse files Browse the repository at this point in the history
Fix incorrect change to RFC6265 to not support dollars in cookie names.
Included updates and tests from #9399

Signed-off-by: gregw <gregw@webtide.com>
  • Loading branch information
gregw committed Feb 21, 2023
1 parent 78c9074 commit 79bba38
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void testRFC2965Single()
// There are 2 attributes, so 2 violations.
assertThat(parser.violations.size(), is(2));

// Same test with RFC 6265.
// Same test with RFC6265.
parser = new TestCookieParser(CookieCompliance.RFC6265);
cookies = parser.parseFields(rawCookie);
assertThat("Cookies.length", cookies.size(), is(3));
Expand All @@ -54,6 +54,24 @@ public void testRFC2965Single()
// There attributes are seen as just normal cookies, so no violations
assertThat(parser.violations.size(), is(0));

// Same again, but allow attributes which are ignored
parser = new TestCookieParser(CookieCompliance.from("RFC6265,ATTRIBUTES"));
cookies = parser.parseFields(rawCookie);
assertThat("Cookies.length", cookies.size(), is(1));
assertCookie("Cookies[0]", cookies.get(0), "Customer", "WILE_E_COYOTE", 0, null);

// There attributes are seen as just normal cookies, so no violations
assertThat(parser.violations.size(), is(2));

// Same again, but allow attributes which are not ignored
parser = new TestCookieParser(CookieCompliance.from("RFC6265,ATTRIBUTE_VALUES"));
cookies = parser.parseFields(rawCookie);
assertThat("Cookies.length", cookies.size(), is(1));
assertCookie("Cookies[0]", cookies.get(0), "Customer", "WILE_E_COYOTE", 1, "/acme");

// There attributes are seen as just normal cookies, so no violations
assertThat(parser.violations.size(), is(2));

// Same test with RFC 6265 strict should throw.
parser = new TestCookieParser(CookieCompliance.RFC6265_STRICT);
cookies = parser.parseFields(rawCookie);
Expand Down

0 comments on commit 79bba38

Please sign in to comment.