Skip to content

Commit 0c4c13d

Browse files
[9.1] [chore]: refactored CHIPS support configuration (elastic#231472) (elastic#231601)
# Backport This will backport the following commits from `main` to `9.1`: - [[chore]: refactored CHIPS support configuration (elastic#231472)](elastic#231472) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Elena Shostak","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-08-13T11:00:38Z","message":"[chore]: refactored CHIPS support configuration (elastic#231472)\n\n## Summary\n\nSince direct option for partitioned cookie configuration has been merged\nas part of hapijs/statehood#88. Cleaning up old\ncode.\n\n__Closes: https://github.com/elastic/kibana/issues/188720__","sha":"da5981ebb938a9094fe3f8a5ef58b6114b348925","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["chore","Team:Security","release_note:skip","Feature:Security/Session Management","backport:current-major","v9.2.0"],"title":"[chore]: refactored CHIPS support configuration","number":231472,"url":"https://github.com/elastic/kibana/pull/231472","mergeCommit":{"message":"[chore]: refactored CHIPS support configuration (elastic#231472)\n\n## Summary\n\nSince direct option for partitioned cookie configuration has been merged\nas part of hapijs/statehood#88. Cleaning up old\ncode.\n\n__Closes: https://github.com/elastic/kibana/issues/188720__","sha":"da5981ebb938a9094fe3f8a5ef58b6114b348925"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/231472","number":231472,"mergeCommit":{"message":"[chore]: refactored CHIPS support configuration (elastic#231472)\n\n## Summary\n\nSince direct option for partitioned cookie configuration has been merged\nas part of hapijs/statehood#88. Cleaning up old\ncode.\n\n__Closes: https://github.com/elastic/kibana/issues/188720__","sha":"da5981ebb938a9094fe3f8a5ef58b6114b348925"}}]}] BACKPORT--> Co-authored-by: Elena Shostak <[email protected]>
1 parent 9a2f07c commit 0c4c13d

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

src/core/packages/http/server-internal/src/cookie_session_storage.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import { Request, Server, ServerStateCookieOptions } from '@hapi/hapi';
10+
import { Request, Server } from '@hapi/hapi';
1111
import hapiAuthCookie from '@hapi/cookie';
1212

1313
import type { Logger } from '@kbn/logging';
@@ -126,22 +126,8 @@ export async function createCookieSessionStorageFactory<T extends object>(
126126
clearInvalid: false,
127127
isHttpOnly: true,
128128
isSameSite: cookieOptions.sameSite ?? false,
129-
contextualize: (
130-
definition: Omit<ServerStateCookieOptions, 'isSameSite'> & { isSameSite: string }
131-
) => {
132-
/**
133-
* This is a temporary solution to support the Partitioned attribute.
134-
* Statehood performs validation for the params, but only before the contextualize function call.
135-
* Since value for the isSameSite is used directly when making segment,
136-
* we can leverage that to append the Partitioned attribute to the cookie.
137-
*
138-
* Once statehood is updated to support the Partitioned attribute, we can remove this.
139-
* Issue: https://github.com/elastic/kibana/issues/188720
140-
*/
141-
if (definition.isSameSite === 'None' && definition.isSecure && !disableEmbedding) {
142-
definition.isSameSite = 'None;Partitioned';
143-
}
144-
},
129+
isPartitioned:
130+
cookieOptions.sameSite === 'None' && cookieOptions.isSecure && !disableEmbedding,
145131
},
146132
validate: async (req: Request, session: T | T[]) => {
147133
const result = cookieOptions.validate(session);

0 commit comments

Comments
 (0)