Skip to content

[Fleet] Enforce superuser role for all fleet APIs#85136

Merged
nchaulet merged 6 commits intoelastic:masterfrom
nchaulet:feature-fleet-check-superuser-api
Dec 8, 2020
Merged

[Fleet] Enforce superuser role for all fleet APIs#85136
nchaulet merged 6 commits intoelastic:masterfrom
nchaulet:feature-fleet-check-superuser-api

Conversation

@nchaulet
Copy link
Copy Markdown
Member

@nchaulet nchaulet commented Dec 7, 2020

Summary

Enforce that all the request to the Fleet APIs are using the superuser role in addition of the Kibana privileges

Working on adding some tests

@nchaulet nchaulet added v8.0.0 Team:Fleet Team label for Observability Data Collection Fleet team v7.11.0 labels Dec 7, 2020
@nchaulet nchaulet self-assigned this Dec 7, 2020
@nchaulet nchaulet requested a review from a team December 7, 2020 14:02
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@nchaulet nchaulet added the release_note:skip Skip the PR/issue when compiling release notes label Dec 7, 2020
// since it would run this func on *every* req (other plugins, CSS, etc)
registerLimitedConcurrencyRoutes(core, config);
registerAgentRoutes(router, config);
registerEnrollmentApiKeyRoutes(router);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not clear why registerAgentRoutes doesn't also use the new router. Can you add a comment in the code about why it's different from the code around it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I will add a comment 👍 in the agent routes we mix API routes to manage agents from Kibana that need to be called as superuser and route for the Elastic agent, we should probably split them in two functions

@nchaulet
Copy link
Copy Markdown
Member Author

nchaulet commented Dec 8, 2020

@jfsiii I updated my PR to split the agent routes in two function, api routes and Elastic Agent routes let me know if it makes more sense.

@jfsiii jfsiii self-requested a review December 8, 2020 15:00
Copy link
Copy Markdown
Contributor

@jfsiii jfsiii left a comment

Choose a reason for hiding this comment

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

🚢 I haven't run it locally, but 👍 The code is clear, extends the existing approach, and is applied to all handlers in a file.

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Distributable file count

id before after diff
default 46960 47721 +761

History

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

@nchaulet nchaulet merged commit 943bce1 into elastic:master Dec 8, 2020
@nchaulet nchaulet deleted the feature-fleet-check-superuser-api branch December 8, 2020 22:22
nchaulet added a commit to nchaulet/kibana that referenced this pull request Dec 8, 2020
@nchaulet nchaulet added bug Fixes for quality problems that affect the customer experience v7.10.0 labels Dec 10, 2020
nchaulet added a commit to nchaulet/kibana that referenced this pull request Dec 10, 2020
# Conflicts:
#	x-pack/plugins/fleet/server/plugin.ts
#	x-pack/plugins/fleet/server/routes/agent/index.ts
#	x-pack/plugins/ingest_manager/server/routes/security.ts
#	x-pack/test/fleet_api_integration/apis/agents/acks.ts
#	x-pack/test/fleet_api_integration/apis/agents/delete.ts
#	x-pack/test/fleet_api_integration/apis/agents/list.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.10.0 v7.11.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants