Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle mupltiple cookies sent from a browser #39431

Conversation

mshustov
Copy link
Contributor

Summary

Support a case for ScopedCookieSessionStorage when browser sends multiple cookies with the same name.
based on the current implementation https://github.com/restrry/kibana/blob/e4f538df0a048b469eb1189c34484cf8699944a6/x-pack/legacy/plugins/security/server/lib/authentication/session.ts#L59

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@mshustov mshustov added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:New Platform release_note:skip Skip the PR/issue when compiling release notes v7.3.0 labels Jun 21, 2019
@mshustov mshustov requested a review from a team as a code owner June 21, 2019 12:14
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@joshdover joshdover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

public async get(): Promise<T | null> {
try {
return await this.server.auth.test('security-cookie', this.request as Request);
const session = await this.server.auth.test('security-cookie', this.request);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this string be pulled from a shared constant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think so.

  1. Strategy name is declared in the same file:
    server.auth.strategy('security-cookie', 'cookie', {

    This knowledge shouldn't leak outside.
  2. I believe that shared constant won't exist in the New platform. They are always a part of a domain and should be passed accordingly, with declaring direct dependencies.

@@ -221,6 +223,7 @@ export class HttpServer {
this.authRegistered = true;

const sessionStorageFactory = await createCookieSessionStorageFactory<T>(
this.logger.get('http', 'server', this.name, 'cookie-session-storage'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be kinda nice if the Logger interface had a get function for creating sub-loggers:

const httpLog = loggerFactory.get('http', 'server')
const cookieSessionStorageLog = httpLog.get('cookie-session-storage')

But that's a change for another day...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also was surprised that Logger doesn't provide this functionality. Created issue #39695

@elasticmachine
Copy link
Contributor

💔 Build Failed

@mshustov
Copy link
Contributor Author

retest

@elasticmachine
Copy link
Contributor

💔 Build Failed

@mshustov
Copy link
Contributor Author

retest

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@mshustov mshustov merged commit 2c8bbde into elastic:master Jun 27, 2019
@mshustov mshustov deleted the issue-33775-handle-multiple-cookies-session-storage branch June 27, 2019 06:40
mshustov added a commit to mshustov/kibana that referenced this pull request Jun 27, 2019
@mshustov mshustov removed the review label Jun 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:New Platform release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants