Skip to content

handle mupltiple cookies sent from a browser#39431

Merged
mshustov merged 3 commits intoelastic:masterfrom
mshustov:issue-33775-handle-multiple-cookies-session-storage
Jun 27, 2019
Merged

handle mupltiple cookies sent from a browser#39431
mshustov merged 3 commits intoelastic:masterfrom
mshustov:issue-33775-handle-multiple-cookies-session-storage

Conversation

@mshustov
Copy link
Copy Markdown
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 Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// 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
Copy Markdown
Contributor

Pinging @elastic/kibana-platform

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

this.authRegistered = true;

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

💔 Build Failed

@mshustov
Copy link
Copy Markdown
Contributor Author

retest

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@mshustov
Copy link
Copy Markdown
Contributor Author

retest

@elasticmachine
Copy link
Copy Markdown
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 Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// v7.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants