Skip to content

[Fleet] Adjust privileges for GET output and GET download_source endpoints#194951

Merged
criamico merged 7 commits intoelastic:mainfrom
criamico:191266_rbac_endpoints
Oct 8, 2024
Merged

[Fleet] Adjust privileges for GET output and GET download_source endpoints#194951
criamico merged 7 commits intoelastic:mainfrom
criamico:191266_rbac_endpoints

Conversation

@criamico
Copy link
Copy Markdown
Member

@criamico criamico commented Oct 4, 2024

Fixes #191266

Summary

Updating the authz for following endpoints:

  • GET /agent_download_sources
  • GET /agent_download_sources/{id}
  • GET /outputs
  • GET /outputs/{id}
    They need to have authz.fleet.readSettings || authz.fleet.readAgentPolicies as they should be visible in the agent policy settings page as well.

Testing

  • Enable feature flag subfeaturePrivileges
  • Create a role with following privileges:
    Screenshot 2024-10-04 at 15 49 54
  • Create a user that has the previous role
  • Log in and go to any agent policy > settings
  • The download source and output fields should be filled and editable. They were previously empty, as the GET endpoints were failing with 403 Forbidden

Checklist

@criamico criamico self-assigned this Oct 4, 2024
@criamico criamico added release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team backport:version Backport to applied version labels v8.16.0 labels Oct 4, 2024
@criamico criamico marked this pull request as ready for review October 4, 2024 13:56
@criamico criamico requested a review from a team as a code owner October 4, 2024 13:56
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/fleet (Team:Fleet)

@criamico
Copy link
Copy Markdown
Member Author

criamico commented Oct 4, 2024

@elasticmachine merge upstream

@criamico
Copy link
Copy Markdown
Member Author

criamico commented Oct 7, 2024

@elasticmachine merge upstream

@criamico
Copy link
Copy Markdown
Member Author

criamico commented Oct 7, 2024

@elasticmachine merge upstream

@kibana-ci
Copy link
Copy Markdown

kibana-ci commented Oct 7, 2024

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #104 / Fleet Endpoints fleet_settings_privileges (Outputs, FleetServerHosts, Proxies, ...) GET /api/fleet/outputs should return a 403 for user: fleet_agent_policies_all_only
  • [job] [logs] FTR Configs #104 / Fleet Endpoints fleet_settings_privileges (Outputs, FleetServerHosts, Proxies, ...) GET /api/fleet/outputs should return a 403 for user: fleet_agent_policies_all_only
  • [job] [logs] Jest Integration Tests #3 / unrecognized task types should be no workload aggregator errors when there are removed task types

Metrics [docs]

✅ unchanged

History

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

cc @criamico

@criamico
Copy link
Copy Markdown
Member Author

criamico commented Oct 8, 2024

@elasticmachine merge upstream

@criamico criamico enabled auto-merge (squash) October 8, 2024 13:08
@criamico criamico merged commit 14d5677 into elastic:main Oct 8, 2024
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11237782308

@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #104 / discover/context_awareness extension getAdditionalCellActions data view mode should not render incompatible cell action for message column

Metrics [docs]

✅ unchanged

cc @criamico

@criamico
Copy link
Copy Markdown
Member Author

criamico commented Oct 9, 2024

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

criamico added a commit to criamico/kibana that referenced this pull request Oct 9, 2024
…oints (elastic#194951)

Fixes elastic#191266

## Summary
Updating the authz for following endpoints:
- `GET /agent_download_sources`
- `GET /agent_download_sources/{id}`
- `GET /outputs`
- `GET /outputs/{id}`
They need to have `authz.fleet.readSettings ||
authz.fleet.readAgentPolicies` as they should be visible in the agent
policy settings page as well.

### Testing
- Enable feature flag `subfeaturePrivileges`
- Create a role with following privileges:
![Screenshot 2024-10-04 at 15 49
54](https://github.com/user-attachments/assets/4bbc95e4-01d0-43e0-a539-b03b8f4c219e)
- Create a user that has the previous role
- Log in and go to any agent policy > settings
- The download source and output fields should be filled and editable.
They were previously empty, as the GET endpoints were failing with 403
Forbidden

### Checklist
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit 14d5677)

# Conflicts:
#	x-pack/plugins/fleet/server/routes/download_source/index.ts
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Oct 9, 2024
@kibanamachine
Copy link
Copy Markdown
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

1 similar comment
@kibanamachine
Copy link
Copy Markdown
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

criamico added a commit that referenced this pull request Oct 11, 2024
…e endpoints (#194951) (#195536)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Fleet] Adjust privileges for GET output and GET download_source
endpoints (#194951)](#194951)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Cristina
Amico","email":"criamico@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-10-08T14:36:19Z","message":"[Fleet]
Adjust privileges for GET output and GET download_source endpoints
(#194951)\n\nFixes
https://github.com/elastic/kibana/issues/191266\r\n\r\n##
Summary\r\nUpdating the authz for following endpoints:\r\n- `GET
/agent_download_sources`\r\n- `GET /agent_download_sources/{id}`\r\n-
`GET /outputs`\r\n- `GET /outputs/{id}`\r\nThey need to have
`authz.fleet.readSettings ||\r\nauthz.fleet.readAgentPolicies` as they
should be visible in the agent\r\npolicy settings page as
well.\r\n\r\n\r\n### Testing\r\n- Enable feature flag
`subfeaturePrivileges`\r\n- Create a role with following
privileges:\r\n![Screenshot 2024-10-04 at 15
49\r\n54](https://github.com/user-attachments/assets/4bbc95e4-01d0-43e0-a539-b03b8f4c219e)\r\n-
Create a user that has the previous role\r\n- Log in and go to any agent
policy > settings\r\n- The download source and output fields should be
filled and editable.\r\nThey were previously empty, as the GET endpoints
were failing with 403\r\nForbidden\r\n\r\n### Checklist\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"14d5677d073838845074f76f0d9c0edce50533f0","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","v8.16.0","backport:version"],"number":194951,"url":"https://github.com/elastic/kibana/pull/194951","mergeCommit":{"message":"[Fleet]
Adjust privileges for GET output and GET download_source endpoints
(#194951)\n\nFixes
https://github.com/elastic/kibana/issues/191266\r\n\r\n##
Summary\r\nUpdating the authz for following endpoints:\r\n- `GET
/agent_download_sources`\r\n- `GET /agent_download_sources/{id}`\r\n-
`GET /outputs`\r\n- `GET /outputs/{id}`\r\nThey need to have
`authz.fleet.readSettings ||\r\nauthz.fleet.readAgentPolicies` as they
should be visible in the agent\r\npolicy settings page as
well.\r\n\r\n\r\n### Testing\r\n- Enable feature flag
`subfeaturePrivileges`\r\n- Create a role with following
privileges:\r\n![Screenshot 2024-10-04 at 15
49\r\n54](https://github.com/user-attachments/assets/4bbc95e4-01d0-43e0-a539-b03b8f4c219e)\r\n-
Create a user that has the previous role\r\n- Log in and go to any agent
policy > settings\r\n- The download source and output fields should be
filled and editable.\r\nThey were previously empty, as the GET endpoints
were failing with 403\r\nForbidden\r\n\r\n### Checklist\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"14d5677d073838845074f76f0d9c0edce50533f0"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194951","number":194951,"mergeCommit":{"message":"[Fleet]
Adjust privileges for GET output and GET download_source endpoints
(#194951)\n\nFixes
https://github.com/elastic/kibana/issues/191266\r\n\r\n##
Summary\r\nUpdating the authz for following endpoints:\r\n- `GET
/agent_download_sources`\r\n- `GET /agent_download_sources/{id}`\r\n-
`GET /outputs`\r\n- `GET /outputs/{id}`\r\nThey need to have
`authz.fleet.readSettings ||\r\nauthz.fleet.readAgentPolicies` as they
should be visible in the agent\r\npolicy settings page as
well.\r\n\r\n\r\n### Testing\r\n- Enable feature flag
`subfeaturePrivileges`\r\n- Create a role with following
privileges:\r\n![Screenshot 2024-10-04 at 15
49\r\n54](https://github.com/user-attachments/assets/4bbc95e4-01d0-43e0-a539-b03b8f4c219e)\r\n-
Create a user that has the previous role\r\n- Log in and go to any agent
policy > settings\r\n- The download source and output fields should be
filled and editable.\r\nThey were previously empty, as the GET endpoints
were failing with 403\r\nForbidden\r\n\r\n### Checklist\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"14d5677d073838845074f76f0d9c0edce50533f0"}},{"branch":"8.x","label":"v8.16.0","labelRegex":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Oct 11, 2024
@criamico criamico deleted the 191266_rbac_endpoints branch October 11, 2024 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.16.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fleet]: No Settings options for fields like output/binary are available under policy editing with user Role: Settings- None.

5 participants