Commit graph

12372 commits

Author SHA1 Message Date
Elena Stoeva
96e3d55638
[Data Streams] Unskip API integration tests (#209102)
Closes https://github.com/elastic/kibana/issues/209014

## Summary

This PR unskips and updates the Data streams API integration tests to
reflect the recent changes to Elasticsearch
(https://github.com/elastic/elasticsearch/pull/121049). Previously, the
`cluster.logsdb.enabled` setting was always `false` by default in
stateful Kibana. With the new changes, it is `true` by default if the
`logsdb.prior_logs_usage` setting is `false` (which is the case for new
test clusters, hence the test failure), and `true` otherwise. Therefore,
we need to update the tests so that we test both cases.

Flaky test runner:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/7821
2025-02-03 17:24:58 +01:00
Philippe Oberti
4886061950
[Security Solution][Threat Intelligence] - fix Cypress tests (#209195)
## Summary

This PR fixes the few Threat Intelligence Cypress tests which started
failing recently.

[This PR](https://github.com/elastic/kibana/pull/208990)
([commit](296c452345)
on `main`) which was a basic bump PR started had to skip a few Threat
Intelligence Cypress tests that started failing.

I tried to understand what happened but did not find the origin of the
issue. The indicators table was previously showing data sorted from
oldest to newest (but only on Cypress, not when running the application
locally, really weird). After the commit mentioned above, the Cypress
tests are now sorting the data from newest to oldest.
Looking at the code, nothing mentions sorting, the
`threatIntelligenceSearchStrategy` is identical between the application
running locally and the Cypress tests.

#### Payload

| Local run  | Cypress |
| ------------- | ------------- |
| ![Screenshot 2025-01-31 at 2 20
33 PM](https://github.com/user-attachments/assets/7095eeef-3ceb-4a3c-85ee-7fee7e07b9ba)
| ![Screenshot 2025-01-31 at 2 21
39 PM](https://github.com/user-attachments/assets/7bce82d2-12ff-483f-bf85-ad8f0ce45054)
|

#### Result

The results are different, one sorted ascending, the other descending.

| Local run  | Cypress |
| ------------- | ------------- |
| ![Screenshot 2025-01-31 at 2 22
19 PM](https://github.com/user-attachments/assets/09715344-0c6e-44e9-8abd-d0b56ae8c984)
| ![Screenshot 2025-01-31 at 2 22
03 PM](https://github.com/user-attachments/assets/b66412fc-0018-4a84-9ddf-98b90c200878)
|

No code changes have been done to the Threat Intelligence plugin in many
months. Fetching the data is done using `useQuery` (see
[here](https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/plugins/threat_intelligence/public/modules/indicators/hooks/use_indicators.ts#L101))
and the logic to fetch the actual data is
[here](https://github.com/elastic/kibana/blob/main/x-pack/solutions/security/plugins/threat_intelligence/public/modules/indicators/services/fetch_indicators.ts#L71).
Both haven't been touched in months...

Nothing in the commit mentioned above seems to give any details on why
these tests just started failing. Resetting to the commit right before
makes the tests pass...

The solution to fix the tests was to ensure that the data_archive files
had the correct timestamps, to know exactly which ones we select in the
Cypress tests to test against...

https://github.com/elastic/kibana/issues/209050
https://github.com/elastic/kibana/issues/209039
https://github.com/elastic/kibana/issues/209051

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-03 09:03:32 -06:00
Elena Shostak
e890494ea7
[FTR] Skipped prebuilt rules test suite for FIPS (#209091)
## Summary

Skipped prebuilt rules test suite for FIPS.
We intentionally need to skip this test for FIPS due to [FIPS
overrides](542a56b482/packages/kbn-test/src/functional_tests/lib/fips_overrides.ts).

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-03 13:25:53 +01:00
Jean-Louis Leysens
6bcdac4571
[Upgrade Assistant] Critical Kibana API deprecations should not block upgrades (#209128)
## Summary

Filters out any deprecated Kibana API usages from blocking upgrade
status.


### Checklist

- [x] [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

### Risks

Should be mitigated by E2E tests
2025-02-03 12:29:05 +01:00
Maryam Saeidi
8fe5738b24
[Custom threshold] Fix using data view runtime fields during rule execution for the custom threshold rule (#209133)
Fixes #200772

## 🐉  Summary


This PR fixes supporting data view runtime fields during rule execution
for the custom threshold rule.

## 🧪 How to test

1. Create a runtime field as shown below:

    |Runtime field| Preview|
    |---|---|

|![Image](e93efad5-bc3b-4306-b820-8b096dbba360)|

2. Make sure alerts are generated as expected both for regular and
no-data alerts:

![image](https://github.com/user-attachments/assets/a2174e40-11a4-4d75-8500-bfce126ba7cd)

### TODO
- [x] Add an API integration test
    - [x] Test on MKI
2025-02-03 12:09:29 +01:00
Achyut Jhunjhunwala
91ce0ba9e8
[Dataset Quality] Fix flaky tests discover navigation (#208909)
## Summary

Closes https://github.com/elastic/kibana/issues/206734

- The PR adds a retry logic while getting the Datasource Selector text
on the Discover page.
- Also renames the tests as they were missed when migration of links
from Log Explorer to Discover were done


### Why do we need retry logic

We navigate using locators.

**Without retry** - The link generated has a hash and thus the check for
`dataSelectorId` fails

```
https://achyut-mki-test-runner-e64297.kb.eu-west-1.aws.qa.elastic.cloud/app/r?l=DISCOVER_APP_LOCATOR&v=9.0.0&lz=N4IgLglgtgpgSgQwHYHMYgFygGYCcD2UmIS%2BA7gLQBMALABYgA04%2BxpZIAvs7jHjAGc6ASSRgYuAG4IANplAAHBAFcB6DGFzKYzaTO2YAbAAZTx7iAAmCMAgBqEGGWGXiM%2FCgEUESgMZ0YADoEX19BLwAqJisbe0cyAGUFGF95EAhXDBB3T28%2FAODQ8Ioo5kgwGXVsjy8fEIKQsIFI6MhYADFHGUsAOQRYYgABNsFbKAUuZgBHbVwATzSZZBRlBDRiAGtZhent4gB9CBRSXksMAAIoi198fSgkAUwAbQBdZmwIGXFcR4wn0FgtjSECQlhgAA83DU8vUgo1ilddhIFlgQFAbP59go6LgEGo0tZbPsBJoYP1Akh%2BoI%2FFUFARLMpfJB8EguJxOG90mIJHpiCowKxmAJ8LgwM8niBhtBRv0JswwQJUi8XpwgA%3D%3D%3D
```

**With retry** - This link then redirects to as Discover Locator
resolves it to

```
https://achyut-mki-test-runner-e64297.kb.eu-west-1.aws.qa.elastic.cloud/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-24h,to:now))&_a=(columns:!(),dataSource:(dataViewId:%27logs-apache.access-*%27,type:dataView),filters:!((meta:(index:%27logs-apache.access-*%27),query:(match_phrase:(data_stream.namespace:production)))),interval:auto,query:(language:kuery,query:%27_ignored:%20*%27),sort:!(!(%27@timestamp%27,desc)))
```

**Tested on MKI before and after the fix to confirm the issue is
evidently reproducible and with the fix goes away**
2025-02-03 10:46:41 +01:00
Tiago Costa
c81540fa3a
skip flaky suite (#184681) 2025-02-02 19:11:02 +00:00
Christos Nasikas
c7416509c6
[Cases] Remove comments from the get case API response (#208829)
## Summary

In https://github.com/elastic/kibana/pull/207739 we remove the
`includeComments` query param. This PR also removes the `comments` from
the response as part of the same effort.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] [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
2025-01-31 17:09:54 +01:00
Kibana Machine
ee1235d40a skip failing test suite (#209008) 2025-02-01 03:01:05 +11:00
Konrad Szwarc
ac67d91021
[EDR Workflows] Workflow Insights - Cypress (#204562)
This PR adds Cypress test coverage for the Defend Insights component and
enables RBAC and tier validation tests. It should be merged after the
feature flag is enabled - https://github.com/elastic/kibana/pull/204242

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-01-31 14:43:08 +01:00
Julian Gernun
b6939f1dda
[Response Ops][Cases] Functional tests checking cases view - alerts tab (#208964)
## Summary

Tests missing in https://github.com/elastic/kibana/pull/208672
2025-01-31 14:00:57 +01:00
Kibana Machine
52d2b66922 skip failing test suite (#209024) 2025-01-31 23:59:37 +11:00
Elena Shostak
9120c36e16
[FTR] Skipped basic license tests for FIPS (#208916)
## Summary
All tests in
`deployment_agnostic/security_and_spaces/stateful.config_basic.ts` and
`deployment_agnostic/security_and_spaces/stateful.copy_to_space.config_basic.ts`
are intended to be run only with `basic` license, since FIPS overrides
it we need to skip that test for FIPS.

Separated index entries for `basic` and `trial` license, so tests with
trial config would still run.

### Checklist

- [x] [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>
2025-01-31 13:56:29 +01:00
Matthew Kime
ab9492c107
[index management] unskip api integration test (#209034)
## Summary

This change follows from
https://github.com/elastic/elasticsearch/pull/120539

'frozen' attribute will no longer be returned in 9.0 and greater since
there are no longer frozen indices

Closes: https://github.com/elastic/kibana/issues/208873
2025-01-31 05:31:41 -06:00
Xavier Mouligneau
ac22f58bc3
[CLOUD] Add security question in onboarding (#208229)
## Summary

https://github.com/elastic/cloud/issues/133183



### Checklist

- [x] [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: Kateryna Stukan <92258556+galaxxyz@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-01-31 10:22:22 +01:00
Antonio
5a57f40f67
[ResponseOps] Fix connector test (#208754)
## Summary

This PR fixes a test introduced in
https://github.com/elastic/kibana/pull/208033
2025-01-31 09:11:15 +01:00
Tiago Costa
296c452345
chore(NA): bump version to 9.1.0 (#208990)
Usually bump from 9.0.0 to 9.1.0
2025-01-31 06:05:13 +00:00
Kibana Machine
396804f0f0 skip failing test suite (#209027) 2025-01-31 11:32:16 +11:00
seanrathier
df4a6d7ce3
[Cloud Security] Unskipped and fixed flaky agentless test (#208844) 2025-01-31 00:36:59 +01:00
Kibana Machine
970d805f74 skip failing test suite (#209014) 2025-01-31 06:58:50 +11:00
Devin W. Hurley
4419390282
[Security Solution] [Detection Engine] Logs shard failures for eql event queries on rule details page and in event log (#207396)
## Summary

Related: https://github.com/elastic/elasticsearch/pull/116388/

Adds support for shard failures for EQL event queries in the detection
engine.
2025-01-30 20:55:53 +01:00
Krzysztof Kowalczyk
b35e1051e6
[Guided Onboarding] Remove "Setup Guides" buttons (#208510)
## Summary
This PR removes `Setup Guides` buttons.
Closes: #207026

> [!NOTE]
All the tests in
`src/platform/plugins/shared/guided_onboarding/public/components/guide_panel.test.tsx`
depend on those buttons so it was easier to remove those tests.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-01-30 20:43:08 +01:00
Nathan Reese
758768136d
[dashboard] remove legacy section from 'Add panel' flyout (#208116)
Users should use Lens to visualize data. Users should not use TSVB or
aggregation based panels. To this end, "easy button" UIs, such as
dashboard's "Add panel" flyout, should guide users to lens and not guide
them to legacy applications.

This PR removes `legacy` section from dashboard "Add panel" flyout.
Users can still add legacy panels to dashboards via "visualize"
application. The path is more steps, but this is as intended. Using old
stuff should be painful and require extra work as a caret to move users
to new stuff.

<img width="500" alt="Screenshot 2025-01-23 at 1 08 41 PM"
src="https://github.com/user-attachments/assets/e142cba9-a880-4ad6-a3f8-a981a03daaec"
/>

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-01-30 12:22:51 -07:00
Joe Reuter
2212a19bc8
🌊 Streams: Convert legacy types in frontend (#208608)
This PR gets rid of the usage of the legacy "readdefinition" types in
the frontend except for the enrichment view, because @tonyghiani is
working on that in parallel.

I first looked into whether we can just use the existing
`IngestStreamGetResponse` type, but since it doesn't carry the name of
the stream, that is actually super annoying to use - passing the name as
a separate argument is pretty annoying and increases the risk of bugs.

Even though it's not fully "Elasticsearch"-y, I decided to add the
stream name to the `IngestStreamGetResponse` - this way the `stream`
property in the response is a regular `StreamDefinition`, so all the
functions that act on it can use it right away.

This simplifies the frontend code without hurting programmatic API
users.
2025-01-30 19:36:59 +01:00
Tiago Costa
bd0d6820af
skip failing es promotion (#208874) 2025-01-30 17:29:36 +00:00
Tiago Costa
28e431c7c8
skip failing es promotion (#208870) 2025-01-30 17:27:07 +00:00
Tiago Costa
48d2e4c0b1
skip failing es promotion (#208871) 2025-01-30 17:24:32 +00:00
Tiago Costa
3537b2d008
skip failing es promotion (#208872) 2025-01-30 17:22:10 +00:00
Tiago Costa
d3a115b326
skip failing es promotion (#208873) 2025-01-30 17:17:20 +00:00
Kevin Qualters
0e7c608ed3
[Cases] Cases assignees sub feature (#201654)
## Summary

This pr implements a new cases assignee sub-feature, allowing users to
control a role's ability to change the assignee of a case. With the
permission enabled, they can assign any user to any case, with it
disabled, the assignees component is hidden.

Read only + enabled:

![image](https://github.com/user-attachments/assets/ba421784-d976-4ae9-a399-e404c26b3842)


All + assign disabled:

![image](https://github.com/user-attachments/assets/d835b6f9-5a14-4ae0-abed-b3c3252c2692)



### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [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>
2025-01-30 17:04:38 +01:00
Alex Prozorov
cd9096cf73
[Cloud Security] 10973 migrate flaky e2e tests to jest (#208345)
## Summary

This PR tries to fix the following issues - which are flaky FTR tests:

- https://github.com/elastic/kibana/issues/197143 - convert to unit test
- https://github.com/elastic/kibana/issues/190967 - fixed
- https://github.com/elastic/kibana/issues/187470 - fixed
- https://github.com/elastic/kibana/issues/186302 - convert to unit test
- https://github.com/elastic/kibana/issues/186438 - convert to unit test


There will be an RFC document which is going to be released to help us
better understand and decide which tests are more suitable to make as
E2E tests and which as unit tests.

### Checklist
- [x] [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
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

### Closes
this PR closes the above mentioned issues in relation for this ticket -
https://github.com/elastic/security-team/issues/10973
2025-01-30 16:23:25 +02:00
Joe Reuter
15fcb182e3
🌊 Streams: Add stream.name field (#208514)
Fixes https://github.com/elastic/streams-program/issues/103

This PR adds a constant keyword `stream.name` field that functions
similar to the `data_stream.dataset` field.

It will allow us to clearly associate a document or a set of documents
with their streams and filter data per stream efficiently. It's also
used to validate that documents are sent properly to the root stream
instead of targeting specific child streams directly.

The `stream.name` field reports as `keyword` in the UI, but is actually
mapped per index template as a constant keyword set to the respective
value.
2025-01-30 14:25:19 +01:00
Efe Gürkan YALAMAN
a172cb5691
[FTR][Synonyms UI] Add Synonyms overview FTRs (#208723)
## Summary

Adds FTR tests for synonyms

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.


- [ ] [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)
- [ ] [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)
2025-01-30 01:46:08 +01:00
Patryk Kopyciński
1935cedeaa
[Security Assistant] Switch to use default inference endpoint (#208668)
## Summary

In 8.17 we have introduced `semantic_text`
https://github.com/elastic/kibana/pull/197007 which required dedicated
inference endpoint.
As we now have default `.elser-2-elasticsearch` inference endpoint
available we want to migrate it out, but it's not possible to just
override `inference_id` mapping for the Knowledge Base data stream, so
instead we decided to first update the mapping by adding
`search_inference_id` pointing to the `.elser-2-elasticsearch` (to make
sure the data is queryable without the dedicated endpoint). Then we
update the Data Stream mapping to use the default endpoint and after
that we rollover the DS index to make sure new index is created and new
inference endpoint is used for new Knowledge Base data ingestion.

Will add testing steps soon
2025-01-30 01:00:33 +01:00
Efe Gürkan YALAMAN
2cb7bea5f3
[Synonyms UI] Search synonyms rule flyout (#208564)
## Summary

Adds search synonym rule flyout.
Adds endpoints and hooks for synonym rule management.


https://github.com/user-attachments/assets/e43b4a40-6452-4cfd-921f-2bde1219f219



### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] 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)
- [ ] [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
- [ ] [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)
2025-01-29 22:55:52 +01:00
Davis McPhee
b53d3990a2
[Saved Queries] Rework saved query privileges (#202863)
## Summary

This PR reworks saved query privileges to rely solely on a single global
`savedQueryManagement` privilege, and eliminates app-specific overrides.
This change simplifies the security model for users, fixes bugginess in
the saved query management UI, and reduces code complexity associated
with maintaining two separate security mechanisms (app-specific
overrides and global saved query management privileges).

### Background

Saved queries allow users to store a combination of KQL or Lucene
queries, filters, and time filters to use across various applications in
Kibana. Access to saved query saved objects are currently granted by the
following feature privileges:
```json
[
  "feature_discover.all",
  "feature_dashboard.all",
  "feature_savedQueryManagement.all",
  "feature_maps.all",
  "feature_savedObjectsManagement.all",
  "feature_visualize.all"
]
```

There is also a saved query management UI within the Unified Search bar
shared by applications across Kibana:
<img
src="https://github.com/user-attachments/assets/e4a7539b-3dd4-4d47-9ff8-205281ef50e3"
width="500" />

The way access to this UI is managed in Kibana is currently confusing
and buggy:
- If a user has `feature_discover.all` and `feature_dashboard.all` they
will be able to load and save queries in Discover and Dashboard.
- If a user has `feature_discover.all` and `feature_dashboard.read` they
will be able to load queries in both Discover and Dashboard, but only
save queries in Discover (even though they have write access to the SO,
and API access). Instead they have to navigate to Discover to save a
query before navigating back to Dashboard to load it, making for a
confusing and frustrating UX.
- Access to the UI is even more confusing in apps not listed in the
above feature privileges (e.g. alerting, SLOs). Some of them chose to
check one of the above feature privileges, meaning users who otherwise
should have saved query access won't see the management UI if they don't
also have the exact feature privilege being checked. Other apps just
always show the management UI, leading to bugs and failures when users
without one of the above feature privileges attempt to save queries.

### Existing improvements

In v8.11.0, we introduced a new ["Saved Query
Management"](https://github.com/elastic/kibana/pull/166937) privilege,
allowing users to access saved queries across all of Kibana with a
single global privilege:
<img
src="https://github.com/user-attachments/assets/ccbe79a4-bd0b-4ed6-89c9-117cc1f99ee2"
width="600" />


When this privilege is added to a role, it solves the
`feature_discover.all` and `feature_dashboard.read` issue mentioned
above. However, it does not fix any of the mentioned issues for roles
without the new privilege. We have so far postponed further improvements
to avoid a breaking change.

### Approach

To fully resolve these issues and migrate to a single global privilege,
these changes have been made:
- Remove saved query SO access from all application feature privileges
and instead only allow access through the global saved query management
privilege.
- Stop relying on application feature privileges for toggling the saved
query management UI, and instead rely on the global privilege.

To implement this with minimal breaking changes, we've used the Kibana
privilege migration framework. This allows us to seamlessly migrate
existing roles containing feature privileges that currently provide
access to saved queries, ensuring they are assigned the global saved
query management privilege on upgrade.

As a result, we had to deprecate the following feature privileges,
replacing them with V2 privileges without saved query SO access:
```json
[
  "feature_discover.all",
  "feature_dashboard.all",
  "feature_maps.all",
  "feature_visualize.all"
]
```

Each area of code that currently relies on any of these feature
privileges had to be updated to instead access `feature_X_V2` instead
(as well as future code).

This PR still introduces a minor breaking change, since users who have
`feature_discover.all` and `feature_dashboard.read` are now able to save
queries in Dashboard after upgrade, but we believe this is a better UX
(and likely the expected one) and worth a small breaking change.

### Testing
- All existing privileges should continue to work as they do now,
including deprecated V1 feature privileges and customized serverless
privileges. There should be no changes for existing user roles apart
from the minor breaking change outlined above.
- Check that code changes in your area don't introduce breaking changes
to existing behaviour. Many of the changes are just updating client UI
capabilities code from `feature.privilege` to `feature_v2.privilege`,
which is backward compatible.
- The `savedQueryManagement` feature should now globally control access
to saved query management in Unified Search for all new user roles.
Regardless of privileges for Discover, Dashboard, Maps, or Visualize,
new user roles should follow this behaviour:
- If `savedQueryManagement` is `none`, the user cannot see or access the
saved query management UI or APIs.
- If `savedQueryManagement` is `read`, the user can load queries from
the UI and access read APIs, but cannot save queries from the UI or make
changes to queries through APIs.
- If `savedQueryManagement` is `all`, the user can both load and save
queries from the UI and through APIs.

### Checklist

- [x] 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/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [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)
- [x] 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
- [x] 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)

### Identify risks

This PR risks introducing unintended breaking changes to user privileges
related to saved queries if the deprecated features have not been
properly migrated, and users could gain or lose access to saved query
management on upgrade. This would be bad if it happened, but not overly
severe since it wouldn't grant them access to any ES data they couldn't
previously access (only query saved objects). We have automated testing
in place to help ensure features have been migrated correctly, but the
scope of these changes are broad and touch many places in the codebase.

Additionally, the UI capabilities types are not very strict, and are
referenced with string paths in many places, which makes changing them
riskier than changing strictly typed code. A combination of regex
searches and temporarily modifying the `Capabilities` type to cause type
errors for deprecated privileges was used to identify references in
code. Reviewers should consider if there are any other ways that UI
capabilities can be referenced which were not addressed in this PR.

Our automated tests already help mitigate the risk, but it's important
that code owners thoroughly review the changes in their area and
consider if they could have unintended consequences. The Platform
Security team should also review this PR thoroughly, especially since
some changes were made to platform code around privilege handling. The
Data Discovery team will also manually test the behaviour when upgrading
existing user roles with deprecated feature privileges as part of 9.0
upgrade testing.

---------

Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
Co-authored-by: Matthias Wilhelm <ankertal@gmail.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: “jeramysoucy” <jeramy.soucy@elastic.co>
2025-01-29 17:34:58 -04:00
Tiago Vila Verde
5b22aa9b66
[Entity Analytics][Entity Store] Add transform config options to the API (#208062)
## Summary


This PR adds the following parameters to the `INIT` engine API:

* `frequency`: the transform run frequency
* `timeout`: the timeout for the initial creation of the transform
* `docsPerSecond`: transform throttling option. See
[here](https://arc.net/l/quote/vxcmfnhh)
* `delay`: The transform delay duration. See
[here](https://arc.net/l/quote/mzvaexhv)
Coming soon


In addition, the PR adds these fields to the Saved Object with the
engine descriptor, as well as providing a migration with the appropriate
backfilling.

Finally, there are some utility function that were/are helpful in
working with objects.

## How to test

*NOTE*: Always make sure the security default data view exists. Easiest
way it to just navigate to some Security UI.

### Checking the new defaults

1. Initialize an engine via dev tools by calling: `POST
kbn:/api/entity_store/engines/<entity_type>/init {}`
2. Call `GET kbn:/api/entity_store/status`. This response should now
contain all the default optional values.

### Observing the parameters are being applied

1. Initialize an engine via the API. This time pass any of the `timeout,
frequency, delay and docsPerSecond` options in the request body.
2. Once the `status` changes to `started`, query the respective
transform: `GET
_transform/entities-v1-latest-security_<entity_type>_default`
3. Check that the parameters have been applied to the transform

### Checking Saved Object Migration

1. Check out `main`.
2. Initialize the store.
3. Query `GET kbn:/api/entity_store/status`. Note down the fields in the
engine object.
4. Check out this branch.
5. Restart kibana.
6. Query `GET kbn:/api/entity_store/status` again. Observe the new
fields have been added and backfilled

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-01-29 20:31:47 +00:00
Rodney Norris
95d863bc8b
[Search] [Onboarding] Hosted Quick Stats (#207925)
## Summary

This PR updates the `search_indices` Index Details page to support
quicks stats specific to stateful indices.

### Demo


https://github.com/user-attachments/assets/5584f0b4-a7cb-4802-8aef-6708642a4629

### Checklist

- [ ] 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)
- [ ] [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-01-29 21:24:38 +01:00
Elena Shostak
9c1b849556
[FTR] Skipped tests for FIPS (#208759)
## Summary

## Summary
All tests in
`x-pack/test/spaces_api_integration/deployment_agnostic/security_and_spaces/stateful.config_basic.ts`
are intended to be run only with `basic` license, since FIPS overrides
it we need to skip that test for FIPS.

### Checklist

- [x] [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
2025-01-29 20:33:36 +01:00
Yngrid Coello
cefe0c823b
[Dataset quality] Authz migration (#208343)
Closes https://github.com/elastic/kibana/issues/206392.

---------

Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
2025-01-29 18:59:59 +01:00
Kfir Peled
7ac553ce89
[Cloud Security] Collecting telemetry of graph visualization usage (#207154)
## Summary

Collects two events of graph visualization usage

1. When graph preview is shown - allows to determine how many users
ingested data that is graph compliant
2. When graph investigation component is visible - allows to determine
how many users entered the investigation user flow

**How to test:**

- Enable the feature flag 

`kibana.dev.yml`:

```yaml
uiSettings.overrides.securitySolution:enableVisualizationsInFlyout: true
uiSettings.overrides.securitySolution:enableGraphVisualization: true
```

- Load mocked data:

```bash
node scripts/es_archiver load x-pack/test/cloud_security_posture_functional/es_archives/logs_gcp_audit \ 
  --es-url http://elastic:changeme@localhost:9200 \
  --kibana-url http://elastic:changeme@localhost:5601

node scripts/es_archiver load x-pack/test/cloud_security_posture_functional/es_archives/security_alerts \
  --es-url http://elastic:changeme@localhost:9200 \
  --kibana-url http://elastic:changeme@localhost:5601
```

- Make sure you include data from Oct 13 2024. (in the video I use Last
year)
- Run in dev tools:
```
POST kbn:/internal/telemetry/clusters/_stats?pretty=true&apiVersion=2
{
  "unencrypted": true,
  "refreshCache": true
}
```
- Check if the ui_counters were reported

![Screenshot 2025-01-28 at 23 22
08](https://github.com/user-attachments/assets/b09d4870-80f1-4026-bc98-28ad1d495ffb)
2025-01-29 18:31:20 +01:00
Dmitrii Shevchenko
199378c60c
[Security Solution] Implement rule customization license checks (#206079)
**Resolves:** https://github.com/elastic/security-team/issues/10410

## Summary

We want to make Rule Customization available at higher license tiers.  

### **Intended Workflows/UX**  

#### **Basic/Platinum/Security Essentials License Tiers**  
- **Editing Prebuilt Rules:**  
- Allow the 8.16 behavior: only actions, exceptions, snoozing, and
enable/disable options can be modified.
- On the rule editing page, all tabs except *Actions* are disabled.
Disabled tabs will display a hover explanation:
- "Upgrade to Enterprise to enable prebuilt rule customization" for ECH.
- "Upgrade to Security Complete to enable prebuilt rule customization"
for Serverless.
<img width="356" alt="image"
src="https://github.com/user-attachments/assets/72e60933-aaaf-45a0-9660-4cd066d3afec"
/>

- Rule editing via API is not restricted (tracked separately:
https://github.com/elastic/security-team/issues/11504.

- **Bulk Actions:**  
- Modifications to rule content via bulk actions are not allowed.
Prebuilt rules are excluded from bulk actions if the license level is
insufficient. Users will see an explanation for the exclusion.
    - Serverless
<img width="737" alt="image"
src="https://github.com/user-attachments/assets/99fef72f-dd38-4c73-a9e3-7b4c8018b4ed"
/>
    - ECH

- On the API level (`_bulk_action`), an error is returned if a user
tries to modify a prebuilt rule without the required license. Response
in this case looks like this:
    ```json
    {
      "statusCode": 500,
      "error": "Internal Server Error",
      "message": "Bulk edit failed",
      "attributes": {
         "errors": [
           {
             "message": "Elastic rule can't be edited",
             "status_code": 500,
             "rules": []
           }
         ]
      }
    }
    ```

- **Rule Updates:**  
  - Updates are restricted to Elastic’s incoming updates only.  
  - The rule upgrade flyout is in read-only mode.
<img width="949" alt="image"
src="https://github.com/user-attachments/assets/16a56430-63e6-4096-8ffd-b97f828abdd4"
/>
- For previously customized rules where customization is now disabled
due to insufficient licensing, a notification will appear on the upgrade
flyout, clarifying that only an upgrade to Elastic's version is
available.

![image](https://github.com/user-attachments/assets/34ef5168-4fe3-42d0-9444-14180ed86500)
- On the API level (`_perform`), only requests with `pick_version =
target` are permitted. Requests with `rule.fields` values are not
allowed.
    API response when `pick_version` is not `target`:
    ```json
    {
"message": "Only the 'TARGET' version can be selected for a rule update;
received: 'CURRENT'",
      "status_code": 400
    }
    ```
    API response when the `fields` value is provided:
    ```json
    {
"message": "Rule field customization is not allowed. Received fields:
name, description",
      "status_code": 400
    }
    ```

- **Customized Rules:**  
- Existing customizations remain intact, and the “Modified” badge is
retained
    - On the rule management, monitoring, and update tables:

![image](https://github.com/user-attachments/assets/c7990c8f-5ed3-40ab-b0c6-ddc329e69b09)
    - On the rule update flyout:

![image](https://github.com/user-attachments/assets/f74cb0bc-e7e5-49d5-8fec-b447517b5b52)
    - On the rule details page:

![image](https://github.com/user-attachments/assets/b28990f1-9e84-481e-b966-0232495f4882)

- When we edit a rule with customizations (e.g., change rule's actions),
the rule should stay marked as customized


- **Import/Export Scenarios:**  
- These are handled separately
(https://github.com/elastic/security-team/issues/11502)

#### **Enterprise/Security Complete License Tiers**  
- All rules can be fully edited
- Upgraded prebuilt or customized rules will have an editable view,
enabling full customization
2025-01-29 18:20:47 +01:00
Kevin Lacabane
87a068be0f
[streams] configuration of dsl lifecycle for unwired streams (#208500)
Allow inherit/dsl lifecycles on unwired streams:

- inherit is a noop. it keeps the data streams lifecycle configuration
untouched
- dsl will apply a retention if the data stream is either unmanaged or
already using a dsl
 
Since we're still discussing how to apply ilm/fields changes on unwired
streams, ilm is currently disabled.

### Testing
- update an unmanaged/ilm/dsl unwired stream 

```
PUT kbn:/api/streams/logs-foo-default
{
  "stream": {
    "ingest": {
      "lifecycle": {
        "dsl": {}
      },
      "routing": [],
      "processing": [],
      "unwired": {}
    }
  },
  "dashboards": []
}
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-01-29 18:09:24 +01:00
Jared Burgett
44dd7c49fb
Added Entity Store data view refresh task (#208543)
# Background

This change introduces a new Kibana task within the Security solution.
When the Security solution's entity store feature is enabled, the task
is scheduled in order to continuously reflect changes to the Security
solution's default data view, thereby updating the Transform associated
with the Entity Store when necessary.

# Implementation notes

A key problem when updating/upgrading a transform in the background is
that Elasticsearch requires a user to make the request for these
changes, but no "user" is present in background tasks. The internal
Kibana user does not suffice, because it does not always have access to
the underlying indices.

To accomplish the above, this PR leverages the Entity Manager's ability
to store the API Key of the user who installed the entity store, and
makes any associated changes to the Transform using that user's stored
API key. Said API key is encrypted, and uses a deterministic ID per
installed space in order to support later retrieval.

A single API key is installed per space, meaning multiple entity
"engines" in a space will leverage a single API key for updates.

# Steps to test locally

1. Pull down the code
2. To assist with a quicker feedback loop, manually edit the task's
`interval` constant to a low value, such as `1m`. This value can be
found
[here](x-pack/solutions/security/plugins/security_solution/server/lib/entity_analytics/entity_store/tasks/data_view_refresh/constants.ts)
3. Start Kibana
4. Load desired entity test event data. (For example, the internal
[security-documents-generator](https://github.com/elastic/security-documents-generator)
repository's `yarn start entity-store` command can be used)
5. Enable the Security Entity Store by navigating to "Management->Entity
Store"
6. Validate the list of indices in the current transform by navigating
to `/app/management/data/transform` in Kibana, and clicking
"entities-v1-latest-security_host_default->JSON", looking for the
`source.index` field
7. Update the security default data view's index patterns to include a
new pattern. To do so, navigate to `/app/management/kibana/dataViews` in
Kibana, click the data view with the "Security Data View" badge, click
edit, and change the "Index pattern" by adding a comma and a new pattern
to the end, such as `,some-cool-pattern-*`. Save the change.
8. Wait the appropriate amount of time, as defined in step 2.
(Optionally check the Kibana console logs for activity.)
9. Once again, validate the list of indices within the transform as in
step 6, but this time see that the new index pattern is included.

---------

Co-authored-by: Pablo Machado <pablo.nevesmachado@elastic.co>
2025-01-29 10:42:02 -06:00
Sergi Massaneda
93f67462d2
[Security Solution][Siem migrations] Swap experimental flag for ESS (#208541)
## Summary

This PR enables the SIEM migrations experimental flag by default in
ESS/on-prem.
We keep the experimental flag disabled in serverless (using
`config/serverless.security.yml`) since we don't want to release it yet.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-01-29 16:32:04 +01:00
Sid
66dab0ae0e
[Roles] Use Query Roles API for Role Management grid screen (#194630)
Closes https://github.com/elastic/kibana/issues/186266

## Release notes

Enhanced Role management to manage larger number of roles by adding
server side filtering, pagination and querying.

## Summary
- Replaced the usage of Get Roles API with Query Role API
- Added server side pagination and filtering with a maximum limit of
10000 keys (default for max results on index). Added new label to
indicate that we show only 10k results.
- Search box replicates client side implementation by only filtering on
Role names.

### Run locally
Start ES ~with the JVM option to enable this feature~:
```
yarn es snapshot --license=trial
```
Start Kibana normally
```
yarn start --no-base-path
```

Navigate to Stack Management > Roles and verify the same behavior as the
screen recording below

### Screen recording


https://github.com/user-attachments/assets/a447e7df-8aa1-4044-a6b2-0aafe56844a9



## Technical notes
- Client side EuiInMemory table has been replaced by EuiSearchBar,
EuiBasicTable and Filters
- One new Kibana endpoint added
    -  `roles/_query` 
- Replicates existing get_role endpoint by being public and added to
Open API spec
- Extra logic to handle previously UI only filter to show/hide reserved
roles
- Parse the query to construct the correct DSL if the filter is present
- Update Get All Roles by Space internal API to use the Query Role and
filter by space id using query DSL.

### Checklist

Delete any items that are not applicable to this PR.

- [x] 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/packages/kbn-i18n/README.md)
- [x] [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>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-01-29 15:38:03 +01:00
Yan Savitski
c7e62fc01b
[Search] [Onboarding] Onboarding start page redirect (#207718)
## Summary

Add redirection to Onboarding start page when user goes to Overview Page
in solution mode and hasn't any indices
2025-01-29 13:53:47 +01:00
Kfir Peled
dbd06296cc
[Cloud Security] Converts graph visualization from experimental feature to the advanced settings (#208614)
## Summary

During 8.17 development cycle, we introduced a new feature behind an
experimental flag.
Now, in 8.18/9.0 a user could toggle the feature through the advanced
settings.
This will allow users on serverless to use this feature.
This change does not introduce a breaking change.

![Screenshot 2025-01-28 at 20 05
03](https://github.com/user-attachments/assets/80187838-ee8d-462a-aefd-04f9b96cd0c8)

### How to test 

1. Toggle the feature flags
2. Load mock data

```bash
node scripts/es_archiver load x-pack/test/cloud_security_posture_functional/es_archives/logs_gcp_audit \ 
  --es-url http://elastic:changeme@localhost:9200 \
  --kibana-url http://elastic:changeme@localhost:5601

node scripts/es_archiver load x-pack/test/cloud_security_posture_functional/es_archives/security_alerts \
  --es-url http://elastic:changeme@localhost:9200 \
  --kibana-url http://elastic:changeme@localhost:5601
```

3. Go to the alerts page
4. Change the query time range to show alerts from the 13th of October
2024 (**IMPORTANT**)
5. Open the alerts flyout
6. Scroll to see the graph visualization : D


### Checklist

- [x] 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/packages/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
- [x] [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-01-29 10:48:51 +00:00
Konrad Szwarc
413033aa8f
[EDR Workflows] Enable Workflow Insights FF (#204242)
This PR enables the feature flag for workflow insights, activates defend
insights within the Assistant scope, and aligns the tests accordingly.
The added privileges originate from [this
PR](https://github.com/elastic/kibana/pull/205088).
2025-01-29 11:40:45 +01:00
Kibana Machine
5672d8815a skip failing test suite (#208603) 2025-01-29 21:08:37 +11:00