Commit graph

81577 commits

Author SHA1 Message Date
Kevin Lacabane
58f51fdac7
[eem] metadata as keyword (#202611)
Cast identity fields and metadata fields as keyword to prevent ambiguous
mappings error

### Testing

- setup data
```
PUT service-name-as-keyword
{
    "mappings": {
        "dynamic": false,
        "properties": {
            "service.name": {
                "type": "keyword"
            }
        }
    }
}

POST service-name-as-keyword/_doc
{
  "service.name": "as-keyword"
}

PUT service-name-as-text
{
    "mappings": {
        "dynamic": false,
        "properties": {
            "service.name": {
                "type": "text"
            }
        }
    }
}


POST service-name-as-text/_doc
{
  "service.name": "as-text"
}
```

- data loads successfully in `/app/entity_manager`
![Screenshot 2024-12-03 at 11 50
10](https://github.com/user-attachments/assets/12d6cbd8-c075-475f-b140-9158e93158ff)

_new query_
```
POST _query
{
    "query": """FROM service-name-as* | WHERE service.name::keyword IS NOT NULL | STATS  BY service.name::keyword | RENAME `service.name::keyword` AS service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10"""
}
```

- previous query fails with ambiguous mappings error
```
POST _query
{
    "query": """FROM service-name-as* | WHERE service.name IS NOT NULL | STATS  BY service.name | EVAL entity.type = "service", entity.id = service.name, entity.display_name = entity.id | SORT entity.id ASC | LIMIT 10"""
}
```
2024-12-05 12:57:12 +01:00
youhonglian
bd576e6cef
[Upgrade Assistant] Add confirmation modal before migrating system indices (#200117) 2024-12-05 11:54:34 +00:00
José Luis González
4899c971fb
[Search] Web crawler name consistency (#202738)
## Summary

This PR fixes the areas where we display the Web Crawler naming bearing
in mind these agreements :
- We should be capitalizing when referring to the product name: Elastic
Web Crawler / Web Crawler /Elastic Open Web Crawler
- We can use lower case when referring to the feature or concept of web
crawler( crawler in short): "Use the web crawler to ..."

ESS:
![CleanShot 2024-12-03 at 15 19
19@2x](https://github.com/user-attachments/assets/d5cba886-09b3-4c34-b6e5-565cb67b9e08)

ES3:
![CleanShot 2024-12-03 at 15 19
56@2x](https://github.com/user-attachments/assets/2a6b6a8a-697c-4001-96d8-c826b6769836)


Notes: Also fixing buttons that take users to the Open Web Crawler repo
to open the links in a new tab and don't lose the product focus.
2024-12-05 12:32:33 +01:00
Antonio
7498ab0061
[ResponseOps][Rules] Hide the "Role visibility" dropdown in the new rule form in serverless (#200727)
Fixes #199642

## Summary

~~This PR hides the role visibility dropdown in the new rule form when
in serverless.~~

This PR hides the role visibility dropdown in the new rule form **when
only one consumer is available**.

## How to test

1. Run Kibana security serverless and confirm the rules in stack
management do not have the role visibility dropdown.
2. Please also make sure that the drop-down still shows when
needed(outside of serverless).
2024-12-05 12:20:37 +01:00
Marco Antonio Ghiani
f30f0a8f33
[Logs] Deprecate advanced settings for v9.0.0 (#201102)
## 📓 Summary

Closes #200900 

As part of the readiness requirements to upgrade Kibana to v9.0.0, this
work deprecates some advanced settings that will be removed.

<img width="2568" alt="Screenshot 2024-11-21 at 11 15 25"
src="https://github.com/user-attachments/assets/81b9a8dc-6ad2-4646-9516-ed9a90d7bef2">

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
2024-12-05 11:49:52 +01:00
Milosz Marcinkowski
ab9de649fe
[APM] Time spent by span type chart rendering problems (#202755)
Closes #202343

## Summary

This PR solves the following issues in `Time spent by span type` chart:
- limits percentages between 0% and 100% (converts negative values to
0%),

before: 
<img width="1134" alt="Screenshot 2024-12-04 at 15 28 18"
src="https://github.com/user-attachments/assets/73285e87-3aef-4b2d-8e2a-7e3ec87680f3">
after:
<img width="1135" alt="Screenshot 2024-12-04 at 15 30 25"
src="https://github.com/user-attachments/assets/ae25cb85-d31a-490a-96c7-d4475952c734">

---

- rounds percentage to 8 decimal points to prevent scientific notation
in charts (poor readability)

before: 
<img width="1132" alt="Screenshot 2024-12-04 at 14 36 54"
src="https://github.com/user-attachments/assets/528cda4b-ae84-4dbd-9d3f-88896e63a369">
after:
<img width="1132" alt="Screenshot 2024-12-04 at 14 35 39"
src="https://github.com/user-attachments/assets/9a0bdce9-6d66-4aaf-a131-18644eab1892">
2024-12-05 11:08:05 +01:00
Joe McElroy
486bdbf3fe
[Search] [Onboarding] unskip FTR tests (#202818)
## Summary

Updates the API Key specific tests to retry by deleting the api keys and
reloading and perform test again.


### 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/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
- [ ] [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.
- [x] [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)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-12-05 10:02:11 +00:00
Marco Antonio Ghiani
2994b0001c
[Logs] Deprecate configuration settings (#201625)
## 📓 Summary

Closes #200898 

These changes deprecate some unused configurations and update the
implementation where required in preparation for the Kibana v9 upgrade.

<img width="3004" alt="Screenshot 2024-11-25 at 12 54 14"
src="https://github.com/user-attachments/assets/cfa56d25-a270-4ec5-a97a-e72e7a7478a4">

---------

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-12-05 10:23:54 +01:00
Shahzad
542aa52171
[Synthetics] Run synthetics runner based tests on package.json changes !! (#202995)
## Summary

Run synthetics runner based tests on package.json changes !!
2024-12-05 10:19:11 +01:00
Shahzad
51e63eeacc
[SLOs] Added $state into filters schema !! (#202887)
## Summary

fixes https://github.com/elastic/kibana/issues/202999

Added $state  into filters schema !!
2024-12-05 10:12:48 +01:00
Ievgen Sorokopud
efb7890efe
[Security Solution] Move ES|QL parsing functionality into @kbn/securitysolution-utils package (#202772)
## Summary

With this PR we move existing `parseEsqlQuery` method into a shared
security solution utils package. We need to the same functionality in
"SIEM migrations" feature. Previously we duplicated the code in [this
PR](https://github.com/elastic/kibana/pull/202331/files#diff-b5f1a952a5e5a9685a4fef5d1f5a4c3b53ce338333e569bb6f92ccf2681100b7R54)
and these are the follow-up changes to make parsing functionality shared
for easier re-use within security solution.

### 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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-12-05 10:12:32 +01:00
Marta Bondyra
2f1ef6f345
[Collapsable panels][A11y] Tabbing through panels in a correct order (#202365)
## Summary

This is a preparatory step for keyboard navigation improvements.

It ensures proper tabbing order by aligning grid positions with the
sequence in the HTML structure, as recommended for accessibility.
Manipulating the tabindex property is an alternative but it's not a good
approach. Keeping grid layouts consistent with the HTML flow is a more
sustainable and accessible approach, as outlined in [related
documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout/Grid_layout_and_accessibility).


https://github.com/user-attachments/assets/d41eac8d-1ee1-47b1-8f40-e3207796573b

I also modified styles for drag and resize handles.

hover:
<img width="913" alt="Screenshot 2024-11-29 at 20 47 13"
src="https://github.com/user-attachments/assets/8348e5ee-9712-4a2b-9135-80a98715dc58">

focus:

<img width="803" alt="Screenshot 2024-11-29 at 20 47 40"
src="https://github.com/user-attachments/assets/8ee65354-0f7e-4394-9718-44d7e2a46700">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-12-05 09:10:22 +01:00
Kibana Machine
3049e8984e
[api-docs] 2024-12-05 Daily api_docs build (#203047)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/912
2024-12-05 01:17:20 -06:00
Kibana Machine
1ab7d42a8a skip failing test suite (#202328) 2024-12-05 13:19:11 +11:00
Kibana Machine
72d3eaba2b skip failing test suite (#196257) 2024-12-05 13:13:20 +11:00
Tiago Costa
a4baa5cc0a
skip flaky suite (#202945) 2024-12-05 02:07:12 +00:00
Kibana Machine
37b68a1e6f skip failing test suite (#202337) 2024-12-05 13:05:53 +11:00
Tiago Costa
0d3e5960b3
skip flaky suite (#202147) 2024-12-05 02:03:29 +00:00
Tiago Costa
8b8c6d3802
skip flaky suite (#201611) 2024-12-05 02:01:50 +00:00
Tiago Costa
6d36e2317b
skip flaky suite (#202940) 2024-12-05 01:59:15 +00:00
Tiago Costa
3c96e8f391
skip flaky suite (#199204) 2024-12-05 01:54:55 +00:00
Dzmitry Lemechko
cdb5a2dca2
[kbn-test] extract ES logs only for svl (#202927)
## Summary

PR fixes the issue reported by @dolaru when running stateful FTR
environment without docker setup locally:

```
 info [es] killing node
 info [es] stopping node scout
 info [es] no debug files found, assuming es did not write any
 info [es] cleanup complete
ERROR UNHANDLED ERROR
ERROR Error: Command failed with exit code 1: docker ps -a --format {{.Names}}
      error during connect: Get "http://docker.example.com/v1.47/containers/json?all=1": command [ssh -o ConnectTimeout=30 -T -l dolaru -- debian-12-vm docker system dial-stdio] has exited with exit status 255, make sure the URL is valid, and Docker 18.09 or later is installed on the remote host: stderr=ssh: Could not resolve hostname dolaru-m2-mbp-debian.local: nodename nor servname provided, or not known
          at makeError (/Users/dolaru/workspace/kibana/node_modules/execa/lib/error.js:60:11)
          at handlePromise (/Users/dolaru/workspace/kibana/node_modules/execa/index.js:118:26)
          at processTicksAndRejections (node:internal/process/task_queues:95:5)
          at extractAndArchiveLogs (extract_and_archive_logs.ts:34:41)
          at run_elasticsearch.ts:86:5
```

Since we don't need it for stateful ES instance, I added condition.
kbn-scout had the same issue, so I exported `cleanupElasticsearch` from
`kbn-test` to avoid code duplication
2024-12-05 00:19:41 +01:00
Nick Peihl
c8866e4ce3
[Dashboards][OAS] Generate API docs for Dashboards API (#199215) 2024-12-04 17:33:10 -05:00
Kibana Machine
56c38bca20
Unauthorized route migration for routes owned by kibana-visualizations,kibana-data-discovery (#198331)
### Authz API migration for unauthorized routes

This PR migrates unauthorized routes owned by your team to a new
security configuration.
Please refer to the documentation for more information: [Authorization
API](https://docs.elastic.dev/kibana-dev-docs/key-concepts/security-api-authorization)

--- EDIT ---

This PR also adds two privileges related to saved query APIs:
`savedQuery:read` and `savedQuery:manage`. These are given by default to
the same roles that already have access to the `query`-type saved
objects.

### **Before migration:**
```ts
router.get({
  path: '/api/path',
  ...
}, handler);
```

### **After migration:**
```ts
router.get({
  path: '/api/path',
  security: {
    authz: {
      enabled: false,
      reason: 'This route is opted out from authorization because ...',
    },
  },
  ...
}, handler);
```

### What to do next?
1. Review the changes in this PR.
2. Elaborate on the reasoning to opt-out of authorization.
3. Routes without a compelling reason to opt-out of authorization should
plan to introduce them as soon as possible.
2. You might need to update your tests to reflect the new security
configuration:
  - If you have snapshot tests that include the route definition.

## Any questions?
If you have any questions or need help with API authorization, please
reach out to the `@elastic/kibana-security` team.

---------

Co-authored-by: Lukas Olson <lukas@elastic.co>
Co-authored-by: Matthias Wilhelm <matthias.wilhelm@elastic.co>
Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>
Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
2024-12-04 15:29:15 -07:00
Jeramy Soucy
52e021ff7f
Upgrade axios 1.7.4 → 1.7.9 (#202774)
## Summary

Upgrades `axios` from v1.7.4 to v1.7.9.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-12-04 17:13:35 -05:00
Samiul Monir
329d3c51f3
Adding Tech Preview badge for Reranker (#202561)
## Summary

Adding a `Tech Preview` badge for `reranker` model.


![reranker](https://github.com/user-attachments/assets/eb370f82-5127-4a9c-a00d-9a6d8adca34c)



### 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/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>
2024-12-04 16:49:31 -05:00
Steph Milovic
e099b31893
[Security Assistant] Product documentation tool (#199694) 2024-12-04 14:16:45 -07:00
Jeramy Soucy
f8860e91cf
Upgrade webpack 5.91.0 → 5.96.1 (#202534)
## Summary

Upgrades references to webpack5 from v5.91.0 to v5.96.1

A v4 to v5 upgrade is being explored here:
https://github.com/elastic/kibana/pull/191106

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-12-04 15:28:12 -05:00
Viduni Wickramarachchi
d669c83be8
[Obs AI Assistant] Manual migration for routes with access tag (#202817)
## Summary

### Problem
`tags: [access:ai_assistant]` is deprecated. 

### Solution
All the routes that use this tag needs to be migrated to the `authz`:
`requiredPrivileges` property.

### 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] 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)
2024-12-04 15:21:25 -05:00
Joe Reuter
a6f5017623
Logs settings: Remove sample data from default (#202981)
Closes https://github.com/elastic/kibana/issues/195867
2024-12-04 20:33:18 +01:00
Devin W. Hurley
3bb6bab8e7
[Security Solutoin] [Detections] skip flaky eql sequence test (#202977)
## Summary

skips flakey test: https://github.com/elastic/kibana/issues/202945
2024-12-04 13:21:00 -06:00
Aleksandr Maus
bb8183a67d
config/serverless.{security,oblt}.yml - exclude deprecated integrations (#194644)
This adds exclusions for deprecated "rsa2elk" integration packages to Serverless projects.
The following packages should be excluded from Serverless.
 
- bluecoat
- cylance
- f5
- fortinet_forticlient
- juniper_junos
- juniper_netscreen
- netscout
- radware
- tomcat

---------

Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
2024-12-04 13:10:34 -06:00
Dima Arnautov
e067fa239d
[ML] Trained Models: Optimize trained models Kibana API (#200977)
## Summary

Closes #191939 
Closes https://github.com/elastic/kibana/issues/175220

Adds various optimizations for the Trained Models page:

---

- Creates a new Kibana `/trained_models_list` endpoint responsible for
fetching complete data for the Trained Model UI page, including
pipelines, indices and stats.

Before the Trained Models page required 3 endpoints. The new
`trained_models_list` replaces them, reducing the overall latency.

<img width="715" alt="Screenshot 2024-12-02 at 16 18 32"
src="https://github.com/user-attachments/assets/34bebbdc-ae80-4e08-8512-199c57cb5b54">


---

- Optimized fetching of pipelines, indices and stats, reducing the
number of API calls to ES

Several issues with the old endpoint stemmed from the with_indices flag.
This flag triggered a method designed for the Model Map feature, which
involved fetching a complete list of pipelines, iterating over each
model, retrieving index settings multiple times, and obtaining both
index content and a full list of transforms.

The new endpoint solves these issues by fetching only the necessary
information for the Trained Model page with minimal calls to
Elasticsearch.

#### APM transaction with a new endpoint 
<img width="1822" alt="image"
src="https://github.com/user-attachments/assets/55e4a5f0-e571-46a2-b7ad-5b5a6fc44ceb">

#### APM transaction with an old endpoint


https://github.com/user-attachments/assets/c9d62ddb-5e13-4ac1-9cbf-d685fbed7808

---

- Improves type definitions for different model types

### 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
2024-12-04 12:50:18 -06:00
Stratoula Kalafateli
c2f706d250
[ES|QL] Removes the warnings from the console (#202899) 2024-12-04 19:37:05 +01:00
Davis Plumlee
13fa5259c8
[Security Solution] Disables author and license fields in rule edit form for prebuilt rule types (#201887)
## Summary

Fixes https://github.com/elastic/kibana/issues/200251

> [!NOTE]  
> This bug/related fix is only visible with the
`prebuiltRulesCustomizationEnabled` feature flag turned on.

Disables `author` and `license` fields in rule edit form for prebuilt
rule types as we throw API errors when they are changed from the
existing rule value if the rule source is external.


### Screenshots - the same prebuilt rule in the Rule edit form
**Before**
<img width="738" alt="Screenshot 2024-11-26 at 5 32 00 PM"
src="https://github.com/user-attachments/assets/6262cdb2-750a-47fb-b6b8-ec07f4acd8aa">


**After**
![Screenshot 2024-12-03 at 3 22
34 PM](https://github.com/user-attachments/assets/bfb4c468-3ea2-4fa0-bd36-a90c32eacce4)

### 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
2024-12-04 12:17:55 -06:00
Tiago Costa
d5a8e84fb7
chore(NA): update versions after v7.17.27 bump (#202810)
This PR is a simple update of our versions file after the recent bumps.
2024-12-04 17:58:51 +00:00
Tim Sullivan
d86896bac0
[SharedUX] Replace Sass with Emotion, Round 1 (#199885)
## Summary

Part of https://github.com/elastic/kibana-team/issues/1082

Selects certain Sass files to replace with styles declared with Emotion.
This PR does not include any changes that would be noticeable by
end-users. It changes the internals to use a different technology for
styling components.

~~Some `className` attributes have been kept, because they are
referenced in JS and tests.~~ Update: all classNames that are no longer
needed for styling purposes have been removed.
* If the className was needed for tests, it has been replaced with a
test-subj.
* If the className was used as a selector in production code, it has
been replaced with alternative JS.

## References
1. https://emotion.sh/docs/globals
2. https://emotion.sh/docs/best-practices
3.
https://github.com/elastic/eui/discussions/6828#discussioncomment-10825360

---------

Co-authored-by: Jatin Kathuria <jatin.kathuria@elastic.co>
2024-12-04 10:39:22 -07:00
Shahzad
16817cc44d
[Synthetics] Fix overview trends for read-only user !! (#202914)
## Summary

Fix overview trends for read-only user , we wrongly assume that this
`POST` route needs write permission.
2024-12-04 18:24:07 +01:00
Andrea Del Rio
cf7ce61376
[Dashboard] Adjust panel titles (#202864)
## Summary

As presented in DnD, this PR adjusts the title of panels in Dashboards.
It increases the font size from 12 to 14px and reduces the font-weight
from bold to semibold.

<img width="1625" alt="Actual implementation"
src="https://github.com/user-attachments/assets/c5e58346-cf10-4413-b628-1fa78af43652">

### 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/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~
~- [ ] [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~
- [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)
2024-12-04 08:52:38 -08:00
Tim Sullivan
871a81c68e
[Reporting] Use Kibana feature privileges only to control access to reporting (#200834)
## Summary

This PR discontinues Reporting from having dual models for determining
the privilege to generate a report, and uses Kibana feature privileges
as the single model that controls those privileges.

### Changes
1. Removes all logic that is based on following settings:
    * `xpack.reporting.roles.enabled`
    * `xpack.reporting.roles.allow`
The settings are still supported, but any features that use the settings
are removed.
2. Removes the detection of the settings from the Upgrade Assistant
integration

### Release note
The default system of granting users the privilege to generate reports
has changed. Rather than assigning users the `reporting_user` role,
administrators should create a custom role that grants report-creation
privileges using Kibana application privileges.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [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
- [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.

Correlates with https://elasticco.atlassian.net/browse/ES-9856: assign
the built-in `reporting_user` role the necessary Kibana application
privileges, and make the role not marked as deprecated.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-12-04 09:51:29 -07:00
Konrad Szwarc
065738bd11
[EDR Workflows] Endpoint Insights API (#201521)
### Summary

This PR introduces two internal API routes:

1. `/internal/api/endpoint/workflow_isnights`  
2. `/internal/api/endpoint/workflow_isnights/{insightId}`  

### Details

- The first route (`/internal/api/endpoint/workflow_isnights`) will be
used with the `securityWorkflowInsightsService.fetch` method to retrieve
stored insights.
- The second route
(`/internal/api/endpoint/workflow_isnights/{insightId}`) will work with
the `securityWorkflowInsightsService.update` method to update existing
insights.

---------

Co-authored-by: Joey F. Poon <joey.poon@elastic.co>
2024-12-04 10:31:54 -06:00
Eyo O. Eyo
da2ede4839
[React18] Migrate test suites to account for testing library upgrades security-threat-hunting-explore (#201142)
This PR migrates test suites that use `renderHook` from the library
`@testing-library/react-hooks` to adopt the equivalent and replacement
of `renderHook` from the export that is now available from
`@testing-library/react`. This work is required for the planned
migration to react18.

##  Context

In this PR, usages of `waitForNextUpdate` that previously could have
been destructured from `renderHook` are now been replaced with `waitFor`
exported from `@testing-library/react`, furthermore `waitFor`
that would also have been destructured from the same renderHook result
is now been replaced with `waitFor` from the export of
`@testing-library/react`.

***Why is `waitFor` a sufficient enough replacement for
`waitForNextUpdate`, and better for testing values subject to async
computations?***

WaitFor will retry the provided callback if an error is returned, till
the configured timeout elapses. By default the retry interval is `50ms`
with a timeout value of `1000ms` that
effectively translates to at least 20 retries for assertions placed
within waitFor. See
https://testing-library.com/docs/dom-testing-library/api-async/#waitfor
for more information.
This however means that for person's writing tests, said person has to
be explicit about expectations that describe the internal state of the
hook being tested.
This implies checking for instance when a react query hook is being
rendered, there's an assertion that said hook isn't loading anymore.

In this PR you'd notice that this pattern has been adopted, with most
existing assertions following an invocation of `waitForNextUpdate` being
placed within a `waitFor`
invocation. In some cases the replacement is simply a `waitFor(() => new
Promise((resolve) => resolve(null)))` (many thanks to @kapral18, for
point out exactly why this works),
where this suffices the assertions that follow aren't placed within a
waitFor so this PR doesn't get larger than it needs to be.

It's also worth pointing out this PR might also contain changes to test
and application code to improve said existing test.

### What to do next?
1. Review the changes in this PR.
2. If you think the changes are correct, approve the PR.

## Any questions?
If you have any questions or need help with this PR, please leave
comments in this PR.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-12-04 10:10:37 -06:00
Ievgen Sorokopud
4d8f7111d0
[Rules migration] Post merge feedback followups (#202815)
## Summary

These are the followup updated to address feedback from my previous PRs:

* Make sure to use descriptive names specific to the `siem_migrations`
subdomain
([comment](https://github.com/elastic/kibana/pull/200978#pullrequestreview-2454582368)):

> Make sure you use descriptive names specific to the siem_migrations
subdomain. Names like RulesPage, RulesTable, useRulesColumns etc are way
too generic and conflict with the rule management terminology, which
would make code search more difficult.


* Export the memo component directly everywhere
([comment](https://github.com/elastic/kibana/pull/201597#discussion_r1858069127)):

> Could we export the memo component directly everywhere? It's shorter
and it makes it easier to find the references in the IDE.


* Use one hook to access APIs instead of two
([comment](https://github.com/elastic/kibana/pull/202494#discussion_r1867967135)):

> I see that for every API request we have to implement 2 separate
hooks. Why don't we add error handling to the same hook that does the
useQuery? so we have everything in one hook. Or is there a reason to
have them separate?
2024-12-04 17:06:10 +01:00
Larry Gregory
c0b3dac7cb
Dependency ownership for Kibana Management team, part 1 (#202776)
## Summary

This updates our `renovate.json` configuration to mark the Kibana
Management team as owners of their set of dependencies.
2024-12-04 10:02:22 -06:00
Janki Salvi
8e8ba53116
[ResponseOps][Cases] Fix edit cases settings privilege (#202053)
## Summary

Fixes https://github.com/elastic/kibana/issues/197650

Also fixes an issue where user has `cases: all ` and `edit case
settings: false`, user was able to edit settings.

Used `permissions.settings` instead of `permissions.update` and
`permissions.create` for custom fields and templates.

### How to test
- Verify by creating a user with different combinations of cases and
edit case settings privileges

### 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
2024-12-04 09:55:08 -06:00
Sonia Sanz Vivas
41bd2af9f1
Check for indices before enabling get search profile in serverless (#201630)
Closes [#195342](https://github.com/elastic/kibana/issues/195342)

## Summary
In serverless, the default query for the search profiler fails if there
is not indices. For avoiding this error, when there are no indices
present, this PR disabled the "Profile" button and add a tooltip
explaining why it is disabled.

### New strings
This is the tooltip for string verification @kibana-docs
[[Code](5832a76683 (diff-bf48cd9834b39a2a1634680225fc63c9a4ddb3ca881d9120f648006ad0277046R154-R1552)?diff=unified&w=0#diff-bf48cd9834b39a2a1634680225fc63c9a4ddb3ca881d9120f648006ad0277046R155)]:
<img width="460" alt="Screenshot 2024-11-25 at 16 15 08"
src="https://github.com/user-attachments/assets/a3395cfb-fc5e-4c22-9dd8-954a60fd1b5d">

### How to test
* Run Kibana in serverless
* Go to Index Management and verify you haven't indices (or delete them
if you do have indices).
* Go to Dev Tools and click the Search Profiler tab. Verify that the
button is disabled and the tooltip displayed if you hover over it.
* Go back to Index Management and create one or more indices.
* Go back to Dev Tools > Search Profiler. Now the button should be
enabled and the profile should be created if you click it.

### Demo


https://github.com/user-attachments/assets/9bda072e-7897-4418-a906-14807e736c44


### 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/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
- [ ] [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)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-12-04 09:53:36 -06:00
Dzmitry Lemechko
72c906b25b
[skip CI] [ftr] add migration steps for deployment-agnostic tests (#202913)
## Summary

This PR adds example of tests, that doesn't meet deployment-agnostic
criteria. I also added steps explaining how to migrate existing tests to
DA.
2024-12-04 16:25:09 +01:00
Ying Mao
6a4fe4f73d
[Response Ops][Alerting] Alerting event logger should not throw error when ad hoc task runner cannot load saved object (#201637)
## Summary

The ad-hoc task runner loads the `ad_hoc_run` saved object that contains
rule information when it first starts running. If the saved object
cannot be loaded due to saved object not found (likely because the SO
was deleted), the alerting event logger was throwing an error because it
didn't have the rule information to populate the `execute-backfill`
event. This PR fixes it so we're not throwing an error and writes the
`execute-backfill` event with whatever information is available.

## To Verify

1. Modify the ad-hoc task runner to load a random saved object 

```
--- a/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_runner.ts
+++ b/x-pack/plugins/alerting/server/task_runner/ad_hoc_task_runner.ts
@@ -294,7 +294,8 @@ export class AdHocTaskRunner implements CancellableTask {
         const adHocRunSO: SavedObject<AdHocRunSO> =
           await this.context.encryptedSavedObjectsClient.getDecryptedAsInternalUser<AdHocRunSO>(
             AD_HOC_RUN_SAVED_OBJECT_TYPE,
-            adHocRunParamsId,
+            `abcdefgh`,
+            // adHocRunParamsId,
             { namespace }
```

2. Create a detection rule and then schedule backfill run for it. You
should see the execution fail with `Executing ad hoc run with id
\"7401d1f1-73fc-4483-acd5-edf6180028ce\" has resulted in Error: Saved
object [ad_hoc_run_params/abcdefgh] not found` but you should NOT see
any errors from task manager like `Task ad_hoc_run-backfill
"40fd4c52-411f-462c-b285-87e33520bd5b" failed: Error:
AlertingEventLogger not initialized`

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-12-04 10:09:30 -05:00
Bena Kansara
2a7689e693
[RCA] [Events timeline] Show all events (#202235)
As part of https://github.com/elastic/kibana/issues/200799, this PR
removes filter (previously the filter was based on any group by field,
which was changed to focus only on `service.name` for kubecon demo) so
that all events are shown on events timeline.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Faisal Kanout <faisal.kanout@elastic.co>
2024-12-04 08:57:05 -06:00
Pierre Gayvallet
3923007251
Fix agents for on-merge AI-Infra test suite (#202946)
## Summary

Add missing explicit agent-targeting rules for newly added pipeline
step.
2024-12-04 15:48:38 +01:00