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

ExecutionContext: encode all context fields when converting to header #125783

Merged
merged 4 commits into from
Feb 17, 2022

Conversation

pgayvallet
Copy link
Contributor

@pgayvallet pgayvallet commented Feb 16, 2022

Summary

Fix #125700

  • Encode all of the context's fields when converting to its x-opaque-id value
  • Get back to using the name of the vis when creating context instead of title

Checklist

@pgayvallet pgayvallet added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc release_note:skip Skip the PR/issue when compiling release notes v8.0.1 v8.1.0 v8.2.0 bug Fixes for quality problems that affect the customer experience labels Feb 16, 2022
@pgayvallet pgayvallet force-pushed the kbn-125700-utf8-execution-context branch from 515e421 to 8a27a19 Compare February 16, 2022 13:16
@pgayvallet pgayvallet added the auto-backport Deprecated - use backport:version if exact versions are needed label Feb 16, 2022
@@ -50,18 +50,23 @@ export interface IExecutionContextContainer {
}

function stringify(ctx: KibanaExecutionContext): string {
const stringifiedCtx = `${ctx.type}:${ctx.name}:${encodeURIComponent(ctx.id!)}`;
const stringifiedCtx = `${encodeURIComponent(ctx.type)}:${encodeURIComponent(
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not strictly necessary to encode type and name since Kibana controls their value. We can even add a runtime validation. OTOH, it doesn't hurt and adds some extra safety.

Copy link
Contributor Author

@pgayvallet pgayvallet Feb 16, 2022

Choose a reason for hiding this comment

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

since Kibana controls their value

Can't any arbitrary consumer just call core.executionContext.withContext({...someContext, name: '☺☺☺'}, () => { ... }) ? At least on the server-side?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can. That's why I mentioned a runtime validation. But as said, let's keep it as additional protection.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
visualizations 157.2KB 157.2KB -1.0B

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@pgayvallet pgayvallet marked this pull request as ready for review February 16, 2022 20:43
@pgayvallet pgayvallet requested review from a team as code owners February 16, 2022 20:43
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

VisEditors changes LGTM

@pgayvallet pgayvallet merged commit d047765 into elastic:main Feb 17, 2022
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 17, 2022
…elastic#125783)

* ExecutionContext: encode all context fields when converting to header value

* switch back to using the vis type name instead of title for the execution context name

* adapt FTR tests

* fix server-side tests too

(cherry picked from commit d047765)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 17, 2022
…elastic#125783)

* ExecutionContext: encode all context fields when converting to header value

* switch back to using the vis type name instead of title for the execution context name

* adapt FTR tests

* fix server-side tests too

(cherry picked from commit d047765)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.1
8.0

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Feb 17, 2022
…#125783) (#125924)

* ExecutionContext: encode all context fields when converting to header value

* switch back to using the vis type name instead of title for the execution context name

* adapt FTR tests

* fix server-side tests too

(cherry picked from commit d047765)

Co-authored-by: Pierre Gayvallet <pierre.gayvallet@elastic.co>
kibanamachine added a commit that referenced this pull request Feb 17, 2022
…#125783) (#125925)

* ExecutionContext: encode all context fields when converting to header value

* switch back to using the vis type name instead of title for the execution context name

* adapt FTR tests

* fix server-side tests too

(cherry picked from commit d047765)

Co-authored-by: Pierre Gayvallet <pierre.gayvallet@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed bug Fixes for quality problems that affect the customer experience 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 v8.0.1 v8.1.0 v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some of the dashboard panels are broken and display error when localization setting is turned on
6 participants