Skip to content
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

[SecuritySolution][ProductFeatures] Add support for security.authz.requiredPrivileges for the API auth control #198312

Conversation

semd
Copy link
Contributor

@semd semd commented Oct 30, 2024

Summary

Adds support for the new API routes security authorization properties (docs) to the ProductFeaturesService API authorization control

Closes: #194445

Related: #184674

@semd semd added release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) 8.18 candidate labels Oct 30, 2024
@semd semd self-assigned this Oct 30, 2024
@elastic elastic deleted a comment from elasticmachine Oct 30, 2024
@elena-shostak elena-shostak self-requested a review October 30, 2024 14:30
const disabled = authz.requiredPrivileges.some((privilegeEntry) => {
if (typeof privilegeEntry === 'object') {
if (privilegeEntry.allRequired) {
if (privilegeEntry.allRequired.some(isApiPrivilegeSecurityAndDisabled)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be used visa versa, privilegeEntry.allRequired.every and privilegeEntry.anyRequired.some

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am finding disabled actions, so I use the oposite operation. This approach allows me to check the privilege is a security solution action and is disabled, at the same time.
You can take a look at the test for examples

Copy link
Contributor

Choose a reason for hiding this comment

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

gotcha

@semd semd marked this pull request as ready for review October 30, 2024 15:56
@semd semd requested a review from a team as a code owner October 30, 2024 15:56
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@semd
Copy link
Contributor Author

semd commented Oct 31, 2024

@elasticmachine merge upstream

const API_ACTION_TAG_PREFIX = `access:${APP_ID}-`;

const isAuthzEnabled = (authz?: RecursiveReadonly<RouteAuthz>): authz is AuthzEnabled => {
return Boolean((authz as AuthzEnabled)?.requiredPrivileges);
Copy link
Contributor

Choose a reason for hiding this comment

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

Would like to know what's the difference between security.authz.requiredFeatures and security.authz.requiredPrivileges?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, the PR title was wrong, the correct entry is security.authz.requiredPrivileges, security.authz.requiredFeatures does not exist

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #18 / Case View Page files tab should render the custom fields correctly

Metrics [docs]

✅ unchanged

cc @semd

@semd semd changed the title [SecuritySolution][ProductFeatures] Add support for security.authz.requiredFeatures for the API auth control [SecuritySolution][ProductFeatures] Add support for security.authz.requiredPrivileges for the API auth control Oct 31, 2024
@semd semd merged commit 42e978b into elastic:main Oct 31, 2024
44 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

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

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 31, 2024
…equiredPrivileges` for the API auth control (elastic#198312)

## Summary

Adds support for the new API routes security authorization properties
([docs](https://docs.elastic.dev/kibana-dev-docs/key-concepts/security-api-authorization))
to the `ProductFeaturesService` API authorization control

Closes: elastic#194445

Related: elastic#184674

---------

Co-authored-by: Elastic Machine <[email protected]>
(cherry picked from commit 42e978b)
@kibanamachine
Copy link
Contributor

💚 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

kibanamachine added a commit that referenced this pull request Oct 31, 2024
…ity.authz.requiredPrivileges&#x60; for the API auth control (#198312) (#198566)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[SecuritySolution][ProductFeatures] Add support for
&#x60;security.authz.requiredPrivileges&#x60; for the API auth control
(#198312)](#198312)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Sergi
Massaneda","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-31T15:31:00Z","message":"[SecuritySolution][ProductFeatures]
Add support for `security.authz.requiredPrivileges` for the API auth
control (#198312)\n\n## Summary\r\n\r\nAdds support for the new API
routes security authorization
properties\r\n([docs](https://docs.elastic.dev/kibana-dev-docs/key-concepts/security-api-authorization))\r\nto
the `ProductFeaturesService` API authorization control\r\n\r\nCloses:
https://github.com/elastic/kibana/issues/194445\r\n\r\nRelated:
https://github.com/elastic/kibana/issues/184674\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"42e978be21bc7c85fc09f46213c194b89209690f","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:
SecuritySolution","backport:prev-minor","v8.17.0"],"title":"[SecuritySolution][ProductFeatures]
Add support for `security.authz.requiredPrivileges` for the API auth
control","number":198312,"url":"https://github.com/elastic/kibana/pull/198312","mergeCommit":{"message":"[SecuritySolution][ProductFeatures]
Add support for `security.authz.requiredPrivileges` for the API auth
control (#198312)\n\n## Summary\r\n\r\nAdds support for the new API
routes security authorization
properties\r\n([docs](https://docs.elastic.dev/kibana-dev-docs/key-concepts/security-api-authorization))\r\nto
the `ProductFeaturesService` API authorization control\r\n\r\nCloses:
https://github.com/elastic/kibana/issues/194445\r\n\r\nRelated:
https://github.com/elastic/kibana/issues/184674\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"42e978be21bc7c85fc09f46213c194b89209690f"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198312","number":198312,"mergeCommit":{"message":"[SecuritySolution][ProductFeatures]
Add support for `security.authz.requiredPrivileges` for the API auth
control (#198312)\n\n## Summary\r\n\r\nAdds support for the new API
routes security authorization
properties\r\n([docs](https://docs.elastic.dev/kibana-dev-docs/key-concepts/security-api-authorization))\r\nto
the `ProductFeaturesService` API authorization control\r\n\r\nCloses:
https://github.com/elastic/kibana/issues/194445\r\n\r\nRelated:
https://github.com/elastic/kibana/issues/184674\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<[email protected]>","sha":"42e978be21bc7c85fc09f46213c194b89209690f"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Sergi Massaneda <[email protected]>
nreese pushed a commit to nreese/kibana that referenced this pull request Nov 1, 2024
…equiredPrivileges` for the API auth control (elastic#198312)

## Summary

Adds support for the new API routes security authorization properties
([docs](https://docs.elastic.dev/kibana-dev-docs/key-concepts/security-api-authorization))
to the `ProductFeaturesService` API authorization control

Closes: elastic#194445

Related: elastic#184674

---------

Co-authored-by: Elastic Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SecuritySolution][ProductFeaturesService] Add support for new requiredPrivileges security route option
5 participants