Skip to content

Commit 5f9cfa0

Browse files
elena-shostakfkanout
authored andcommitted
[chore]: refactored CHIPS support configuration (elastic#231472)
## Summary Since direct option for partitioned cookie configuration has been merged as part of hapijs/statehood#88. Cleaning up old code. __Closes: https://github.com/elastic/kibana/issues/188720__
1 parent 9272a94 commit 5f9cfa0

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)