You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2025/10/01 09:36:04 UTC

[Bug 69836] New: usePartitioned="true" in context.xml does not result in the Partitioned flag being added to session cookies

https://bz.apache.org/bugzilla/show_bug.cgi?id=69836

            Bug ID: 69836
           Summary: usePartitioned="true" in context.xml does not result
                    in the Partitioned flag being added to session cookies
           Product: Tomcat 11
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: Util
          Assignee: dev@tomcat.apache.org
          Reporter: marc.pynaert@probance.com
  Target Milestone: -------

# Steps to Reproduce
Configure `context.xml` with:
```
<Context usePartitioned="true">
  <CookieProcessor sameSiteCookies="none" partitioned="true" />
</Context>
```

Start Tomcat and inspect the `JSESSIONID` cookie.

# Observed Behavior
The JSESSIONID cookie does not include the Partitioned attribute.

# Expected Behavior
When `usePartitioned="true"`, the JSESSIONID cookie should include `;
Partitioned`.

# Root Cause Analysis
In Rfc6265CookieProcessor (line ~182):
```
String cookiePartitioned =
cookie.getAttribute(Constants.COOKIE_PARTITIONED_ATTR);
if (cookiePartitioned == null) {
    if (getPartitioned()) {
        header.append("; Partitioned");
    }
} else {
    if (EMPTY_STRING.equals(cookiePartitioned)) {
        header.append("; Partitioned");
    }
}
```

However, the attribute is set as:
```
cookie.setAttribute(Constants.COOKIE_PARTITIONED_ATTR,
Boolean.toString(context.getUsePartitioned()));
```

This means `cookiePartitioned` is always "true" or "false", never null or
empty.
As a result, the `Partitioned` flag is never appended.

# Proposed Fix
Update the condition to also handle "true" values:
```
String cookiePartitioned =
cookie.getAttribute(Constants.COOKIE_PARTITIONED_ATTR);
if (cookiePartitioned == null) {
    if (getPartitioned()) {
        header.append("; Partitioned");
    }
} else {
    if (EMPTY_STRING.equals(cookiePartitioned) ||
Boolean.parseBoolean(cookiePartitioned)) {
        header.append("; Partitioned");
    }
}
```

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 69836] usePartitioned="true" in context.xml does not result in the Partitioned flag being added to session cookies

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69836

Marc <ma...@probance.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
           Hardware|PC                          |All

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 69836] usePartitioned="true" in context.xml does not result in the Partitioned flag being added to session cookies

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69836

Marc <ma...@probance.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |11.0.10

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 69836] usePartitioned="true" in context.xml does not result in the Partitioned flag being added to session cookies

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69836

Remy Maucherat <re...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #1 from Remy Maucherat <re...@apache.org> ---
A change was made to the Constants.COOKIE_PARTITIONED_ATTR value but not
replicated in the cookie processor. The fix will be in 11.0.13.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org