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

[Data Usage] add error handling and tests for privilege related errors #203006

Merged
merged 10 commits into from
Dec 6, 2024

Conversation

neptunian
Copy link
Contributor

@neptunian neptunian commented Dec 4, 2024

  • handling of 2 error cases to error handler
    • security_exception due to lack of privileges. Metering api will respond when one of the following isn't available as a user privilege monitor,view_index_metadata,manage,all.
    • index_not_found_exception. Metering api will respond with this when no indices exist for the privileges it has access to or when no indices are found.
  • api integration tests for data_streams route for the following cases
    • returns no data streams when there are none it has access to and responds with appropriate message
    • returns no data streams without necessary privileges and responds with appropriate message
    • returns data streams when user only has access to a subset of indices with necessary privileges
  • functional tests for same as above. these remain skipped due to not being able to create data streams picked up by metering api since we implemented filtering out zero storage size data streams, but useful for local testing with some code changes.

security_exception view

Screenshot 2024-12-04 at 1 14 10 PM

index_not_found_exception view

Screenshot 2024-12-04 at 1 13 13 PM

@neptunian neptunian added release_note:skip Skip the PR/issue when compiling release notes backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Dec 4, 2024
@neptunian neptunian requested review from a team as code owners December 4, 2024 19:18
@ashokaditya ashokaditya force-pushed the data-usage-error-handling-privilege branch from 28eb16b to ddf4307 Compare December 5, 2024 10:44
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

ESLint disabled in files

id before after diff
dataUsage 2 3 +1

Total ESLint disabled count

id before after diff
dataUsage 5 6 +1

History

Copy link
Member

@ashokaditya ashokaditya left a comment

Choose a reason for hiding this comment

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

🚀

@neptunian neptunian merged commit 42348d4 into elastic:main Dec 6, 2024
10 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

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

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 6, 2024
elastic#203006)

- handling of 2 error cases to error handler
- `security_exception` due to lack of privileges. Metering api will
respond when one of the following isn't available as a user privilege
`monitor,view_index_metadata,manage,all`.
- `index_not_found_exception`. Metering api will respond with this when
no indices exist for the privileges it has access to or when no indices
are found.
- api integration tests for data_streams route for the following cases
- returns no data streams when there are none it has access to and
responds with appropriate message
- returns no data streams without necessary privileges and responds with
appropriate message
- returns data streams when user only has access to a subset of indices
with necessary privileges
- functional tests for same as above. these remain skipped due to not
being able to create data streams picked up by metering api since we
implemented filtering out zero storage size data streams, but useful for
local testing with some code changes.

### `security_exception` view
<img width="1555" alt="Screenshot 2024-12-04 at 1 14 10 PM"
src="https://github.com/user-attachments/assets/241a2eb8-1c77-4592-ba18-b971512e712e">

### `index_not_found_exception` view
<img width="1589" alt="Screenshot 2024-12-04 at 1 13 13 PM"
src="https://github.com/user-attachments/assets/12b68d66-9178-4957-b014-5765be348694">

---------

Co-authored-by: Ashokaditya <ashokaditya@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 42348d4)
@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 Dec 6, 2024
… errors (#203006) (#203252)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Data Usage] add error handling and tests for privilege related
errors (#203006)](#203006)

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

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

<!--BACKPORT [{"author":{"name":"Sandra
G","email":"neptunian@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-12-06T15:58:20Z","message":"[Data
Usage] add error handling and tests for privilege related errors
(#203006)\n\n- handling of 2 error cases to error handler\r\n-
`security_exception` due to lack of privileges. Metering api
will\r\nrespond when one of the following isn't available as a user
privilege\r\n`monitor,view_index_metadata,manage,all`.\r\n-
`index_not_found_exception`. Metering api will respond with this
when\r\nno indices exist for the privileges it has access to or when no
indices\r\nare found.\r\n- api integration tests for data_streams route
for the following cases\r\n- returns no data streams when there are none
it has access to and\r\nresponds with appropriate message\r\n- returns
no data streams without necessary privileges and responds
with\r\nappropriate message\r\n- returns data streams when user only has
access to a subset of indices\r\nwith necessary privileges\r\n-
functional tests for same as above. these remain skipped due to
not\r\nbeing able to create data streams picked up by metering api since
we\r\nimplemented filtering out zero storage size data streams, but
useful for\r\nlocal testing with some code changes.\r\n\r\n\r\n###
`security_exception` view\r\n<img width=\"1555\" alt=\"Screenshot
2024-12-04 at 1 14
10 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/241a2eb8-1c77-4592-ba18-b971512e712e\">\r\n\r\n###
`index_not_found_exception` view\r\n<img width=\"1589\" alt=\"Screenshot
2024-12-04 at 1 13
13 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/12b68d66-9178-4957-b014-5765be348694\">\r\n\r\n---------\r\n\r\nCo-authored-by:
Ashokaditya <ashokaditya@elastic.co>\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"42348d41f43a2e69c93b0e7a6b2f372bc96fd059","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:build-serverless-image"],"title":"[Data
Usage] add error handling and tests for privilege related
errors","number":203006,"url":"https://github.com/elastic/kibana/pull/203006","mergeCommit":{"message":"[Data
Usage] add error handling and tests for privilege related errors
(#203006)\n\n- handling of 2 error cases to error handler\r\n-
`security_exception` due to lack of privileges. Metering api
will\r\nrespond when one of the following isn't available as a user
privilege\r\n`monitor,view_index_metadata,manage,all`.\r\n-
`index_not_found_exception`. Metering api will respond with this
when\r\nno indices exist for the privileges it has access to or when no
indices\r\nare found.\r\n- api integration tests for data_streams route
for the following cases\r\n- returns no data streams when there are none
it has access to and\r\nresponds with appropriate message\r\n- returns
no data streams without necessary privileges and responds
with\r\nappropriate message\r\n- returns data streams when user only has
access to a subset of indices\r\nwith necessary privileges\r\n-
functional tests for same as above. these remain skipped due to
not\r\nbeing able to create data streams picked up by metering api since
we\r\nimplemented filtering out zero storage size data streams, but
useful for\r\nlocal testing with some code changes.\r\n\r\n\r\n###
`security_exception` view\r\n<img width=\"1555\" alt=\"Screenshot
2024-12-04 at 1 14
10 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/241a2eb8-1c77-4592-ba18-b971512e712e\">\r\n\r\n###
`index_not_found_exception` view\r\n<img width=\"1589\" alt=\"Screenshot
2024-12-04 at 1 13
13 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/12b68d66-9178-4957-b014-5765be348694\">\r\n\r\n---------\r\n\r\nCo-authored-by:
Ashokaditya <ashokaditya@elastic.co>\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"42348d41f43a2e69c93b0e7a6b2f372bc96fd059"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/203006","number":203006,"mergeCommit":{"message":"[Data
Usage] add error handling and tests for privilege related errors
(#203006)\n\n- handling of 2 error cases to error handler\r\n-
`security_exception` due to lack of privileges. Metering api
will\r\nrespond when one of the following isn't available as a user
privilege\r\n`monitor,view_index_metadata,manage,all`.\r\n-
`index_not_found_exception`. Metering api will respond with this
when\r\nno indices exist for the privileges it has access to or when no
indices\r\nare found.\r\n- api integration tests for data_streams route
for the following cases\r\n- returns no data streams when there are none
it has access to and\r\nresponds with appropriate message\r\n- returns
no data streams without necessary privileges and responds
with\r\nappropriate message\r\n- returns data streams when user only has
access to a subset of indices\r\nwith necessary privileges\r\n-
functional tests for same as above. these remain skipped due to
not\r\nbeing able to create data streams picked up by metering api since
we\r\nimplemented filtering out zero storage size data streams, but
useful for\r\nlocal testing with some code changes.\r\n\r\n\r\n###
`security_exception` view\r\n<img width=\"1555\" alt=\"Screenshot
2024-12-04 at 1 14
10 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/241a2eb8-1c77-4592-ba18-b971512e712e\">\r\n\r\n###
`index_not_found_exception` view\r\n<img width=\"1589\" alt=\"Screenshot
2024-12-04 at 1 13
13 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/12b68d66-9178-4957-b014-5765be348694\">\r\n\r\n---------\r\n\r\nCo-authored-by:
Ashokaditya <ashokaditya@elastic.co>\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"42348d41f43a2e69c93b0e7a6b2f372bc96fd059"}}]}]
BACKPORT-->

Co-authored-by: Sandra G <neptunian@users.noreply.github.com>
markov00 pushed a commit to markov00/kibana that referenced this pull request Dec 7, 2024
elastic#203006)

- handling of 2 error cases to error handler
- `security_exception` due to lack of privileges. Metering api will
respond when one of the following isn't available as a user privilege
`monitor,view_index_metadata,manage,all`.
- `index_not_found_exception`. Metering api will respond with this when
no indices exist for the privileges it has access to or when no indices
are found.
- api integration tests for data_streams route for the following cases
- returns no data streams when there are none it has access to and
responds with appropriate message
- returns no data streams without necessary privileges and responds with
appropriate message
- returns data streams when user only has access to a subset of indices
with necessary privileges
- functional tests for same as above. these remain skipped due to not
being able to create data streams picked up by metering api since we
implemented filtering out zero storage size data streams, but useful for
local testing with some code changes.


### `security_exception` view
<img width="1555" alt="Screenshot 2024-12-04 at 1 14 10 PM"
src="https://github.com/user-attachments/assets/241a2eb8-1c77-4592-ba18-b971512e712e">

### `index_not_found_exception` view
<img width="1589" alt="Screenshot 2024-12-04 at 1 13 13 PM"
src="https://github.com/user-attachments/assets/12b68d66-9178-4957-b014-5765be348694">

---------

Co-authored-by: Ashokaditya <ashokaditya@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
SoniaSanzV pushed a commit to SoniaSanzV/kibana that referenced this pull request Dec 9, 2024
elastic#203006)

- handling of 2 error cases to error handler
- `security_exception` due to lack of privileges. Metering api will
respond when one of the following isn't available as a user privilege
`monitor,view_index_metadata,manage,all`.
- `index_not_found_exception`. Metering api will respond with this when
no indices exist for the privileges it has access to or when no indices
are found.
- api integration tests for data_streams route for the following cases
- returns no data streams when there are none it has access to and
responds with appropriate message
- returns no data streams without necessary privileges and responds with
appropriate message
- returns data streams when user only has access to a subset of indices
with necessary privileges
- functional tests for same as above. these remain skipped due to not
being able to create data streams picked up by metering api since we
implemented filtering out zero storage size data streams, but useful for
local testing with some code changes.


### `security_exception` view
<img width="1555" alt="Screenshot 2024-12-04 at 1 14 10 PM"
src="https://github.com/user-attachments/assets/241a2eb8-1c77-4592-ba18-b971512e712e">

### `index_not_found_exception` view
<img width="1589" alt="Screenshot 2024-12-04 at 1 13 13 PM"
src="https://github.com/user-attachments/assets/12b68d66-9178-4957-b014-5765be348694">

---------

Co-authored-by: Ashokaditya <ashokaditya@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
SoniaSanzV pushed a commit to SoniaSanzV/kibana that referenced this pull request Dec 9, 2024
elastic#203006)

- handling of 2 error cases to error handler
- `security_exception` due to lack of privileges. Metering api will
respond when one of the following isn't available as a user privilege
`monitor,view_index_metadata,manage,all`.
- `index_not_found_exception`. Metering api will respond with this when
no indices exist for the privileges it has access to or when no indices
are found.
- api integration tests for data_streams route for the following cases
- returns no data streams when there are none it has access to and
responds with appropriate message
- returns no data streams without necessary privileges and responds with
appropriate message
- returns data streams when user only has access to a subset of indices
with necessary privileges
- functional tests for same as above. these remain skipped due to not
being able to create data streams picked up by metering api since we
implemented filtering out zero storage size data streams, but useful for
local testing with some code changes.


### `security_exception` view
<img width="1555" alt="Screenshot 2024-12-04 at 1 14 10 PM"
src="https://github.com/user-attachments/assets/241a2eb8-1c77-4592-ba18-b971512e712e">

### `index_not_found_exception` view
<img width="1589" alt="Screenshot 2024-12-04 at 1 13 13 PM"
src="https://github.com/user-attachments/assets/12b68d66-9178-4957-b014-5765be348694">

---------

Co-authored-by: Ashokaditya <ashokaditya@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 9, 2024
elastic#203006)

- handling of 2 error cases to error handler
- `security_exception` due to lack of privileges. Metering api will
respond when one of the following isn't available as a user privilege
`monitor,view_index_metadata,manage,all`.
- `index_not_found_exception`. Metering api will respond with this when
no indices exist for the privileges it has access to or when no indices
are found.
- api integration tests for data_streams route for the following cases
- returns no data streams when there are none it has access to and
responds with appropriate message
- returns no data streams without necessary privileges and responds with
appropriate message
- returns data streams when user only has access to a subset of indices
with necessary privileges
- functional tests for same as above. these remain skipped due to not
being able to create data streams picked up by metering api since we
implemented filtering out zero storage size data streams, but useful for
local testing with some code changes.


### `security_exception` view
<img width="1555" alt="Screenshot 2024-12-04 at 1 14 10 PM"
src="https://github.com/user-attachments/assets/241a2eb8-1c77-4592-ba18-b971512e712e">

### `index_not_found_exception` view
<img width="1589" alt="Screenshot 2024-12-04 at 1 13 13 PM"
src="https://github.com/user-attachments/assets/12b68d66-9178-4957-b014-5765be348694">

---------

Co-authored-by: Ashokaditya <ashokaditya@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Samiul-TheSoccerFan pushed a commit to Samiul-TheSoccerFan/kibana that referenced this pull request Dec 10, 2024
elastic#203006)

- handling of 2 error cases to error handler
- `security_exception` due to lack of privileges. Metering api will
respond when one of the following isn't available as a user privilege
`monitor,view_index_metadata,manage,all`.
- `index_not_found_exception`. Metering api will respond with this when
no indices exist for the privileges it has access to or when no indices
are found.
- api integration tests for data_streams route for the following cases
- returns no data streams when there are none it has access to and
responds with appropriate message
- returns no data streams without necessary privileges and responds with
appropriate message
- returns data streams when user only has access to a subset of indices
with necessary privileges
- functional tests for same as above. these remain skipped due to not
being able to create data streams picked up by metering api since we
implemented filtering out zero storage size data streams, but useful for
local testing with some code changes.


### `security_exception` view
<img width="1555" alt="Screenshot 2024-12-04 at 1 14 10 PM"
src="https://github.com/user-attachments/assets/241a2eb8-1c77-4592-ba18-b971512e712e">

### `index_not_found_exception` view
<img width="1589" alt="Screenshot 2024-12-04 at 1 13 13 PM"
src="https://github.com/user-attachments/assets/12b68d66-9178-4957-b014-5765be348694">

---------

Co-authored-by: Ashokaditya <ashokaditya@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
mykolaharmash pushed a commit to mykolaharmash/kibana that referenced this pull request Dec 11, 2024
elastic#203006)

- handling of 2 error cases to error handler
- `security_exception` due to lack of privileges. Metering api will
respond when one of the following isn't available as a user privilege
`monitor,view_index_metadata,manage,all`.
- `index_not_found_exception`. Metering api will respond with this when
no indices exist for the privileges it has access to or when no indices
are found.
- api integration tests for data_streams route for the following cases
- returns no data streams when there are none it has access to and
responds with appropriate message
- returns no data streams without necessary privileges and responds with
appropriate message
- returns data streams when user only has access to a subset of indices
with necessary privileges
- functional tests for same as above. these remain skipped due to not
being able to create data streams picked up by metering api since we
implemented filtering out zero storage size data streams, but useful for
local testing with some code changes.


### `security_exception` view
<img width="1555" alt="Screenshot 2024-12-04 at 1 14 10 PM"
src="https://github.com/user-attachments/assets/241a2eb8-1c77-4592-ba18-b971512e712e">

### `index_not_found_exception` view
<img width="1589" alt="Screenshot 2024-12-04 at 1 13 13 PM"
src="https://github.com/user-attachments/assets/12b68d66-9178-4957-b014-5765be348694">

---------

Co-authored-by: Ashokaditya <ashokaditya@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
elastic#203006)

- handling of 2 error cases to error handler
- `security_exception` due to lack of privileges. Metering api will
respond when one of the following isn't available as a user privilege
`monitor,view_index_metadata,manage,all`.
- `index_not_found_exception`. Metering api will respond with this when
no indices exist for the privileges it has access to or when no indices
are found.
- api integration tests for data_streams route for the following cases
- returns no data streams when there are none it has access to and
responds with appropriate message
- returns no data streams without necessary privileges and responds with
appropriate message
- returns data streams when user only has access to a subset of indices
with necessary privileges
- functional tests for same as above. these remain skipped due to not
being able to create data streams picked up by metering api since we
implemented filtering out zero storage size data streams, but useful for
local testing with some code changes.


### `security_exception` view
<img width="1555" alt="Screenshot 2024-12-04 at 1 14 10 PM"
src="https://github.com/user-attachments/assets/241a2eb8-1c77-4592-ba18-b971512e712e">

### `index_not_found_exception` view
<img width="1589" alt="Screenshot 2024-12-04 at 1 13 13 PM"
src="https://github.com/user-attachments/assets/12b68d66-9178-4957-b014-5765be348694">

---------

Co-authored-by: Ashokaditya <ashokaditya@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
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) ci:build-serverless-image release_note:skip Skip the PR/issue when compiling release notes v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants