Skip to content

[Serverless][Security] Allow Dashboard and Discover privileges on Security projects - #289904

Open
bhapas wants to merge 17 commits into
elastic:mainfrom
bhapas:security-serverless-dashboard-discover-privileges
Open

[Serverless][Security] Allow Dashboard and Discover privileges on Security projects#289904
bhapas wants to merge 17 commits into
elastic:mainfrom
bhapas:security-serverless-dashboard-discover-privileges

Conversation

@bhapas

@bhapas bhapas commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

On Security serverless projects, Dashboard and Discover were hidden from role management and were not registered as standalone feature privileges. A custom role that granted only those features could be saved, but the privileges did not take effect.

This change:

  • Registers Dashboard and Discover feature privileges on Security projects (including the deprecated v1 IDs so existing roles resolve)
  • Shows Dashboard and Discover in the Security section of role management
  • Leaves Security feature composition unchanged, so existing Security roles keep the same access
  • Redirects a dashboard-only user away from Get started to /app/dashboards (Security defaultRoute stays /app/security/get_started for users who can open it)

Visualize v2 and Maps v2 stay hidden. They continue to be granted through Dashboard.

This PR does not add a second Dashboards item to the Security side nav. The existing “Dashboards” entry is Security /app/security/dashboards and still needs siem. A nav label for /app/dashboards is waiting on Product.

Dashboard-only landing

After chrome starts (and on currentAppId$), if the path is /, /app/security, or /app/security/get_started, the user cannot access Get started (navLinks.securitySolutionUI is false), and they can access dashboards (navLinks.dashboards === true or capabilities.dashboard_v2.show), they are sent to application.navigateToApp('dashboards', { replace: true }). Editors stay on Get started.

There is no nav item back to /app/dashboards. Discover remains reachable from chrome. The acceptance signal for this redirect is the URL (/app/dashboards), not listing chrome.

Scout: assert the redirect by URL only

x-pack/solutions/security/plugins/security_solution_serverless/test/scout/ui/parallel_tests/dashboard_only_landing.spec.ts logs in a custom dashboard_v2 + discover_v2 read role, opens Get started, and asserts:

await expect(page).toHaveURL(/\/app\/dashboards/);

It does not assert #dashboardListingHeading, the empty-list prompt, or chrome.pageTitle === 'Dashboards'. Those locators only hold on an empty listing or specific chrome titles. This suite shares the space (spaces: ['*']) with other parallel Scout tests that leave dashboards behind, so listing chrome flakes even when the redirect succeeded.

The privileged-user case still asserts the user stays on Get started.

Predefined roles (CI / kbn-es)

Unhiding Dashboard and Discover made existing .all grants on Security predefined roles live. Those grants were inert while the features were hidden; SIEM read only composedOf read. After unhide, viewer (and t1_analyst / t2_analyst for dashboard/discover) could write, which broke platform Scout 403 tests.

This PR changes the kbn-es Security project roles copy (src/platform/packages/shared/kbn-es/src/serverless_resources/project_roles/security/roles.yml):

  • viewer: dashboard_v2 / discover_v2 / maps_v2 / visualize_v2 .all.read
  • t1_analyst and t2_analyst: dashboard_v2 / discover_v2 .all.read only (maps/visualize stay .all; those features remain hidden)
  • Roles with siemV5.all (editor, t3_analyst, and similar) are unchanged

CI uses this kbn-es file. MKI / production still serve the elasticsearch-controller copy. Do not treat this file as the production source of truth; the controller must be updated separately or viewer/t1/t2 will keep .all in real projects.

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, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests 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
  • 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 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
  • Review the backport guidelines and apply applicable backport:* labels.

Identify risks

Existing custom roles on Security projects that already include Dashboard or Discover privileges will start granting that access after upgrade. This is additive only. Existing Security (siem*) roles are unchanged.

Unhiding also activates stored .all grants on predefined Security roles. The kbn-es copy is tightened to .read for the roles above so CI matches intended viewer/analyst write access. Production still follows elasticsearch-controller until that repo is updated.

Test plan

  • GET /api/security/privileges on a Security project includes dashboard, dashboard_v2, discover, and discover_v2
  • GET /api/features shows dashboard_v2 and discover_v2 in the Security category
  • Create a custom role with Dashboard and Discover read only. That user can open Dashboards and Discover and does not get Security solution access
  • A user with Security read still has Dashboard and Discover access
  • Role management shows Dashboard and Discover under Security
  • Login as that custom role: /, /app/security, and /app/security/get_started redirect to /app/dashboards. An editor stays on Get started
  • Scout dashboard_only_landing.spec.ts passes by URL (/app/dashboards). Do not require listing heading / empty-state locators; other parallel suites share the space and may leave dashboards
  • Focused privileges FTR covers the new feature IDs and siem* action sets. The large inline snapshot is not regenerated unless that leftover test still fails in CI

Release note

On Elastic Cloud Serverless Security projects, Dashboard and Discover can be assigned as feature privileges. Custom roles can grant access to those apps without granting the full Security solution. Roles that already included these privileges will now receive that access.

…urity projects

Register standalone Dashboard and Discover feature privileges so custom roles can grant those apps without the Security solution.

Co-authored-by: Cursor <cursoragent@cursor.com>

@github-actions github-actions Bot left a comment

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.

Reviewed the config, navigation, and test changes. The feature-privilege registration approach looks sound — visualize_v2/maps_v2 remain hidden via serverless.yml, so only dashboard_v2/discover_v2 become assignable under the Security category as intended. Two concrete items left inline: a stale inline snapshot that will fail after narrowing compositeFeatureIds, and a duplicate "Dashboards" nav label.

Generated by Claude Reviewer for #289904 · claude · opus · 224.6 AIC · ⌖ 46.9 AIC · ⊞ 5.5K

@bhapas bhapas self-assigned this Sep 9, 2026
@bhapas bhapas added backport:skip This PR does not require backporting ci:build-serverless-image ci:project-deploy-security Create a Security Serverless Project Team:security-siem-conduit Security SIEM Conduit team [Previously Security Data Experience - Cloud Services team ] labels Sep 9, 2026
…Security projects

Unhide Dashboard and Discover feature privileges on Security serverless and recategorize them under Security.

Co-authored-by: Cursor <cursoragent@cursor.com>

@github-actions github-actions Bot left a comment

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.

Reviewed the config change against the platform-wide serverless.yml. One concrete concern: removing the hidden overrides also un-hides the deprecated v1 visualize/maps features, which (unlike their v2 variants) are not hidden by serverless.yml, so they would newly appear in Security role management. Details inline. The dashboard_v2/discover_v2 category moves and reliance on serverless.yml to keep the v2 Visualize/Maps hidden look correct.

Generated by Claude Reviewer for #289904 · claude · opus · 139.7 AIC · ⌖ 50.4 AIC · ⊞ 5.5K

Comment thread config/serverless.security.yml
bhapas and others added 3 commits September 9, 2026 06:00
…tests

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
… to Dashboards

Co-authored-by: Cursor <cursoragent@cursor.com>
@kibanamachine kibanamachine added the reviewer:scout Agentic PR Scout test review label Sep 9, 2026
…ng tests

Co-authored-by: Cursor <cursoragent@cursor.com>
@bhapas
bhapas requested a balanced review from Copilot September 9, 2026 08:40

Copilot AI left a comment

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.

Note

Copilot was unable to run its full agentic suite in this review.

Pull request overview

Registers Dashboard/Discover feature privileges for Serverless Security projects and updates UI/navigation behavior so users with only those privileges can access the appropriate apps without granting full Security solution access.

Changes:

  • Adds API integration coverage to verify Dashboard/Discover privilege registration, action grants, and feature categorization under Security.
  • Introduces a client-side redirect from Security “Get started” to Dashboards for dashboard-only users, with unit + UI coverage.
  • Updates serverless Security feature overrides to place Dashboard/Discover in the Security role-management category.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
x-pack/solutions/security/test/serverless/api_integration/test_suites/platform_security/authorization.ts Adds/adjusts privilege + feature-category assertions for Dashboard/Discover on Serverless Security.
x-pack/solutions/security/plugins/security_solution_serverless/test/scout/ui/parallel_tests/dashboard_only_landing.spec.ts Adds UI regression coverage for dashboard-only landing/redirect behavior.
x-pack/solutions/security/plugins/security_solution_serverless/public/navigation/redirect_dashboard_only_landing.ts Adds redirect logic for users lacking Security app access but having Dashboards access.
x-pack/solutions/security/plugins/security_solution_serverless/public/navigation/redirect_dashboard_only_landing.test.ts Adds unit tests for redirect predicate + navigation behavior.
x-pack/solutions/security/plugins/security_solution_serverless/public/navigation/index.ts Wires the redirect into navigation startup.
config/serverless.security.yml Re-categorizes Dashboard/Discover features and adjusts hidden feature overrides.
Suppressed comments (1)

x-pack/solutions/security/test/serverless/api_integration/test_suites/platform_security/authorization.ts:1

  • These new tests repeatedly call /api/security/privileges (and again with includeActions=true). In large serverless API integration suites, repeated requests can noticeably increase runtime and flakiness. Consider fetching privileges once in a before hook (and once for includeActions=true) and reusing the response bodies across the related it(...) blocks.
/*

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread config/serverless.security.yml
bhapas and others added 3 commits September 9, 2026 12:33
Co-authored-by: Cursor <cursoragent@cursor.com>
Unhiding Dashboard and Discover made the predefined viewer role's latent
`.all` grants effective, so Scout 403 tests started passing writes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bhapas
bhapas requested a review from a team as a code owner September 9, 2026 12:05

@github-actions github-actions Bot left a comment

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.

One privilege-escalation concern in the serverless role definitions: the viewer fix (.all.read) was not applied to t1_analyst/t2_analyst, which share the same read-tier SIEM pattern. Details inline.

Generated by Claude Reviewer for #289904 · claude · opus · 154.7 AIC · ⌖ 22.5 AIC · ⊞ 5.5K

…-only

Those roles use SIEM read, so unhiding Dashboard/Discover must not
activate their latent `.all` grants.

Co-authored-by: Cursor <cursoragent@cursor.com>
bhapas and others added 3 commits September 9, 2026 15:15
Co-authored-by: Cursor <cursoragent@cursor.com>
…pabilities

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@github-actions github-actions Bot left a comment

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.

Reviewed the feature-privilege config, predefined role changes, the new dashboard-only landing redirect, and the added tests. The redirect logic and its unit coverage look solid, and the category/unhide changes are consistent with how deprecated v1 features resolve. Left one inline comment about a landing gap for the newly-assignable Discover-only role.

Generated by Claude Reviewer for #289904 · claude · opus · 213.4 AIC · ⌖ 23.1 AIC · ⊞ 5.5K

capabilities[CASES_FEATURE_ID]?.read_cases
);

export const canAccessDashboardsApp = (capabilities: Capabilities): boolean =>

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.

This PR also makes discover_v2 independently assignable (the config unhides it), so a Discover-only custom role (discover_v2: ['read'], no dashboard, no siem*) is now possible — but the landing redirect only handles users who can reach the Dashboards app.

For such a user: canAccessSecurityLanding is false (no siem/rules/alerts/cases/attack-discovery), and canAccessDashboardsApp is false (no dashboard_v2.show), so shouldRedirectDashboardOnlyLanding returns false. They land on the default route /app/security/get_started, which they can't access — and as the comment on subscribeDashboardOnlyLanding notes, an inaccessible Security app yields "App Not Found" with no currentAppId$ emission. There's no redirect to Discover, leaving them stranded with no working landing.

Consider routing Discover-only users to /app/discover (e.g. fall back to a discover_v2.show check when dashboards aren't accessible), or confirm this case is intentionally out of scope for now.

@kibanamachine

kibanamachine commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
securitySolutionServerless 30.0KB 30.6KB +611.0B
Unknown metric groups

total optimizer output size

id before after diff
all 64.0MB 64.0MB +611.0B

Test Failures

  • [job] [logs] FTR Configs #14 / alerting api integration security and spaces disabled - Group 6 Rules Templates - Group 6 find_rule_templates returns v1 templates and excludes alerting v2 engine templates
  • [job] [logs] FTR Configs #35 / Connectors with email services enabled Kibana config Email - with multiple enabled services config should use the kibana config for enabled services

History

cc @bhapas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting ci:build-serverless-image ci:project-deploy-security Create a Security Serverless Project release_note:enhancement reviewer:scout Agentic PR Scout test review Team:security-siem-conduit Security SIEM Conduit team [Previously Security Data Experience - Cloud Services team ]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants