Commit graph

842 commits

Author SHA1 Message Date
Davis McPhee
4215a637da
[Data Views] Disable scripted field creation in the Data Views management page (#202250)
## Summary

Scripted fields in data views have been deprecated since 7.13, and
superseded by runtime fields.

The ability to create new scripted fields has been removed from the Data
Views management page in 9.0. Existing scripted fields can still be
edited or deleted, and the creation UI can be accessed by navigating
directly to
`/app/management/kibana/dataViews/dataView/{dataViewId}/create-field`,
but it is recommended to migrate to runtime fields or ES|QL instead to
prepare for removal.

Additionally, the scripted fields entry in the Upgrade Assistant has
been updated to reflect these changes, improve migration instructions,
and surface the full list of data views across all spaces that contain
scripted fields as well as their associated spaces. New documentation
has been added to the "Manage data views" page with examples and
instructions to help users migrate off scripted fields to runtime fields
or ES|QL, which is also linked to from the Upgrade Assistant entry.

Data Views management page:

![management](https://github.com/user-attachments/assets/ed42310c-d7fa-48ba-8430-533e9230b48d)

Upgrade Assistant:
<img
src="https://github.com/user-attachments/assets/4ff27866-4fe8-4357-82e8-cd4c503ab50b"
width="500" />

Resolves #182067.

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

---------

Co-authored-by: Matt Kime <matt@mattki.me>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-12-05 20:11:34 -04:00
Sébastien Loix
2ae1dd41b6
[DarkMode] Deprecate advanced setting (#202993) 2024-12-05 16:39:59 +00:00
Jean-Louis Leysens
53b0015340
[OAS] Remove Elastic-Api-Version (#202923)
## Summary

Due to the much slower rate of versioning public APIs we have decided to
remove the Elastic-Api-Version body and header information from the spec
entirely.

This also cleans up the spec when rendered on our hosted OAS docs.

Removes:
1. `Elastic-Api-Version` from the request/response bodies for all public
APIs
2. `Elastic-Api-Version` header parameter from all public APIs

Docs for internal APIs will still have this included as they always
require a version environments.

## To revewers

Important changes are all in `packages/kbn-router-to-openapispec` and
`src/core/server/integration_tests/http/oas.test.ts`, the rest is very
minor or generated/snapshotted changes.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-12-05 17:05:42 +01:00
Tim Sullivan
6178e8295d
Preparation for High Contrast Mode, Core/SharedUX domains (#202606)
## Summary

**Reviewers: Please test the code paths affected by this PR. See the
"Risks" section below.**

Part of work for enabling "high contrast mode" in Kibana. See
https://github.com/elastic/kibana/issues/176219.

**Background:**
Kibana will soon have a user profile setting to allow users to enable
"high contrast mode." This setting will activate a flag with
`<EuiProvider>` that causes EUI components to render with higher
contrast visual elements. Consumer plugins and packages need to be
updated selected places where `<EuiProvider>` is wrapped, to pass the
`UserProfileService` service dependency from the CoreStart contract.

**NOTE:** **EUI currently does not yet support the high-contrast mode
flag**, but support for that is expected to come in around 2 weeks.
These first PRs are simply preparing the code by wiring up the
`UserProvideService`.

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

### Risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [medium/high] The implementor of this change did not manually test
the affected code paths and relied on type-checking and functional tests
to drive the changes. Code owners for this PR need to manually test the
affected code paths.
- [ ] [medium] The `UserProfileService` dependency comes from the
CoreStart contract. If acquiring the service causes synchronous code to
become asynchronous, check for race conditions or errors in rendering
React components. Code owners for this PR need to manually test the
affected code paths.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-12-05 08:26:41 -07: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
Tomasz Kajtoch
765ab20da1
Upgrade EUI to v98.1.0 (#202073) 2024-12-03 21:03:45 -06:00
Jesus Wahrman
9b99070470
[docs] Remove experimental message from saved objects import and export apis (#202173)
## Summary

resolves https://github.com/elastic/kibana/issues/159454

Remove experimental message from saved objects import and export apis.


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

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-12-02 12:05:52 +01:00
Rudolf Meijering
80e49111bd
Clarify no plans to remove legacy migrations at the moment (#201970)
## Summary

We've had some questions around legacy migrations that are flagged as
deprecated in the type. This updates the typescript doc comment to
hopefully clarify that.
2024-11-29 11:11:03 +01:00
Kyra Cho
c2c6f56aa8
[Core] Migrate SO _migrate route authorization to the new system (#200111)
## Summary
Hi! 😊 this PR deals with  #198181 

```diff
router.post({
  path: '/_migrate',
-  options: {
-    tags: ['access:migrateSavedObjects'],
+  security: {
+    authz: {
+      requiredPrivileges: ['migrateSavedObjects'],
+    },
  ...
}, handler);
```


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [n/a] 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)
- [n/a]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [n/a] [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
- [n/a] 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)
- [n/a] 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.
- [n/a] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [n/a] The PR description includes the appropriate Release Notes
section, and the correct `release_node:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
2024-11-28 11:59:23 +00:00
Elena Shostak
ec7e1a808f
[Authz] Removed security property from route.options types (#201352)
## Summary

Removed `security` property from `route.options` types, `security`
should exist only as a top level property.
Fixed routes with incorrect config accordingly.


## Routes Impacted
Routes with disabled authorization (impact can be considered negligible)
```
/internal/entities/managed/enablement
/internal/entities/managed/enablement
/internal/entities/managed/enablement
/internal/entities/definition
/internal/entities/definition/{id}
/internal/entities/definition/{id?}
/internal/entities/definition/{id}/_reset
/internal/entities/definition/{id}
/api/streams/_enable
/api/streams/_resync
/api/streams/{id}/_fork
/api/streams/{id}
/api/streams/{id}
/api/streams/{id}
/api/streams 
```

Routes with authorization (will be backported to `8.17.0`)

```
/internal/product_doc_base/status
/internal/product_doc_base/install
/internal/product_doc_base/uninstall
```



__Fixes: https://github.com/elastic/kibana/issues/201347__
2024-11-22 17:13:08 +01:00
Gerard Soldevila
b24fdf5d3f
Sustainable Kibana Architecture: Categorise straightforward packages (#199630)
## Summary

This PR is part of the Kibana Sustainable Architecture effort.

The goal is to start categorising Kibana packages into _generic
platform_ (`group: "platform"`) vs _solution-specific_.

```
group?: 'search' | 'security' | 'observability' | 'platform'
visibility?: 'private' | 'shared'
```
Uncategorised modules are considered to be `group: 'common', visibility:
'shared'` by default.

We want to prevent code from solution A to depend on code from solution
B.
Thus, the rules are pretty simple:

* Modules can only depend on:
  * Modules in the same group
  * OR modules with 'shared' visibility
* Modules in `'observability', 'security', 'search'` groups are
mandatorily `visibility: "private"`.

Long term, the goal is to re-organise packages into dedicated folders,
e.g.:

```
x-pack/platform/plugins/private
x-pack/observability/packages
```

For this first wave, we have categorised packages that seem
"straightforward":
* Any packages that have:
  * at least one dependant module
  * all dependants belong to the same group
* Categorise all Core packages:
  * `@kbn/core-...-internal` => _platform/private_
  * everything else => _platform/shared_
* Categorise as _platform/shared_ those packages that:
  * Have at least one dependant in the _platform_ group.
  * Don't have any `devOnly: true` dependants.

### What we ask from you, as CODEOWNERS of the _package manifests_, is
that you confirm that the categorisation is correct:

* `group: "platform", visibility: "private"` if it's a package that
should only be used from platform code, not from any solution code. It
will be loaded systematically in all serverless flavors, but solution
plugins and packages won't be able to `import` from it.
* `group: "platform", visibility: "shared"` if it's a package that can
be consumed by both platform and solutions code. It will be loaded
systematically in all serverless flavors, and anybody can import / use
code from it.
* `group: "observability" | "security" | "search", visibility:
"private"` if it's a package that is intented to be used exclusively
from a given solution. It won't be accessible nor loaded from other
solutions nor platform code.

Please refer to
[#kibana-sustainable-architecture](https://elastic.slack.com/archives/C07TCKTA22E)
for any related questions.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-11-22 10:33:25 +01:00
Alejandro Fernández Haro
f9287a9545
[Feature Flags] Set RUM transaction.outcome (#200576) 2024-11-21 09:40:52 -06:00
Sander Philipse
0cafc7be9e
Search rename to elasticsearch (#200774)
This renames the Search solution to Elasticsearch to fit with our
rebranding efforts.
2024-11-20 18:14:26 +01:00
Kurt
8e7799ae7a
Removing experimental for the FIPS mode config (#200734)
## Summary

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

Remove the `experimental` from the fipsMode config path

## Release note

Kibana's FIPS mode is no longer considered experimental

## FIPS Pipeline for this branch

https://buildkite.com/elastic/kibana-fips/builds/281
2024-11-19 15:23:20 -05:00
Lene Gadewoll
ee49986876
[Visual Refresh] Add Borealis theme (#199993)
## Summary

This PR introduces the first internal version of the new theme
`Borealis` and ensures that:
- themes can be switched between "Amsterdam" and "Borealis"
- theme-specific Sass files are available and can be loaded with
`KBN_OPTIMIZER_THEMES=experimental`
- legacy JSON variable usage accounts for both themes
- static template styles account for both themes


## Running locally

```yml
// kibana.dev.yml or kibana.yml
uiSettings.experimental.themeSwitcherEnabled: true
```

Start kibana
```
KBN_OPTIMIZER_THEMES='v8light,v8dark,borealislight,borealisdark' yarn start

or

KBN_OPTIMIZER_THEMES=experimental yarn start
```

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

---------

Co-authored-by: Tomasz Kajtoch <tomasz.kajtoch@elastic.co>
2024-11-19 16:35:10 +01:00
Kurt
ac0b0b4f05
Enabling Full FTR, Integration, and Unit tests to the FIPS Test Pipeline (#192632)
## Summary

Closes #192233 

Just in time for Thanksgiving - a full buffet of FIPS testing fixes

Usage of non-compliant algorithms manifest as runtime errors, so it is
imperative that we attempt to run all tests possible with Kibana in FIPS
mode. However, several overrides are needed to run Kibana in FIPS mode,
resulting in setup that make it impossible to run.

## In this PR

- Enable Unit tests for FIPS pipeline
- Enable Integration Tests for FIPS pipeline
- Enable Full FTR suite for FIPS pipeline (smoke test had originally run
a subset)
- Skip tests that break with overrides
- Fix/change tests to work in FIPS mode to maximize coverage
- Examine necessity of MD5 when installing from source (TBD based Ops PR
feed back, see self review below)
- Remove md5 from es_file_client options

## Latest Successful FIPS Test Run

https://buildkite.com/elastic/kibana-fips/builds/268

---------

Co-authored-by: Brad White <Ikuni17@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
Co-authored-by: Larry Gregory <larry.gregory@elastic.co>
2024-11-19 08:31:47 -05:00
Nathan Reese
9f545039ab
fix dashboard grid item performs 2 DOM queries every render (#199390)
Closes https://github.com/elastic/kibana/issues/199361

While investigating, I found that fetching DOM element with id
`app-fixed-viewport` is a common pattern. I created the hook
`useAppFixedViewport` to consolidate this logic into a single location.
The hook only performs the DOM look-up on first render and then avoids
the DOM look-up on each additional render.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-11-18 11:32:53 -07:00
Sid
262b48f1cf
Fix issue with duplicate references in error object when copying saved objects to space (#200053)
Closes https://github.com/elastic/kibana/issues/158027

## Summary

Simply dedupes references to objects if they are part of the
missing_references in the copy saved objects to SO endpoint

### Notes
- Update forEach over SOs to a regular for loop since we had a couple of
early exit scenarios
- Checks against the set for references already added to the missing
list and adds only if not present

------

**Old response: Note the duplicate references**

<img width="400" alt="Screenshot 2024-11-14 at 01 52 54"
src="https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4">


**New response**

<img width="800" alt="Screenshot 2024-11-14 at 01 50 41"
src="https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9">


### Release note
Dedupe results from copy saved objects to spaces API when object
contains references to other objects.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-11-18 09:46:07 -06:00
Christiane (Tina) Heiligers
c7bcc5c408
Improve logging pattern schema validation (#200317)
## Summary

This makes pattern schema validation stricter by avoiding unrestricted
matching, enforces realistic timezone constraints, and sets an upper
bound to the date format string.

| Characteristic | Before | After |
----|----|----|
| Optional Groups | Capturing groups for optional sections. |
Non-capturing groups for optional sections.|
|Timezone Validation | Allows any characters except }. | Restricts to
A-Za-z/_+-.|
|Clarity | More complex and verbose. | Cleaner, more restrictive, and
simpler.|
|Performance | Captures unnecessary groups. | Limits captures to needed
named groups.|

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-11-18 07:47:29 -07:00
Gerard Soldevila
ab0375f56f
Kibana Sustainable Architecture: Expose StatusResponse in core-status-common (#200524)
## Summary

- Exposes the interfaces that define the format of the response of the
`/api/status` endpoint.
- Moves them from `@kbn/core-status-common-internal` to
`@kbn/core-status-common`.
- Removes the former package, as it no longer contains anything.
- Fixes some of the illegal dependencies uncovered by
https://github.com/elastic/kibana/pull/199630.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-11-18 14:34:54 +01:00
Tomasz Kajtoch
5b77b7e504
Add basic support for experimental theme switching (#199748)
## Summary

This PR adds basic support for theme switching to test experimental
themes internally. It defines a new `theme:name` setting which is
read-only (and thus hidden) by default, and needs
`uiSettings.experimental.themeSwitcherEnabled: true` config setting to
become visible. The implementation and the way the theme switcher
feature is enabled will likely change in the upcoming weeks when we iron
out the details, but the way it works right now is sufficient for
testing and that's what the immediate goal is.

Please note this PR includes mostly setup work, and no additional themes
have been added here. To make reviewing slightly easier, these will be
added separately.

The feature and settings should be undocumented for the time being and
disabled by default.

---

As you might notice, there's a new setting added despite already having
`theme:version`. We decided to introduce a new setting instead of
resurrecting an existing one for better naming and flexibility and to
reduce the risk of breaking things that might still use the old setting
value (hardcoded to `v8` at the moment). The current plan is to remove
`theme:version` in 9.0.

The theme_loader got refactored to only bundle active themes coming from
`KBN_OPTIMIZER_THEMES` (defaulting to `v8light` and `v8dark`) instead of
`ALL_THEMES` that would significantly increase bundle sizes even when
the experimental themes were not enabled. Considering there's a SASS to
CSS-in-JS migration happening right now, we don't need to worry about
Kibana bundles growing in size when a new theme is officially added.

### Checklist

Delete any items that are not applicable to this PR.

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

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow 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>
Co-authored-by: Clint Andrew Hall <clint.hall@elastic.co>
Co-authored-by: Rudolf Meijering <skaapgif@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
2024-11-18 05:42:30 -06:00
Gerard Soldevila
ad56ec5f1a
Sustainable Kibana Architecture: Remove dependencies between plugins that are related by _App Links_ (#199492)
## Summary

This PR introduces a Core API to check whether a given application has
been registered.
Plugins can use this for their _App Links_, without having to depend on
the referenced plugin(s) anymore.

This way, we can get rid of some inter-solution dependencies, and
categorise plugins more appropriately.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-11-14 05:49:21 -06:00
Ahmad Bamieh
a10eb1fe4e
[UA][Core] Surface integrations with internal APIs in upgrade assistant (#199026)
## Summary

> In https://github.com/elastic/kibana/issues/117241 we're surfacing
usage of APIs marked as `deprecated: true` in the Upgrade Assistant to
help users prepare for a major upgrade. While internal APIs aren't
really deprecated in the same sense we are making a breaking change by
blocking external integrations with these APIs. Since this could be
equally disruptive to users depending on these APIs it would help our
users to surface such usage in the UA too.

The `api` deprecations now have two sub types:
1. routes deprecations `options.deprecated: { … }`
2. access deprecations `options.access: 'internal'`

This PR adds the second `api` deprecation subtype. The reason i kept one
`api` deprecation type and i didnt create a new type is that they have
exactly the same registration process but are triggered by different
attributes. The `api` deprecation is fully managed by the core team
internal services and are configured by the user through the route
interface so it makes sense to keep them as one type. I also can see us
adding more subtypes to this and just piggybacking on the current flow
instead of duplicating it everytime.


**Checklist**
- [x] Create deprecation subtype
- [x] Example plugin
- [x] Surface the deprecation in UA
- [x] Api access deprecation copy (@florent-leborgne )
- [x] Update README and code annotations
- [x] Unit tests
- [x] Integration tests


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

### Design decisions:
If the API has both route deprecation (`options.deprecated: { … }` ) AND
is an internal api `options.access: 'internal'`

The current behavior i went for in my PR:
I show this API once in the UA under the internal access deprecation.
While showing the route deprecation details if defined. This seems to
make the most sense since users should stop using this API altogether.

### Copy decisions:
@florent-leborgne wrote the copy for this deprecation subtype.
<img width="1319" alt="image"
src="https://github.com/user-attachments/assets/9a32f6d1-686a-4405-aec6-786ac5e10130">

<img width="713" alt="image"
src="https://github.com/user-attachments/assets/1304c98d-4c64-468e-a7d6-19c1193bf678">


## Testing

Run kibana locally with the test example plugin that has deprecated
routes
```
yarn start --plugin-path=examples/routing_example --plugin-path=examples/developer_examples
```

The following comprehensive deprecated routes examples are registered
inside the folder:
`examples/routing_example/server/routes/deprecated_routes`

Run them in the dev console to trigger the deprecation condition so they
show up in the UA:

```
GET kbn:/api/routing_example/d/internal_deprecated_route?elasticInternalOrigin=false
GET kbn:/internal/routing_example/d/internal_only_route?elasticInternalOrigin=false
GET kbn:/internal/routing_example/d/internal_versioned_route?apiVersion=1&elasticInternalOrigin=false
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-11-12 14:19:22 +03:00
Alejandro Fernández Haro
93d7044919
[Feature Flags] Add APM transaction + better example code (#199671)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-11-12 11:59:52 +01:00
elastic-renovate-prod[bot]
4f53a11347
Update dependency @elastic/elasticsearch to ^8.15.1 (main) (#196478) 2024-11-11 21:08:40 +01:00
Jean-Louis Leysens
3c976c0b93
Turn on deprecation logs in Jest integration tests (#199095)
## Summary

Part of preparing for 9.0 release we monitor test logs to surface
deprecated ES usage in Kibana. This PR ensures that all Jest integration
test are surfacing these logs by default.
2024-11-08 08:32:47 -06:00
Christiane (Tina) Heiligers
0df2e98381
Changes deprecated SO HTTP APIs deprecation field to object (#197936)
fix https://github.com/elastic/kibana/issues/197721.

The route deprecation field changed from a boolean to an object, where
the object contains information that is used in deprecation issues that
the Upgrade Assistant shows.

This PR makes the necessary changes in the deprecated Saved Objects HTTP
APIs.

This PR also includes a release notes entry for the API deprecations
that was missing.
![Screenshot 2024-10-29 at 12 01
29](https://github.com/user-attachments/assets/5c47c697-fbae-4b2e-8c6c-cd4701a667df)

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


### How to test this:

- Pull PR, run es against a trial license and start kibana as usual.
- Make a curl request to Kibana to get the config saved object: 

```
curl --location 'localhost:5601/abc/api/saved_objects/config/9.0.0' \
--header 'Content-Type: application/json' \
--header 'Accept-Encoding: gzip, deflate, br' \
--header 'kbn-xsrf: kibana' \
--header 'Kbn-Version: 9.0.0' \
--header 'Authorization: Basic ZWxhc3RpYzpjaGFuZ2VtZQ=='
```

- Navigate to Upgrade Assistant and observe Kibana has at least 1
deprecation warning.
- View Kibana's warnings, you should see a warning entry for `The "GET
/api/saved_objects/{type}/{id}" route is deprecated`

![Screenshot 2024-11-06 at 16 26
26](https://github.com/user-attachments/assets/3b6a5644-3e5e-403e-a0f6-015686675b9f)

- click on the deprecation and you should see more detail about the
deprecated API that's been used in the flyout:

![Screenshot 2024-11-06 at 16 26
44](https://github.com/user-attachments/assets/696aaf8f-fb6b-4c61-bc3c-b3745f85059a)

- resolve the deprecation warning
- Kibana should continue to issue requests to the deprecated SO HTTP
APIs because these APIs have not been removed yet.


### Risk Matrix

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| End user concern from the deprecation warning that says the routes
have been deprecated | Low | Low | The APIs have been deprecated since
8.7 and recommends using public APIs instead. |

### For maintainers

- [x] This will appear in the **Release Notes** and follow 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>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-11-07 14:49:05 -06:00
Alejandro Fernández Haro
be3c159cfc
[Rendering] Parallelize ES requests (#199124) 2024-11-06 17:09:41 +01:00
Rudolf Meijering
36f6d6fa02
Don't migrate partial documents (#198703)
## Summary

Fixes a regression by adding back the functionality that was originally
introduced in https://github.com/elastic/kibana/pull/162404: skipping
migrations (transform and forwardCompatibilitySchema) when the fields
option is specified

In working on this we uncovered some problem scenarios we previously
hadn't thought through (will create separate issues for these):
1. Even if we can't reliably run the transform part of migrations on a
partial document we should still run the `forwardCompatibilitySchema` so
that unknown fields from future versions are dropped.
However, we realised most teams missed the detail in our
[docs](https://github.com/elastic/kibana/blob/main/docs/developer/architecture/core/saved-objects-service.asciidoc?plain=1#L429-L457)
that call out that forwardCompatibilitySchemas shouldn't assert on data
but only drop unknown fields. This means if we would run the
forwardCompatibilitySchema today it would most often fail on partial
documents.
3. When `fields` contain an encrypted field but not all AAD fields,
encryption would fail and log an error (potentially triggering
serverless alerts).
2024-11-06 11:21:17 +01:00
Ahmad Bamieh
665cf98067
[UA][Core][API Deprecations] Add deprecate type and update copy (#198800)
## Summary

- [x] Add `deprecate` Type to the API Deprecations reasons.
- [x] Add a `message` optional field that is surfaced in the UA
- [x] Add IDE documentation in the autocomplete for all deprecation
fields.
- [x] Updated README and example plugin for the `deprecate` type
- [x] Update copy for `deprecate`.


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

## Testing

Run kibana locally with the test example plugin that has deprecated
routes
```
yarn start --plugin-path=examples/routing_example --plugin-path=examples/developer_examples
```

The following comprehensive deprecated routes examples are registered
inside the folder:
`examples/routing_example/server/routes/deprecated_routes`

Run them in the dev console to trigger the deprecation condition so they
show up in the UA:

```
GET kbn:/api/routing_example/d/deprecated_route
```

<img width="628" alt="image"
src="https://github.com/user-attachments/assets/3c0e1829-9a07-49bd-94a3-398514f448e2">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: florent-leborgne <florent.leborgne@elastic.co>
2024-11-05 23:43:56 -06:00
Christiane (Tina) Heiligers
73f31549cd
Enhance documentation on accessing hidden SO types (#199046)
Saved objects declared as `hidden` can only be accessed with a client
that explicitly includes hidden types.

### Checklist

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials

---------

Co-authored-by: Alejandro Fernández Haro <afharo@gmail.com>
2024-11-05 19:51:45 -06:00
Sid
56c0806af5
[ESO] Add flag to allow ESO consumers to opt-out of highly random UIDs (#198287)
Closes https://github.com/elastic/kibana/issues/194692

## Summary
Allow consumers of ESOs to explicitly opt out of the strict highly
random UID requirements while registering the ESO type

### Description

The `getValidId` method was updated to allow consumers of Encrypted
Saved Objects to explicitly opt-out of the enforced random ID
requirement.

This change is added during ESO registration - consumers can now pass a
new field to opt-out of random UIDs.

Additional changes

- Updated canSpecifyID logic:
- The canSpecifyID condition now also checks if enforceRandomId is
explicitly set to false.
This opt-out approach allows specific ESOs to bypass the random ID
enforcement without affecting the default behavior, keeping it secure by
default.


During the registration phase of the saved object, consumers can now
specify if they'd like to opt-out of the random ID

```
savedObjects.registerType({
  name: TYPE_WITH_PREDICTABLE_ID,
 //...
});

encryptedSavedObjects.registerType({
  type: TYPE_WITH_PREDICTABLE_ID,
  //...
  enforceRandomId: false,
});

```


### Release notes

Improves Encrypted Saved Objects (ESO) ID validation by adding an
enforceRandomId parameter, allowing consumers to opt out of the default
random ID requirement for specific use cases.

### Checklist

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


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow 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>
Co-authored-by: Jeramy Soucy <jeramy.soucy@elastic.co>
2024-11-05 15:40:53 +01:00
Kyra Cho
45543a12a6
basic enhancements for import logging (#196056)
## Summary
Hello, this is a follow up PR to #192234 . The previous PR added
simplistic logging to the saved objects importer. The goal now is to
enhance the logs with information on the saved objects being imported,
how they are imported, and by displaying any errors.

#### `import_saved_objects.ts`:
- Logs specific types being imported
- Logs size limit and overwrite status
- Logs Success/Fail messages

#### Changes to `saved_objects_importer.ts`:
- Passes the logger to `importSavedObjectsFromStream` 
- Removes "starting import"

#### Changes to `import_saved_objects.test.ts`:
- Updates it for the new logger parameter

#### Changes to `import.test.ts`:
- Uses the mock logger provided by core, instead of using a custom one

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

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow 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>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
2024-10-31 19:50:21 -05:00
Sébastien Loix
89fe54815d
[Stateful sidenav] Update feedback urls (#198143) 2024-10-31 08:55:49 +00:00
Cee Chen
4e7d43a031
Upgrade EUI to v97.3.0 (#198087)
`v97.2.0``v97.3.0`

_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_

---

## [`v97.3.0`](https://github.com/elastic/eui/releases/v97.3.0)

- `EuiDataGrid` now supports a new
`toolbarVisibility.showDisplaySelector.customRender` function that
allows completely customizing the rendering of the display selector
popover ([#8080](https://github.com/elastic/eui/pull/8080))
- `EuiDataGrid`'s row height/lines per row setting has been streamlined
in both UI and UX ([#8080](https://github.com/elastic/eui/pull/8080))
- `EuiDataGrid` now accepts consumer-passed display setting updates even
after users have changed their display preferences via UI
([#8080](https://github.com/elastic/eui/pull/8080))
- Updated `EuiDataGrid` to vertically center all
`toolbarVisibility.additionalControls` nodes
([#8085](https://github.com/elastic/eui/pull/8085))
- Updated `EuiDataGrid` with a beta
`rowHeightsOptions.autoBelowLineCount` feature flag
([#8096](https://github.com/elastic/eui/pull/8096))
- Updated `EuiContextMenuPanel` to allow disabling initial focus via
`initialFocusedItemIndex={-1}`
([#8101](https://github.com/elastic/eui/pull/8101))

**Bug fixes**

- Fixed `EuiComment`'s typing to correctly reflect all accepted props
([#8089](https://github.com/elastic/eui/pull/8089))
- Fixed `EuiSelectableTemplateSitewide`s within dark-themed `EuiHeader`s
missing input borders
([#8100](https://github.com/elastic/eui/pull/8100))
2024-10-30 19:41:45 -07:00
Krzysztof Kowalczyk
3a8bd70e83
Handle DOM storage being disabled (#197798)
## Summary

This PR aims to improve the message shown to users when Kibana can't be
started due to disabled DOM storage (#121189).
The visuals here follow the same pattern as other fatal errors (see
#186609)

![image](https://github.com/user-attachments/assets/19832830-49e3-4789-9b83-0c1f14d7980d)

The `isDomStorageDisabled` check has to be done before `CoreService`
gets instantiated because of issues described below.

Closes: #121189

## The issue

What actually happens when you disable all cookies in a browser? Aside
from cookies, the browser disables the whole DOM storage -
`localStorage` and `sessionStorage`. Trying to access those will result
in an error.


`getSessionId`3bc5e2db73/packages/core/analytics/core-analytics-browser-internal/src/get_session_id.ts (L17)
and
`isSidenavCollapsed$`3bc5e2db73/packages/core/chrome/core-chrome-browser-internal/src/chrome_service.tsx (L91)

Both of those try to access either `localStorage` or `sessionStorage`
and both of those are triggered when you create an instance of
`CoreSystem` which gets instantiated in `kbn_bootstrap`
6ef0369746/packages/core/root/core-root-browser-internal/src/kbn_bootstrap.ts (L42)

Trying to access DOM storage in `CoreSystem` will cause it to throw an
error and this means that
`FatalErrorService`6ef0369746/packages/core/fatal-errors/core-fatal-errors-browser-internal/src/fatal_errors_service.tsx (L32)
will never instantiate and the
`failure`6ef0369746/packages/core/rendering/core-rendering-server-internal/src/bootstrap/render_template.ts (L68)
function which styles the errors and makes them visible will never
trigger and all the user will see is permament `Loading Kibana` spinner.

Wrapping `getSessionId` and `isSidenavCollapsed$` in `try-catch` block
allows `FatalErrorService` to work properly, which will catch an
unhandled exception (`Detected an unhandled Promise rejection.`) with an
error about `sessionStorage` being disabled, which gets thrown by
`LicensingPlugin` (and possibly in other places). This is not an actual
solution though - this behavior would happen again if another line of
code trying to access DOM storage gets added to `CoreSystem`.

I think it would be best to handle this directly in `kbn_bootstrap.ts`
by some check like the one below:
```javascript
const isDOMStorageDisabled = () => {
    try {
      const key = 'kbn_bootrasrap_domStorageEnabled';
      sessionStorage.setItem(key, 'true');
      sessionStorage.removeItem(key);
      return false;
    } catch (e) {
      return true;
    }
  };
const domStorageDisabled = isDOMStorageDisabled()
/* 
  ...some additonal logic
*/
```
This would then require some error displaying logic that doesn't use
`FatalErrorService`.

Looking for some feedback on how to properly solve this.
2024-10-30 15:02:28 +01:00
Ryan Keairns
b5d4601e01
Change spaces button loading design (#197922)
Closes #197916 

## Summary

One less loading spinner. Instead, uses a skeleton loader for a
load-in-place effect that is visually less busy and jumpy.

*Before*
<img width="420"
src="https://github.com/user-attachments/assets/33ae37bf-c196-4bbf-a26e-ad469d7f3134"
/>

*After*


https://github.com/user-attachments/assets/33cc2d39-2895-4c53-8903-9c3b18d586f9
2024-10-29 21:13:41 -05:00
Raya Fratkina
85fd147d01
Expand README (#197880)
## Summary

Adds a bit more general background, intro to concepts, and guidelines
about what to use FF for and what not to


### Checklist

Delete any items that are not applicable to this PR.

- [ ] 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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] 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 renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
2024-10-29 12:09:50 -04:00
Ryan Keairns
1066064c98
Improve header button spacing (#197896)
Closes #197873 

## Summary

- Fix spacing between 'Give feedback' and AI button.
- While in the neighborhood, I noticed the search button had some extra
padding, so I fixed that quick too.
- Lastly, I pushed the project switcher to the far right. This is only
used for local development of Serverless and was otherwise appearing
between production buttons.

### Before
<img width="420"
src="https://github.com/user-attachments/assets/f5abe1af-1762-4658-8040-d802b9752667"
/>

<img width="420"
src="https://github.com/user-attachments/assets/04288ff3-6012-4518-866f-0dea4ad62401"
/>

### After
<img width="420"
src="https://github.com/user-attachments/assets/ef2e0eff-d4f4-4ceb-bbf8-c39d2e3e9949"
/>

## QA
To test, you'll need to run this in serverless mode where the 'Give
feedback' button appears.
You can force it on by setting the following line equal to `true`.

ae9c0d3850/src/plugins/guided_onboarding/public/plugin.tsx (L50)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-10-28 09:24:23 -07:00
Eyo O. Eyo
7164a343e5
[CodeQL] resolve issue with prototype pollution (#196685)
## Summary

Relates to https://github.com/elastic/kibana-team/issues/1102

Particularly addresses issues with prototype pollution

<!--
### Checklist

Delete any items that are not applicable to this PR.

- [ ] 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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] 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 renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow 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-10-24 06:20:30 -05:00
Gerard Soldevila
8de3636e43
Update mappings if/when new SO types are introduced (#197061)
## Summary

Addresses https://github.com/elastic/elastic-entity-model/issues/70
Fixes regression introduced in
https://github.com/elastic/kibana/pull/176803
2024-10-24 10:21:43 +02:00
Elena Shostak
598706c7d1
[Authz] Superuser privileges (#196586)
## Summary

This PR adds support for explicit indication whether endpoint is
restricted to superusers only.
Moved `api/encrypted_saved_objects/_rotate_key` endpoint to the new
configuration.

__Relates: https://github.com/elastic/kibana/issues/196271__


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

## Release note

Introduced explicit configuration for routes that require superuser
access. Moved `api/encrypted_saved_objects/_rotate_key` endpoint to the
new configuration.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-10-23 09:39:49 +02:00
Ahmad Bamieh
c417196905
[Core] [UA] Support API Deprecations (#196081)
# Summary

Adds a new API deprecations feature inside core.
This feature enabled plugin developers to mark their versioned and
unversioned public routes as deprecated.
These deprecations will be surfaced to the users through UA to help them
understand the deprecation and address it before upgrading. This PR also
surfaces these deprecations to UA.

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

1. Core service to flag deprecated routes
2. UA code to surface and resolve deprecated routes

## Flagging a deprecated Route

### The route deprecation option
We have three types of route deprecations:

- `type: bump`: A version bump deprecation means the API has a new
version and the current version will be removed in the future in favor
of the newer version.
- `type: remove`: This API will be completely removed. You will no
longer be able to use it in the future.
- `type: migrate`: This API will be migrated to a different API and will
be removed in the future in favor of the other API.


All route deprecations expect a documentation link to help users
navigate. We might add a generic documentation link and drop this
requirement in the future but for now this is required.

### Deprecated Route Example
Full examples can be found in the `routing_example` example plugin
located in this directory:
`examples/routing_example/server/routes/deprecated_routes`

```ts
router[versioned?].get(
    {
      path: '/',
      options: {
        deprecated: {
           documentationUrl: 'https://google.com',
           severity: 'warning',
           reason: {
              type: 'bump',
              newApiVersion: '2024-10-13',
            },
        },
      },
    },
    async (context, req, res) => {
...
```

## Surfaced API deprecations in UA

The list of deprecated APIs will be listed inside Kibana deprecations
along with the already supported config deprecations.
<img width="1728" alt="image"
src="https://github.com/user-attachments/assets/5bece704-b80b-4397-8ba2-6235f8995e4a">


Users can click on the list item to learn more about each deprecation
and mark it as resolved
<img width="1476" alt="image"
src="https://github.com/user-attachments/assets/91c9207b-b246-482d-a5e4-21d0c61582a8">



### Marking as resolved
Users can click on mark as resolved button in the UA to hide the
deprecation from the Kiban deprecations list.
We keep track on when this button was clicked and how many times the API
has been called. If the API is called again the deprecation will
re-appear inside the list. We might add a feature in the future to
permenantly supress the API deprecation from showing in the list through
a configuration (https://github.com/elastic/kibana/issues/196089)

If the API has been marked as resolved before we show this in the flyout
message:
> The API GET /api/deprecations/ has been called 25 times. The last time
the API was called was on Monday, October 14, 2024 1:08 PM +03:00.
> The api has been called 2 times since the last time it was marked as
resolved on Monday, October 14, 2024 1:08 PM +03:00


Once marked as resolved the flyout exists and we show this to the user
until they refresh the page
<img width="1453" alt="image"
src="https://github.com/user-attachments/assets/8bb5bc8b-d1a3-478f-9489-23cfa7db6350">


## Telemetry:
We keep track of 2 new things for telemetry purposes:
1. The number of times the deprecated API has been called
2. The number of times the deprecated API has been resolved (how many
times the mark as resolved button in UA was clicked)

## Code review
- [x] Core team is expected to review the whole PR
- [ ] Docs team to review the copy and update the UA displayed texts
(title, description, and manual steps)
- [x] kibana-management team is expected to review the UA code changes
and UI
- [ ] A few teams are only required to approve this PR and update their
`deprecated: true` route param to the new deprecationInfo object we now
expect. There is an issue tracker to address those in separate PRs later
on: https://github.com/elastic/kibana/issues/196095

## Testing

Run kibana locally with the test example plugin that has deprecated
routes
```
yarn start --plugin-path=examples/routing_example --plugin-path=examples/developer_examples
```

The following comprehensive deprecated routes examples are registered
inside the folder:
`examples/routing_example/server/routes/deprecated_routes`

Run them in the console to trigger the deprecation condition so they
show up in the UA:

```
# Versioned routes: Version 1 is deprecated
GET kbn:/api/routing_example/d/versioned?apiVersion=1
GET kbn:/api/routing_example/d/versioned?apiVersion=2

# Non-versioned routes
GET kbn:/api/routing_example/d/removed_route
POST kbn:/api/routing_example/d/migrated_route
{}
```

1. You can also mark as deprecated in the UA to remove the deprecation
from the list.
2. Check the telemetry response to see the reported data about the
deprecated route.
3. Calling version 2 of the API does not do anything since it is not
deprecated unlike version `1` (`GET
kbn:/api/routing_example/d/versioned?apiVersion=2`)
4. Internally you can see the deprecations counters from the dev console
by running the following:
```
GET .kibana_usage_counters/_search
{
    "query": {
        "bool": {
            "should": [
              {"match": { "usage-counter.counterType": "deprecated_api_call:total"}},
              {"match": { "usage-counter.counterType": "deprecated_api_call:resolved"}},
              {"match": { "usage-counter.counterType": "deprecated_api_call:marked_as_resolved"}}
            ]
        }
    }
}

```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: florent-leborgne <florent.leborgne@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-10-22 19:57:37 +03:00
Gerard Soldevila
c9637cf71c
Use more efficient strategies to process user input (#196858)
## Summary

Address performance concerns with Regexps
2024-10-22 07:07:25 -05:00
Tre
9c5946976d
[FIX ON MKI] x-pack/.../telemetry_config.ts (#197036)
## Summary

See details: https://github.com/elastic/kibana/issues/197009
2024-10-21 16:01:56 +01:00
Jean-Louis Leysens
608cc70be5
[OAS] Support setting availability (#196647)
## Summary

Close https://github.com/elastic/kibana/issues/181995

Related https://github.com/elastic/kibana/pull/195325


### 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: Christiane (Tina) Heiligers <christiane.heiligers@elastic.co>
2024-10-21 05:30:45 -05:00
Christiane (Tina) Heiligers
b3fab03e27
Fix link to feature flags example plugin (#196960)
Fixes link to code example in GH
2024-10-19 14:57:01 -07:00
Alejandro Fernández Haro
41998b48f7
Improve stack traces in dev mode (#195916) 2024-10-18 17:35:08 +02:00
Alejandro Fernández Haro
f25b3be194
[Feature flags example] Apply FF naming conventions (#196535) 2024-10-17 04:34:43 -05:00
Sébastien Loix
204f9d3a2f
[Stateful sidenav] Fix breadcrumbs (#196169) 2024-10-15 09:37:19 -05:00