[Security Solution] Anomalies Table data fix#225757
[Security Solution] Anomalies Table data fix#225757abhishekbhatia1710 merged 3 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/security-entity-analytics (Team:Entity Analytics) |
jaredburgettelastic
left a comment
There was a problem hiding this comment.
LGTM! Also desk tested. 🚢
As unit tests could not have caught this, @hop-dev we should add a basic e2e test case for opening the flyout as part of privileged user monitoring Cypress tests in order to catch this in the future.
|
Starting backport for target branches: 9.1 |
|
Starting backport for target branches: 9.1 |
…ileged User Monitoring Dashboard flyout error fix (elastic#225757) ## Summary The privileged user monitoring dashboard was recently released as Technical preview as part of 9.1 feature freeze. The flyout, when accessed from the privileged user table, gave an error as below :   https://github.com/user-attachments/assets/f5882e74-7088-4f4f-86d2-ec0f2988a96c Following the ML platform changes in PR elastic#221081, the API endpoint `/internal/ml/results/anomalies_table_data` was updated to accept the [threshold] field as an array of [SeverityThreshold] objects instead of a single number. This change was part of a larger refactoring to support more sophisticated anomaly severity filtering with minimum and maximum threshold ranges. However, the Security Solution's anomalies table data integration was still sending the old format, causing a 400 Bad Request error: ``` [request body.threshold]: expected value of type [array] but got [number] ``` ### Root Cause Backend expectation (new): [threshold: [{ min: number, max?: number }]] Frontend sending (old): [threshold: number] The ML backend schema was updated in [results_service_schema.ts] threshold: schema.number(), threshold: schema.arrayOf(severityThresholdSchema), ### Fix 1. Updated type definitions [anomalies_table_data.ts] 2. Updated API call [use_anomalies_table_data.ts] ### Testing Steps : 1. Check out the main branch of [security-documents-generator](https://github.com/elastic/security-documents-generator). 3. Run: `yarn start privileged-user-monitoring` 4. After this completes, a CSV file should be generated. 5. Navigate to the Privileged User Monitoring dashboard page. 6. Click "Import file", or if you’ve already imported data before, click "Manage data sources" and then "Import file". 7. Select the CSV file generated in step 3. 8. On the dashboard, scroll down to the table titled "Privileged Users". 9. Click the double-headed arrow next to any user name — this should open a flyout. 10. Ensure that no errors appear when the flyout opens. 11. Alternatively, open your browser’s DevTools Network tab and verify that the API call to `/internal/ml/results/anomalies_table_data` does not return a 400 status code. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. (cherry picked from commit 5d2f0f8)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…ileged User Monitoring Dashboard flyout error fix (elastic#225757) ## Summary The privileged user monitoring dashboard was recently released as Technical preview as part of 9.1 feature freeze. The flyout, when accessed from the privileged user table, gave an error as below :   https://github.com/user-attachments/assets/f5882e74-7088-4f4f-86d2-ec0f2988a96c Following the ML platform changes in PR elastic#221081, the API endpoint `/internal/ml/results/anomalies_table_data` was updated to accept the [threshold] field as an array of [SeverityThreshold] objects instead of a single number. This change was part of a larger refactoring to support more sophisticated anomaly severity filtering with minimum and maximum threshold ranges. However, the Security Solution's anomalies table data integration was still sending the old format, causing a 400 Bad Request error: ``` [request body.threshold]: expected value of type [array] but got [number] ``` ### Root Cause Backend expectation (new): [threshold: [{ min: number, max?: number }]] Frontend sending (old): [threshold: number] The ML backend schema was updated in [results_service_schema.ts] threshold: schema.number(), threshold: schema.arrayOf(severityThresholdSchema), ### Fix 1. Updated type definitions [anomalies_table_data.ts] 2. Updated API call [use_anomalies_table_data.ts] ### Testing Steps : 1. Check out the main branch of [security-documents-generator](https://github.com/elastic/security-documents-generator). 3. Run: `yarn start privileged-user-monitoring` 4. After this completes, a CSV file should be generated. 5. Navigate to the Privileged User Monitoring dashboard page. 6. Click "Import file", or if you’ve already imported data before, click "Manage data sources" and then "Import file". 7. Select the CSV file generated in step 3. 8. On the dashboard, scroll down to the table titled "Privileged Users". 9. Click the double-headed arrow next to any user name — this should open a flyout. 10. Ensure that no errors appear when the flyout opens. 11. Alternatively, open your browser’s DevTools Network tab and verify that the API call to `/internal/ml/results/anomalies_table_data` does not return a 400 status code. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [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 - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [ ] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. (cherry picked from commit 5d2f0f8)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…g]Privileged User Monitoring Dashboard flyout error fix (#225757) (#225955) # Backport This will backport the following commits from `main` to `9.1`: - [[Security Solution][Entity Analytics][Privileged User Monitoring]Privileged User Monitoring Dashboard flyout error fix (#225757)](#225757) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Abhishek Bhatia","email":"117628830+abhishekbhatia1710@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-07-01T08:42:08Z","message":"[Security Solution][Entity Analytics][Privileged User Monitoring]Privileged User Monitoring Dashboard flyout error fix (#225757)\n\n## Summary\n\n\nThe privileged user monitoring dashboard was recently released as\nTechnical preview as part of 9.1 feature freeze.\nThe flyout, when accessed from the privileged user table, gave an error\nas below :\n\n\n\n\n\n\nhttps://github.com/user-attachments/assets/f5882e74-7088-4f4f-86d2-ec0f2988a96c\n\nFollowing the ML platform changes in PR #221081, the API endpoint\n`/internal/ml/results/anomalies_table_data` was updated to accept the\n[threshold] field as an array of [SeverityThreshold] objects instead of\na single number. This change was part of a larger refactoring to support\nmore sophisticated anomaly severity filtering with minimum and maximum\nthreshold ranges.\n\nHowever, the Security Solution's anomalies table data integration was\nstill sending the old format, causing a 400 Bad Request error:\n```\n[request body.threshold]: expected value of type [array] but got [number]\n```\n\n### Root Cause\nBackend expectation (new): [threshold: [{ min: number, max?: number }]]\nFrontend sending (old): [threshold: number]\n\nThe ML backend schema was updated in [results_service_schema.ts]\n\nthreshold: schema.number(),\n\nthreshold: schema.arrayOf(severityThresholdSchema),\n\n### Fix\n1. Updated type definitions [anomalies_table_data.ts]\n2. Updated API call [use_anomalies_table_data.ts]\n\n### Testing Steps : \n\n1. Check out the main branch of\n[security-documents-generator](https://github.com/elastic/security-documents-generator).\n3. Run: `yarn start privileged-user-monitoring`\n4. After this completes, a CSV file should be generated.\n5. Navigate to the Privileged User Monitoring dashboard page.\n6. Click \"Import file\", or if you’ve already imported data before, click\n\"Manage data sources\" and then \"Import file\".\n7. Select the CSV file generated in step 3.\n8. On the dashboard, scroll down to the table titled \"Privileged Users\".\n9. Click the double-headed arrow next to any user name — this should\nopen a flyout.\n10. Ensure that no errors appear when the flyout opens.\n11. Alternatively, open your browser’s DevTools Network tab and verify\nthat the API call to\n`/internal/ml/results/anomalies_table_data` does not return a 400 status\ncode.\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.","sha":"5d2f0f8621724219dd1b9d91bc7444a1ec722456","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Entity Analytics","backport:version","v9.1.0","v9.2.0"],"title":"[Security Solution][Entity Analytics][Privileged User Monitoring]Privileged User Monitoring Dashboard flyout error fix","number":225757,"url":"https://github.com/elastic/kibana/pull/225757","mergeCommit":{"message":"[Security Solution][Entity Analytics][Privileged User Monitoring]Privileged User Monitoring Dashboard flyout error fix (#225757)\n\n## Summary\n\n\nThe privileged user monitoring dashboard was recently released as\nTechnical preview as part of 9.1 feature freeze.\nThe flyout, when accessed from the privileged user table, gave an error\nas below :\n\n\n\n\n\n\nhttps://github.com/user-attachments/assets/f5882e74-7088-4f4f-86d2-ec0f2988a96c\n\nFollowing the ML platform changes in PR #221081, the API endpoint\n`/internal/ml/results/anomalies_table_data` was updated to accept the\n[threshold] field as an array of [SeverityThreshold] objects instead of\na single number. This change was part of a larger refactoring to support\nmore sophisticated anomaly severity filtering with minimum and maximum\nthreshold ranges.\n\nHowever, the Security Solution's anomalies table data integration was\nstill sending the old format, causing a 400 Bad Request error:\n```\n[request body.threshold]: expected value of type [array] but got [number]\n```\n\n### Root Cause\nBackend expectation (new): [threshold: [{ min: number, max?: number }]]\nFrontend sending (old): [threshold: number]\n\nThe ML backend schema was updated in [results_service_schema.ts]\n\nthreshold: schema.number(),\n\nthreshold: schema.arrayOf(severityThresholdSchema),\n\n### Fix\n1. Updated type definitions [anomalies_table_data.ts]\n2. Updated API call [use_anomalies_table_data.ts]\n\n### Testing Steps : \n\n1. Check out the main branch of\n[security-documents-generator](https://github.com/elastic/security-documents-generator).\n3. Run: `yarn start privileged-user-monitoring`\n4. After this completes, a CSV file should be generated.\n5. Navigate to the Privileged User Monitoring dashboard page.\n6. Click \"Import file\", or if you’ve already imported data before, click\n\"Manage data sources\" and then \"Import file\".\n7. Select the CSV file generated in step 3.\n8. On the dashboard, scroll down to the table titled \"Privileged Users\".\n9. Click the double-headed arrow next to any user name — this should\nopen a flyout.\n10. Ensure that no errors appear when the flyout opens.\n11. Alternatively, open your browser’s DevTools Network tab and verify\nthat the API call to\n`/internal/ml/results/anomalies_table_data` does not return a 400 status\ncode.\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.","sha":"5d2f0f8621724219dd1b9d91bc7444a1ec722456"}},"sourceBranch":"main","suggestedTargetBranches":["9.1"],"targetPullRequestStates":[{"branch":"9.1","label":"v9.1.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/225757","number":225757,"mergeCommit":{"message":"[Security Solution][Entity Analytics][Privileged User Monitoring]Privileged User Monitoring Dashboard flyout error fix (#225757)\n\n## Summary\n\n\nThe privileged user monitoring dashboard was recently released as\nTechnical preview as part of 9.1 feature freeze.\nThe flyout, when accessed from the privileged user table, gave an error\nas below :\n\n\n\n\n\n\nhttps://github.com/user-attachments/assets/f5882e74-7088-4f4f-86d2-ec0f2988a96c\n\nFollowing the ML platform changes in PR #221081, the API endpoint\n`/internal/ml/results/anomalies_table_data` was updated to accept the\n[threshold] field as an array of [SeverityThreshold] objects instead of\na single number. This change was part of a larger refactoring to support\nmore sophisticated anomaly severity filtering with minimum and maximum\nthreshold ranges.\n\nHowever, the Security Solution's anomalies table data integration was\nstill sending the old format, causing a 400 Bad Request error:\n```\n[request body.threshold]: expected value of type [array] but got [number]\n```\n\n### Root Cause\nBackend expectation (new): [threshold: [{ min: number, max?: number }]]\nFrontend sending (old): [threshold: number]\n\nThe ML backend schema was updated in [results_service_schema.ts]\n\nthreshold: schema.number(),\n\nthreshold: schema.arrayOf(severityThresholdSchema),\n\n### Fix\n1. Updated type definitions [anomalies_table_data.ts]\n2. Updated API call [use_anomalies_table_data.ts]\n\n### Testing Steps : \n\n1. Check out the main branch of\n[security-documents-generator](https://github.com/elastic/security-documents-generator).\n3. Run: `yarn start privileged-user-monitoring`\n4. After this completes, a CSV file should be generated.\n5. Navigate to the Privileged User Monitoring dashboard page.\n6. Click \"Import file\", or if you’ve already imported data before, click\n\"Manage data sources\" and then \"Import file\".\n7. Select the CSV file generated in step 3.\n8. On the dashboard, scroll down to the table titled \"Privileged Users\".\n9. Click the double-headed arrow next to any user name — this should\nopen a flyout.\n10. Ensure that no errors appear when the flyout opens.\n11. Alternatively, open your browser’s DevTools Network tab and verify\nthat the API call to\n`/internal/ml/results/anomalies_table_data` does not return a 400 status\ncode.\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [ ] Any text added follows [EUI's writing\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\nsentence case text and includes [i18n\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\n- [ ]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas added for features that require explanation or tutorials\n- [ ] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [ ] If a plugin configuration key changed, check if it needs to be\nallowlisted in the cloud and added to the [docker\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\n- [ ] This was checked for breaking HTTP API changes, and any breaking\nchanges have been approved by the breaking-change committee. The\n`release_note:breaking` label should be applied in these situations.\n- [ ] [Flaky Test\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\nused on any tests changed\n- [ ] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [ ] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.","sha":"5d2f0f8621724219dd1b9d91bc7444a1ec722456"}}]}] BACKPORT--> Co-authored-by: Abhishek Bhatia <117628830+abhishekbhatia1710@users.noreply.github.com>
|
Updated the PR title to clearly describe that this was a generic fix across multiple areas, although it happened to fix the specific issue for privileged user monitoring. |
Summary
The privileged user monitoring dashboard was recently released as Technical preview as part of 9.1 feature freeze.
The flyout, when accessed from the privileged user table, gave an error as below :
Screen.Recording.2025-06-26.at.7.09.50.PM.mov
Following the ML platform changes in PR #221081, the API endpoint
/internal/ml/results/anomalies_table_datawas updated to accept the [threshold] field as an array of [SeverityThreshold] objects instead of a single number. This change was part of a larger refactoring to support more sophisticated anomaly severity filtering with minimum and maximum threshold ranges.However, the Security Solution's anomalies table data integration was still sending the old format, causing a 400 Bad Request error:
Root Cause
Backend expectation (new): [threshold: [{ min: number, max?: number }]]
Frontend sending (old): [threshold: number]
The ML backend schema was updated in [results_service_schema.ts]
threshold: schema.number(),
threshold: schema.arrayOf(severityThresholdSchema),
Fix
Testing Steps :
yarn start privileged-user-monitoring/internal/ml/results/anomalies_table_datadoes not return a 400 status code.Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breakinglabel should be applied in these situations.release_note:*label is applied per the guidelinesbackport:*labels.