Skip to content

Commit

Permalink
[ML] Add security to isKibanaUrl check.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Jul 30, 2020
1 parent ab504a5 commit 1e64ab3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions x-pack/plugins/ml/public/application/util/custom_url_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,20 @@ export function openCustomUrlWindow(url: string, urlConfig: UrlConfig, basePath:
}

// Returns whether the url_value of the supplied config is for
// a Kibana Discover or Dashboard page running on the same server as this ML plugin.
// a Kibana Discover, Dashboard or supported solution page running
// on the same server as this ML plugin. This is necessary so we can have
// backwards compatibility with custom URLs created before the move to
// BrowserRouter and URLs without hashes. If we add another solution to
// recognize modules or with custom UI in the custom URL builder we'd
// need to add the solution here. Manually created custom URLs for other
// solution pages need to be prefixed with `app/` in the custom URL builder.
function isKibanaUrl(urlConfig: UrlConfig) {
const urlValue = urlConfig.url_value;
return (
urlValue.startsWith('discover#/') ||
urlValue.startsWith('dashboards#/') ||
urlValue.startsWith('apm#/')
urlValue.startsWith('apm#/') ||
urlValue.startsWith('security#/')
);
}

Expand Down

0 comments on commit 1e64ab3

Please sign in to comment.