-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[HTTP] First pass of making Kibana work with internal restrictions enforced #162258
Merged
jloleysens
merged 17 commits into
elastic:main
from
jloleysens:default-http-resources-to-public
Jul 26, 2023
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
1edc472
first pass of getting Kibana up and running with internal APIs restri…
jloleysens e0141c9
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 31885b4
fix jest test
jloleysens 12d557a
Merge branch 'main' into default-http-resources-to-public
jloleysens e97d93a
set /api/status to public
jloleysens 261ae49
set /api/stats to public
jloleysens a342b0f
set /api/stats to public
jloleysens 2b6a23f
fix test
jloleysens 2face7f
added test for setting "public" on registerStaticDirs
jloleysens 2c560d2
rename test
jloleysens a6e78b8
added test against translations route options
jloleysens db08571
added test for options against bootstrap.js routes
jloleysens 06861d5
added comments to stats and status routes
jloleysens 7e3d74b
Merge branch 'main' into default-http-resources-to-public
jloleysens f81fe1e
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 6ecb2fc
set access for bevy of known system paths
jloleysens c27062b
Merge branch 'main' into default-http-resources-to-public
jloleysens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/core/i18n/core-i18n-server-internal/src/routes/translations.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { mockRouter } from '@kbn/core-http-router-server-mocks'; | ||
import { registerTranslationsRoute } from './translations'; | ||
|
||
describe('registerTranslationsRoute', () => { | ||
test('registers route with expected options', () => { | ||
const router = mockRouter.create(); | ||
registerTranslationsRoute(router, 'en'); | ||
expect(router.get).toHaveBeenCalledTimes(1); | ||
expect(router.get).toHaveBeenNthCalledWith( | ||
1, | ||
expect.objectContaining({ options: { access: 'public', authRequired: false } }), | ||
expect.any(Function) | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...e/rendering/core-rendering-server-internal/src/bootstrap/register_bootstrap_route.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { registerBootstrapRoute } from './register_bootstrap_route'; | ||
import { mockRouter } from '@kbn/core-http-router-server-mocks'; | ||
|
||
describe('registerBootstrapRoute', () => { | ||
test('register with expected options', () => { | ||
const router = mockRouter.create(); | ||
const renderer = jest.fn(); | ||
registerBootstrapRoute({ router, renderer }); | ||
expect(router.get).toHaveBeenCalledTimes(2); | ||
expect(router.get).toHaveBeenNthCalledWith( | ||
1, | ||
expect.objectContaining({ options: { access: 'public', tags: ['api'] } }), | ||
expect.any(Function) | ||
); | ||
expect(router.get).toHaveBeenNthCalledWith( | ||
2, | ||
expect.objectContaining({ | ||
options: { access: 'public', tags: ['api'], authRequired: 'optional' }, | ||
}), | ||
expect.any(Function) | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,12 +9,14 @@ | |
import _ from 'lodash'; | ||
import { getServices } from './kibana_services'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { X_ELASTIC_INTERNAL_ORIGIN_REQUEST } from '@kbn/core-http-common'; | ||
|
||
const baseUrl = getServices().addBasePath('/api/kibana/home/tutorials'); | ||
const headers = new Headers(); | ||
headers.append('Accept', 'application/json'); | ||
headers.append('Content-Type', 'application/json'); | ||
headers.append('kbn-xsrf', 'kibana'); | ||
headers.append(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana'); | ||
Comment on lines
18
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🙈 I don't even want to know why the home plugin isn't using core's fetch service here... |
||
|
||
let tutorials = []; | ||
let tutorialsLoaded = false; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of Core routes that were (rightfully) switched to
public
aren't listed in the issue's description (e.g this one). Future us would probably be very grateful if we had an exhaustive list somewhere for when we may want to switch some of them back tointernal
(e.g when updating the internal consumers to provide the header)