-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Monitoring] Improve permissions required around setup mode #50421
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
Merged
chrisronline
merged 8 commits into
elastic:master
from
chrisronline:monitoring/setup_mode_permissions
Nov 18, 2019
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b3455a0
Add error messages when setup mode is not enabled, disable it for use…
chrisronline 07b43a8
Merge branch 'master' into monitoring/setup_mode_permissions
elasticmachine e1be90f
Fix default value
chrisronline 4970da2
PR feedback
chrisronline 8129fa0
Forgot to update this part
chrisronline 34bc96b
Fix tests
chrisronline 6c064d3
Merge remote-tracking branch 'elastic/master' into monitoring/setup_m…
chrisronline 45a6bca
Merge branch 'master' into monitoring/setup_mode_permissions
elasticmachine 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ | |
| }, | ||
| "_meta": { | ||
| "secondsAgo": 30, | ||
| "liveClusterUuid": null | ||
| "liveClusterUuid": null, | ||
| "hasPermissions": true | ||
| } | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -60,6 +60,7 @@ | |
| }, | ||
| "_meta": { | ||
| "secondsAgo": 30, | ||
| "liveClusterUuid": null | ||
| "liveClusterUuid": null, | ||
| "hasPermissions": true | ||
| } | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ | |
| }, | ||
| "_meta": { | ||
| "secondsAgo": 30, | ||
| "liveClusterUuid": null | ||
| "liveClusterUuid": null, | ||
| "hasPermissions": true | ||
| } | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ | |
| }, | ||
| "_meta": { | ||
| "secondsAgo": 30, | ||
| "liveClusterUuid": null | ||
| "liveClusterUuid": null, | ||
| "hasPermissions": true | ||
| } | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ | |
| }, | ||
| "_meta": { | ||
| "secondsAgo": 30, | ||
| "liveClusterUuid": null | ||
| "liveClusterUuid": null, | ||
| "hasPermissions": true | ||
| } | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -71,6 +71,7 @@ | |
| }, | ||
| "_meta": { | ||
| "secondsAgo": 30, | ||
| "liveClusterUuid": null | ||
| "liveClusterUuid": null, | ||
| "hasPermissions": true | ||
| } | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -71,6 +71,7 @@ | |
| }, | ||
| "_meta": { | ||
| "secondsAgo": 30, | ||
| "liveClusterUuid": null | ||
| "liveClusterUuid": null, | ||
| "hasPermissions": true | ||
| } | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -71,6 +71,7 @@ | |
| }, | ||
| "_meta": { | ||
| "secondsAgo": 30, | ||
| "liveClusterUuid": null | ||
| "liveClusterUuid": null, | ||
| "hasPermissions": true | ||
| } | ||
| } | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -71,6 +71,7 @@ | |
| }, | ||
| "_meta": { | ||
| "secondsAgo": 30, | ||
| "liveClusterUuid": null | ||
| "liveClusterUuid": null, | ||
| "hasPermissions": true | ||
| } | ||
| } | ||
This file contains hidden or 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
60 changes: 60 additions & 0 deletions
60
x-pack/test/api_integration/apis/monitoring/setup/collection/security.js
This file contains hidden or 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,60 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import expect from '@kbn/expect'; | ||
|
|
||
| export default function ({ getService }) { | ||
| const supertest = getService('supertest'); | ||
| const esArchiver = getService('esArchiver'); | ||
| const security = getService('security'); | ||
| const supertestWithoutAuth = getService('supertestWithoutAuth'); | ||
|
|
||
| describe('security', () => { | ||
| const archive = 'monitoring/setup/collection/kibana_exclusive_mb'; | ||
| const timeRange = { | ||
| min: '2019-04-09T00:00:00.741Z', | ||
| max: '2019-04-09T23:59:59.741Z' | ||
| }; | ||
|
|
||
| before('load archive', () => { | ||
| return esArchiver.load(archive); | ||
| }); | ||
|
|
||
| after('unload archive', () => { | ||
| return esArchiver.unload(archive); | ||
| }); | ||
|
|
||
| it('should allow access to elevated user', async () => { | ||
| const { body } = await supertest | ||
| .post('/api/monitoring/v1/setup/collection/cluster?skipLiveData=true') | ||
| .set('kbn-xsrf', 'xxx') | ||
| .send({ timeRange }) | ||
| .expect(200); | ||
|
|
||
| expect(body.hasPermissions).to.not.be(false); | ||
| }); | ||
|
|
||
| it('should say permission denied for limited user', async () => { | ||
| const username = 'limited_user'; | ||
| const password = 'changeme'; | ||
|
|
||
| await security.user.create(username, { | ||
| password: password, | ||
| full_name: 'Limited User', | ||
| roles: ['kibana_user', 'monitoring_user'] | ||
| }); | ||
|
|
||
| const { body } = await supertestWithoutAuth | ||
| .post('/api/monitoring/v1/setup/collection/cluster?skipLiveData=true') | ||
| .auth(username, password) | ||
| .set('kbn-xsrf', 'xxx') | ||
| .send({ timeRange }) | ||
| .expect(200); | ||
|
|
||
| expect(body._meta.hasPermissions).to.be(false); | ||
| }); | ||
| }); | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.