Skip to content

Setting 'server.servlet.session.cookie.partitioned' to false still emits the 'Partitioned' cookie attribute#50781

Merged
bclozel merged 1 commit into
spring-projects:4.0.xfrom
dlwldnjs1009:fix-partitioned-session-cookie-false
Jun 18, 2026
Merged

Setting 'server.servlet.session.cookie.partitioned' to false still emits the 'Partitioned' cookie attribute#50781
bclozel merged 1 commit into
spring-projects:4.0.xfrom
dlwldnjs1009:fix-partitioned-session-cookie-false

Conversation

@dlwldnjs1009

@dlwldnjs1009 dlwldnjs1009 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #50774. This regressed from the partitioned=true fix in #50201. An explicit server.servlet.session.cookie.partitioned=false still emits ; Partitioned, because PropertyMapper.to() only filters null and the lambda set the Partitioned attribute to "" for any non-null value.

Changes

  • ServletContextInitializers uses whenTrue() so the attribute is set only when partitioned is true

Testing

  • AbstractServletWebServerFactoryTests.sessionCookieNotPartitionedAttribute (new, header-level)
  • AbstractServletWebServerFactoryTests.sessionConfiguration (assertion updated to isNull())

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 17, 2026
@philwebb philwebb changed the title Only set Partitioned cookie attribute when true Setting 'server.servlet.session.cookie.partitioned' to false still emits the 'Partitioned' cookie attribute Jun 17, 2026
@philwebb philwebb added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 17, 2026
@philwebb philwebb added this to the 4.0.x milestone Jun 17, 2026
@philwebb

Copy link
Copy Markdown
Member

See #50201

The session cookie's Partitioned attribute was set to "" for any
non-null value, so an explicit `partitioned=false` was rendered the
same as `true`. PropertyMapper.to() only filters null, so
Boolean.FALSE reached the consumer and the attribute was always set.

Use whenTrue() so the attribute is set only when partitioned is true,
leaving false and unset to fall through to the container default.

Closes spring-projectsgh-50781

Signed-off-by: Lee JiWon <dlwldnjs1009@gmail.com>
@bclozel bclozel force-pushed the fix-partitioned-session-cookie-false branch from c335233 to 4b542ef Compare June 18, 2026 14:53
@bclozel bclozel closed this in 4b542ef Jun 18, 2026
@bclozel bclozel merged commit 4b542ef into spring-projects:4.0.x Jun 18, 2026
4 checks passed
@bclozel bclozel modified the milestones: 4.0.x, 4.0.8 Jun 18, 2026
@bclozel bclozel self-assigned this Jun 18, 2026
@bclozel

bclozel commented Jun 18, 2026

Copy link
Copy Markdown
Member

Thanks for your contribution @dlwldnjs1009 !

@dlwldnjs1009 dlwldnjs1009 deleted the fix-partitioned-session-cookie-false branch June 18, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: regression A regression from a previous release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants