Skip to content

allow appRoutes to start with the same string as the basePath#67125

Merged
pgayvallet merged 3 commits intoelastic:masterfrom
pgayvallet:kbn-66228-appRoute-basepath
May 25, 2020
Merged

allow appRoutes to start with the same string as the basePath#67125
pgayvallet merged 3 commits intoelastic:masterfrom
pgayvallet:kbn-66228-appRoute-basepath

Conversation

@pgayvallet
Copy link
Copy Markdown
Contributor

Summary

Fix #66228

Because of the BasePath implementation of remove, allowing apps to have an url part matching exactly the basePath could have unexpected behavior, as we are using BasePath.prepend and BasePath.remove to manipulate them internally:

const basePath = new BasePath(`/base-path`);
const appRoute = '/base-path/app';

// dangerous:
basePath.preprend(appRoute); // `/base-path/base-path/app`
basePath.remove(appRoute); // `/app`

However this only occurs when the basePath contained in the appRoute is suffixed with a /. Other cases are actually fine:

const basePath = new BasePath(`/base-path`);
const appRoute = '/base-path-not/app';

basePath.preprend(appRoute); // `/base-path/base-path-not/app`
basePath.remove(appRoute); // `/base-path-not/app`

PR fixes the basePath check when registered apps.

Checklist

@pgayvallet pgayvallet added Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// Feature:New Platform v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.9.0 labels May 20, 2020
@pgayvallet pgayvallet requested a review from a team as a code owner May 20, 2020 16:33
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

History

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

@pgayvallet pgayvallet merged commit b291fa8 into elastic:master May 25, 2020
jloleysens added a commit that referenced this pull request May 26, 2020
…ine-editor

* 'master' of github.com:elastic/kibana: (129 commits)
  [Canvas] Force embeddables to refresh when renderable reevaluated (#67133)
  [Canvas] Better handling navigating to/from canvas (#66407)
  [Ingest pipelines] Fix schema validation for simulate and update routes (#67199)
  do not use es from setup (#67277)
  Auto expand replicas for event log (#67286)
  Observability & APM do not use elasticsearch client provided via setup contract  (#67263)
  Fix privileges check when security is not enabled (#67308)
  add IIS home (#66918)
  [ML] Adding additional job service endpoint tests (#66892)
  [Ingest Manager] Update fleet internal doc with latest flags (#67193)
  [Discover] Deangularize the loading spinner (#67165)
  Add `application.navigateToUrl` core API (#67110)
  Improve indexpattern without timefield functional test (#67031)
  KibanaContext in index pattern managment ui (#66985)
  Fix Azure metrics tutorial inside the App Home/ Add data area (#66901)
  add azure logs home (#66910)
  fix: rum agent should work correctly on new platform (#67037)
  [test_utils/Testbed] Move to src/test_utils folder (OSS) (#66898)
  only block registration when appRoute contains the exact basePath (#67125)
  Changed actions API endpoints urls to follow Kibana STYLEGUIDE (#65936)
  ...

# Conflicts:
#	x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/pipeline_form_fields.tsx
pgayvallet added a commit to pgayvallet/kibana that referenced this pull request Jun 3, 2020
pgayvallet added a commit to pgayvallet/kibana that referenced this pull request Jun 3, 2020
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.9.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't use custom appRoute starting with same string as the basePath

4 participants