Commit graph

404 commits

Author SHA1 Message Date
Jean-Louis Leysens
bda0195982
[http] Fix running FTR tests locally (#161336)
## Summary

Running FTR tests locally (not on CI) that make API requests to public
versioned Kibana endpoints is currently broken. This is because:

* we require version headers to be set for both internal and **public**
endpoints in **dev** by way of a runtime check (ensures our code is
locked to a version)
* the vast majority of FTR tests do not set these headers for talking to
public endpoints
* on CI, this is different as we run these tests against a distributable
build (i.e., non-dev)

This manifests locally as a 400 response. E.g. the current
api_integration tests for data views by running:

```
node scripts/functional_test_runner.js --config ./test/api_integration/config.js --grep 'index_pattern_crud'
```

---

There are a few ways to resolve this, this PR proposes that we:

* Keep FTR tests as they are (i.e., don't update all of them to set
headers when making requests to public versioned endpoints), this is a
useful way to exercise our intended end-user behaviour
* Make the version resolution behaviour not depend on `--dev`: rather
set the default resolution to `none` (new setting) when we run in
`--dev` so that it can be configured to behave as we want for tests.

In this way we keep the runtime check for its intended purpose and can
run our FTR tests "as end users" of our endpoints.

---

Close https://github.com/elastic/kibana/issues/161435
2023-07-11 11:51:05 +02:00
Pierre Gayvallet
79b5754a12
[ZDT] handle failures during switch from v2 algo (#161476)
## Summary

Fix a bug that was causing the cluster to fall into an unrecoverable
state if an error occurs during the document migration phase of a `v2`
to `zdt` migration (first zdt migration to take over the `v2`
algorithm).

When an error occurs during the document migration phase, the index gets
in a state where `mappingVersions` is present but not `docVersions`, and
the algorithm wasn't able to understand what this state was, and
considered it to just be a plain `zdt` predecessors, which caused an
error when entering the document migration phase, as `docVersions`
couldn't be found.

This PR addresses this, by properly identifying this specific state, and
acting accordingly (by initiating a document migration without checking
for the versions in `docVersions`, as we do then coming from a plain v2
algo)
2023-07-10 05:46:41 -07:00
Pierre Gayvallet
52eb488692
[modelVersions] add new migration change types (#161147)
## Summary

Related to https://github.com/elastic/kibana/issues/150296

- Add the following SO model version change types:
  - `data_removal`
  - `unsafe_transform`
- Change the existing `data_backfill` type to something less permissive
- Update the tsdoc and documentation accordingly

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-07-07 17:18:21 +02:00
Tim Sullivan
f82588ba5e
[Serverless] Support banner header (#160912)
## Summary

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

This PR adds support for the header banner in serverless projects. 
<img width="1437" alt="image"
src="c950bbe7-46bb-4b82-b9ee-406aef7748dc">

**NOTE:** This PR adds support for the header banner by applying the
same techniques as in the "classic" layout: special class names of
`header__bar`/`header_firstBar`/`header__secondBar`. The effect is the
"header action menu" bar, which is an optional 2nd bar in the chrome
header, works better after this change when it is always visible. This
is a temporary issue that unblocks the header banner, and fixes other
overlapping issues with the current project layout stylings.

_As followup work_, the @elastic/appex-sharedux team will investigate
converting the Kibana page template to the new
[EuiPageTemplate](https://elastic.github.io/eui/#/templates/page-template/examples)
which supports horizontal sections of a page that have dynamic height --
we need this for the dynamic presence of the header banner, and the
intended dynamic presence of the header action menu.

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] 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))
- [x] 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))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
2023-07-06 14:43:26 -07:00
Bree Hall
4cf630bfec
Upgrade EUI to 83.0.0 (#160813)
`eui@82.1.0`  `83.0.0`

⚠️ The biggest change in this PR by far is the `EuiButtonEmpty` Emotion
conversion, which changes the DOM structure of the button slightly as
well as several CSS classes around it.

EUI has attempted to convert any custom EuiButtonEmpty CSS overrides
where possible, but would super appreciate it if CODEOWNERS checked
their touched files. If anything other than a snapshot or test was
touched, please double check the display of your button(s) and confirm
everything still looks shipshape. Feel free to ping us for advice if
not.

---

## [`83.0.0`](https://github.com/elastic/eui/tree/v83.0.0)

**Bug fixes**

- Fixed `EuiPaginationButton` styling affected by `EuiButtonEmpty`'s
Emotion conversion ([#6893](https://github.com/elastic/eui/pull/6893))

**Breaking changes**

- Removed `isPlaceholder` prop from `EuiPaginationButton`
([#6893](https://github.com/elastic/eui/pull/6893))

## [`82.2.1`](https://github.com/elastic/eui/tree/v82.2.1)

- Updated supported Node engine versions to allow Node 16, 18 and >=20
([#6884](https://github.com/elastic/eui/pull/6884))

## [`82.2.0`](https://github.com/elastic/eui/tree/v82.2.0)

- Updated EUI's SVG icons library to use latest SVGO v3 optimization
([#6843](https://github.com/elastic/eui/pull/6843))
- Added success color `EuiNotificationBadge`
([#6864](https://github.com/elastic/eui/pull/6864))
- Added `badgeColor` prop to `EuiFilterButton`
([#6864](https://github.com/elastic/eui/pull/6864))
- Updated `EuiBadge` to use CSS-in-JS for named colors instead of inline
styles. Custom colors will still use inline styles.
([#6864](https://github.com/elastic/eui/pull/6864))

**CSS-in-JS conversions**

- Converted `EuiButtonGroup` and `EuiButtonGroupButton` to Emotion
([#6841](https://github.com/elastic/eui/pull/6841))
- Converted `EuiButtonIcon` to Emotion
([#6844](https://github.com/elastic/eui/pull/6844))
- Converted `EuiButtonEmpty` to Emotion
([#6863](https://github.com/elastic/eui/pull/6863))
- Converted `EuiCollapsibleNav` and `EuiCollapsibleNavGroup` to Emotion
([#6865](https://github.com/elastic/eui/pull/6865))
- Removed Sass variables `$euiCollapsibleNavGroupLightBackgroundColor`,
`$euiCollapsibleNavGroupDarkBackgroundColor`, and
`$euiCollapsibleNavGroupDarkHighContrastColor`
([#6865](https://github.com/elastic/eui/pull/6865))

---------

Co-authored-by: Cee Chen <constance.chen@elastic.co>
Co-authored-by: Jeramy Soucy <jeramy.soucy@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-07-06 12:46:55 -07:00
Jean-Louis Leysens
644356c491
[HTTP] Additional version negotiation mechanism (#160399)
## Summary

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

Adds a new, additional mechanism for negotiating version (via query
parameter). This is specifically intended to enable Kibana versioned
endpoints to be usable in browser environments where setting a header is
not always possible (like in an `img` tag's `href`).

Note: the header-based version still takes precedence if present.


### 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
2023-07-05 17:00:53 +02:00
Pierre Gayvallet
833410b39f
[ZDT] support registering new types (#161255)
## Summary

Related to https://github.com/elastic/kibana/issues/150296

Fix a bug causing the ZDT migration algorithm to fail when a new type
gets introduced between two versions.
2023-07-05 16:56:09 +02:00
Gerard Soldevila
72719a5013
[ZDT] Pickup updated types only (#161123)
Part of https://github.com/elastic/kibana/issues/161067

Same idea as https://github.com/elastic/kibana/pull/159962, but applied
to ZDT.

When "picking up" the updated mappings, we add a "query" in order to
select and update only the SO types that have been updated, compared to
the previous version.
2023-07-04 08:01:31 -07:00
Pierre Gayvallet
90b3e712cb
[http] capture errors thrown from handlers (#161063)
## Summary

Fix https://github.com/elastic/kibana/issues/156803

Use `apm.captureError` to properly capture errors thrown by the route
handler (as those errors are then converted to generic 500 errors before
being returned by the server to avoid leaking internal info)
2023-07-03 05:16:35 -07:00
Sébastien Loix
dea3423b2f
[Cloud] Update support and user profile header menus (#160535) 2023-07-02 20:29:07 +01:00
Gerard Soldevila
6f87e1d696
[Migrations] Only pickup updated SO types when performing a compatible migration (#159962)
## Summary

Tackles the first improvement described in
https://github.com/elastic/kibana/issues/160038.

When "picking up" the updated mappings, we add a "query" in order to
select and update only the SO types that have been updated, compared to
the previous version.

We achieve this by comparing `migrationMappingPropertyHashes`; we
compare the hashes stored in the
`<soIndex>.mapping._meta.migrationMappingPropertyHashes` against the
ones calculated from the definitions from the `typeRegistry`.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-30 07:40:40 -07:00
Lukas Olson
1223c3f55f
Fix theming for error toasts (#160219)
## Summary

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

Applies the current theme (dark/light) to error toasts.

Before:


![image](b0a05412-3e07-4980-b3e8-8dcdb602119f)

After:


![image](96bbaf58-25a6-47a3-b9ba-b3caf7a90cd9)
2023-06-28 07:58:33 -07:00
Pierre Gayvallet
ec962e05e6
Enable ZDT migration algorithm on serverless (#160536)
## Summary

Enable the ZDT migration algorithm on serverless deployments
2023-06-27 00:50:05 -07:00
Anton Dosov
d803d8317c
[Serverless] Project Breadcrumbs (#160252)
## Summary

- close https://github.com/elastic/kibana/issues/156517
- built on top of https://github.com/elastic/kibana/pull/156855
- [Serverless chrome breadcrumbs
requirements](https://docs.google.com/document/d/1e5SbDPpySiPeBrjgLJD6Qw6fJyiy34uO2dmGLHlu38E/edit)
- [Serverless chrome breadcrumbs API tech
do](https://docs.google.com/document/d/1_qL14NMGYdI0913eclJd3DXG0lQ2jkE0V3578iaDASs/edit#heading=h.ndqge1i76y6p)

This PR implements serverless (project) breadcrumbs. Now Chrome
automatically renders the main part of the breadcrumbs based on the
project navigation tree and current active path. Plugins can append
their deeper context breadcrumbs or override the navigation breadcrumbs.

```
plugins.serverless.setBreadcrumbs(myDeeperContextBreadcrumbs);

plugins.serverless.setBreadcrumbs(myCustomBreadcrumbs, {absolute: true});
```


Oblt: 

![Screenshot 2023-06-22 at 14 44
32](48bdb397-916c-4861-8a6d-1440f1be7cd4)


Search: 

![Screenshot 2023-06-22 at 14 45
27](0da376d4-c918-4ac5-9869-4154f6c23b36)


Security:

Security hasn't changed because they don't set the project navigation
tree yet. They still have regular breadcrumbs.




-----

Notes: We thought of a possible edge case where an app would set deeper
breadcrumbs `plugins.serverless.set breadcrumbs({text: 'foo', href:
'/foo'});` but the project navigation already have this link as part of
the path. If we hit this edge in the real world, we can workaround this
by merging the same consequent breadcrumbs by a deep link id.

---------
2023-06-26 16:25:42 +02:00
Patryk Kopyciński
a1d02824f1
[shared-ux-router] Add Router and Routes components (#159834)
## Summary

Why?

To simplify the process of migration to react-router@6.
https://github.com/remix-run/react-router/discussions/8753

What problems exactly it solves?

- In my previous PR I added `CompatRouter`
https://github.com/elastic/kibana/pull/159173, which caused changes in
~50 files and pinged 15 Teams. And this is just meant to be a temporary
change, so when we're done with the migration I would have to revert
these changes and engage everyone to review the PR again. And it is just
a single step in the migration strategy. So to make our lives easier I
think it would be better to have a common place where we do import our
router components because it will allow us to surface some extra logic
in single place instead of going through the whole source code again.

- `react-router@6` doesn't support a custom `Route` component, so that
means our custom `Route` component that we're using almost everywhere
today, will need to be replaced by a different solution. I have decided
to add `Routes` component, which will be responsible for rendering the
proper component (`react-router@6` renamed `Switch` to `Routes`, so I
have named this component to align with the dictionary of the new
router) and also is going to add the logic that today is done in `Route`
(moving logic to `Routes` will be done in the follow-up PR, here I just
wanted to focus on using the common router components to make the review
process easier)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-23 10:02:06 -05:00
Sébastien Loix
39c738b819
[SharedUxChromeNavigation] Detect active nav route(s) (#159906) 2023-06-22 11:30:47 +01:00
Pierre Gayvallet
27df64c2bc
[EBT] Add page title to browser-side context (#159936)
## Summary

Part of https://github.com/elastic/kibana/issues/149249

Add a new EBT context providing the page_title field to events.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-20 04:31:25 -07:00
Pierre Gayvallet
97dc2ecba1
[EBT] Add page url to browser-side context (#159916)
## Summary

Part of https://github.com/elastic/kibana/issues/149249

Add a new EBT context providing the `page_url` field to events.

`page_url` is based on the current url's `pathname` and `hash`
exclusively (no domain, port, query param...)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-20 03:13:29 -07:00
Pierre Gayvallet
9e0c9a7ad5
/api/status - always return a consistent status code (#159768)
## Summary

Fix https://github.com/elastic/kibana/issues/158910

Changes the behavior of the `/api/status` endpoint to always returns a
consistent http status code, and in particular:
- during the preboot stage 
- when accessed by unauthenticated users and `status.allowAnonymous` is
`false`.

That way, `/api/status` can properly be used for readiness checks. 

Please refer to https://github.com/elastic/kibana/issues/158910 for more
details.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-20 02:06:40 -07:00
Tim Sullivan
acda8cf8b9
[Chrome Project Header] Fix side nav collapsed state toggle (#159850)
## Summary

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

This PR restores this specific code to how it was previous to
09577fa0af

### 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
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] 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))
- [x] 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))
- [x] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
2023-06-19 07:47:14 -07:00
Pierre Gayvallet
83abc6e3c0
[uiSettings] always use the latest config document to create the new one (#159649)
## Summary

Fix https://github.com/elastic/kibana/issues/159646

Fix the config creation-from-previous-one logic by always using the
latest config for the new version's creation


## Release Note

Fix a bug that could cause old Kibana deployments to loose their
uiSettings after an upgrade

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-19 00:09:27 -07:00
Jean-Louis Leysens
2b81164ff9
[http] Only allow 2023-10-31 when registering public versions (#159553)
## Summary

Adds logic (and tests) to ensure that all registered public routes are
set to `2023-10-31` for now. This check is only performed in dev mode
which allows us to test our existing route default logic.

### Notes

This works best as a runtime check given the versioned router API, but
perhaps I missed a way to do this with just type checking?
2023-06-15 11:50:54 -04:00
Jean-Louis Leysens
a1c5603421
[http] Enhance versioned router mock for easier introspection (#159669)
## Summary

Adds a helper/util to the Versioned router mock so that tests can more
easily be expressed against registered versioned routes.

### Usage

See included test. Thanks @paul-tavares for providing some prior art, I
adapted slightly to rather return all the versions. Let me know what you
think!

CC @pgayvallet @paul-tavares
2023-06-14 07:54:23 -07:00
Patryk Kopyciński
09577fa0af
Add react-router-dom-v5-compat (#159173)
## Summary

Prep work for bumping react-router to v6
Following https://github.com/remix-run/react-router/discussions/8753

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-14 05:13:15 -07:00
Matthew Kime
f2dbde14e9
[core router] Improve error message when version header is missing (#159601)
## Summary

Across the kibana code base there are a number of http client wrappers,
some of which have special handling of the version header and some
don't. This can be quite confusing when you get an error message that
says "Please specify a version." and you _are_ specifying a version
header but you're not specifying _the_ version header. Now the error
message will remind you where it expects to find the version.
2023-06-14 10:17:40 +02:00
Ido Cohen
56e9cebe21
[Cloud Security] convert stats api router to be versioned 2023-06-14 10:49:15 +03:00
Tim Sullivan
cabfebe5a5
[Serverless Chrome] Polish of home logo and project switcher (#158523)
Closes https://github.com/elastic/kibana/issues/157810
Closes https://github.com/elastic/kibana/issues/158879

## Summary

1. Moves the Logo icon out of the side nav and to the left of the
breadcrumbs
1. Moves the project switcher from the right of the header to the just
to the right of the logo
1. Removes the link to cloud from the side nav. Design is still TBD.
1. Adds new `serverless.setProjectHome` API since the home link is no
longer in the side nav
1. Removes the `linkToCloud` prop from the Navigation component since
design is still TBD.
1. Exposes the Global Search bar

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### Screenshots
**Default**
<img width="1732" alt="Screenshot 2023-06-06 at 11 46 52 AM"
src="45cb55f6-aea6-4b40-86c2-3b386691fbf5">
**Global search (not yet collapsed by default)**
<img width="1732" alt="Screenshot 2023-06-06 at 11 46 37 AM"
src="9ca6c28d-755f-45be-b680-89b5b4b1fb36">
**Collapsed side nav**
<img width="1732" alt="image"
src="f334ab99-0fda-455c-a9e5-6b5f64aa954d">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-06-13 19:24:58 -07:00
Sébastien Loix
fb41ca56f9
[SharedUxChromeNavigation] Use deeplink id instead of href (#159125) 2023-06-13 10:10:10 -07:00
Jean-Louis Leysens
7d07149323
[http] Do not do client version check on serverless as we do for onprem (#159101)
## Summary

This PR introduces two changes:

(1) Refactors the handler resolution logic to _not_ depend on the
`--serverless` cli arg by adding a new piece of config
`server.versioned.routeResolution` that accepts `newest | oldest`. This
piece of config is passed down instead of the `serverless` cli arg as
well as updating test cases

(2) Adds a new piece of config to turn off the client version checking.
This will be needed for rolling upgrades to allow old browser traffic to
reach new Kibana servers when there is stack version change.

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

## Open questions

* Do we want to make the version check still take _major_ version bumps
into account?
2023-06-13 05:12:55 -07:00
Matthew Kime
26d4ba5c3e
[data views] Use versioned router for REST routes (#158608)
## Summary

Version alllll the data view routes.

Best viewed with whitespace hidden -
https://github.com/elastic/kibana/pull/158608/files?diff=unified&w=1

In this PR:
- All REST (public and internal) routes are versioned
- Internal routes are called with version specified
- Internal and public routes are now stored in directories labeled as
such
- All routes have a response schema
- All responses are typed with `response` types, separate from internal
api types. This is to help prevent unacknowledged changes to the api.
- Moves some functional tests from js => ts

For follow up PRs:
- Move to `internal` path for internal routes
- Proper typing and schema for `fields_for_wildcard` filter

Closes https://github.com/elastic/kibana/issues/157099
Closes https://github.com/elastic/kibana/issues/157100

---------

Co-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com>
2023-06-12 22:01:03 -05:00
Pierre Gayvallet
b08c322524
Allow exporting all SO types (#159289)
## Summary

Fix https://github.com/elastic/kibana/issues/150079

Add support for the `*` wildcard for by-type export, allowing to more
easily export all the exportable SO types

```
POST /api/saved_objects/_export
{
   types: '*',
}
```

## Release Note

The savedObjects export API now supports exporting all types using the
`*` wildcard. Please refer to the documentation
for more details and examples.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-12 00:03:54 -07:00
Alex Szabo
f51f5f42e6
Serve.js refactors (#158750)
Closes #155137, with some extra reorganisation, modularisation and unit
tests.

### Refactors to `maybeAddConfig`

### Refactoring serve.js <-> bootstrap.ts

### Unit tests for `compileConfigStack`
---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-08 09:35:10 +02:00
Jeramy Soucy
dd3193c88e
Implements default Permissions-Policy header (#158514)
Closes #154252

## Summary

This PR implements a default [permissions policy
header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy)
for Kibana. It takes into consideration only the directives that are
_not_ still in development/pre-release. These directives are:
 - camera
 - display-capture
 - fullscreen
 - geolocation
 - microphone
 - web-share

All directives above are set to an empty or "none" allow list, with the
exception of `fullscreen`. The default permissions policy for Kibana
will be: `camera=(), display-capture=(), fullscreen=(self),
geolocation=(), microphone=(), web-share=()`.

The `display-capture` directive only affects access to the [Screen
capture
API](https://developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API),
whereas our reporting utilities rely on a headless Chrome feature.
FullyStory also does not appear to rely on capturing the screen, but
rather on [capturing the DOM and
CSS](3600206230-Does-FullStory-work-with-my-complex-site-)
to reproduce the screen and user stories. We have confirmed with
FullStory support that they do not use the Screen capture API
(`getDisplayMedia()`).

The `fullscreen` directive affects access to the
[element.requestFullscreen
API](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen).
Our fullscreen view for Dashboards and visualizations appear to be
scoped to the Kibana application and not the browser or system, but
there is one use of `requestFullscreen` in the synthetics plugin's
`grid_group_item`, hence the default setting of 'self' here.

## Testing
Due to screen capture reports (PNG & PDF) and fullscreen modes working
with the configuration defined above, I wanted to double-check the
header was working, so I tested both camera and microphone access. I did
this by adding some code into our team's user management screen that
would attempt to access both the camera and microphone. I could confirm
that with the permissions policy header (as defined), no access prompts
would appear for either resource. When I removed the directives for the
camera and microphone from the permissions policy header, prompts
appeared in the browser (Chrome) to approve access to the camera and
microphone.

### Manual Test:
1. Start Elasticsearch and Kibana from this PR
2. Sign into Kibana and open your browser's dev tools
3. In the network tab, inspect one of the requests for localhost
4. In the Headers tab, verify the permissions-policy header is present
with the new default value defined above, `camera=(),
display-capture=(), fullscreen=(self), geolocation=(), microphone=(),
web-share=()`
5. Edit the kibana.yml file, add
`server.securityResponseHeaders.permissionsPolicy: camera=(self)`
6. Refresh Kibana in the browser, verify the permissions-policy header
is present with the value set in kibana.yml in step 5
7. Edit the kibana.yml file, add
`server.securityResponseHeaders.permissionsPolicy: null`
8. Refresh Kibana in the browser, verify the permissions-policy header
is no longer present

## Release Notes:
Security
Adds default Permissions-Policy header including all non-experimental
directives [#158514](https://github.com/elastic/kibana/pull/158514)

---------

Co-authored-by: James Rodewig <james.rodewig@elastic.co>
2023-06-07 19:48:44 +02:00
Dario Gieselaar
4a5dcbdea8
[Observability] Co-pilot (tech preview) (#158678) 2023-06-07 04:42:03 -07:00
Gerard Soldevila
f017e69660
Address PR#158940 remarks (#159132)
This PR addresses remarks and feedback from
https://github.com/elastic/kibana/pull/158940, which was part of an
emergency release.
2023-06-07 02:31:22 -07:00
Pierre Gayvallet
9f5ecaa913
Add introduction and examples for the model version API (#158904)
## Summary

Add a markdown file with a short introduction to model versions and
examples of the currently supported migration scenarios.
2023-06-07 02:09:39 -04:00
Jean-Louis Leysens
6cf0c8c564
[http] Require version headers for internal endpoints (#159009)
## Summary

Makes version headers required for internal endpoints. We also require
version headers for public endpoints when in dev mode.

### Note to reviewers

This PR is a re-revert of the original
https://github.com/elastic/kibana/pull/158667 with some minor additions
(see comments).

The original was reverted due to failing Cypress tests blocking Kibana
promotion for 8.8.1 (CC @stephmilovic,
https://github.com/elastic/kibana/pull/158961)

Not sending headers to versioned, internal endpoints will return 400!
Due to the somewhat sensitive nature of this change, I went through all
of the existing `.versioned` endpoints and tried to ensure that for
_internal_ endpoints we send through a version as this is now
**required**.

I would greatly appreciate it if code owners could check their code,
think of any existing consumers of your versioned endpoints and ensure
they are sending a version.

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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Patryk Kopycinski <contact@patrykkopycinski.com>
2023-06-06 11:51:06 -06:00
Anton Dosov
d4f4a25e60
[Serverless/breadcrumbs] Bootstrap and API (#156855)
## Summary

Partially address https://github.com/elastic/kibana/issues/156517

Based on: 
- [Serverless chrome breadcrumbs
requirements](https://docs.google.com/document/d/1e5SbDPpySiPeBrjgLJD6Qw6fJyiy34uO2dmGLHlu38E/edit)
- [Serverless chrome breadcrumbs API tech
doc](https://docs.google.com/document/d/1_qL14NMGYdI0913eclJd3DXG0lQ2jkE0V3578iaDASs/edit#heading=h.ndqge1i76y6p)

Adds an api and bootstrap code for project (serverless) breadcrumbs
which allows to either set a "deeper context" breadcrumbs or override
nav controlled breadcrumbs:

```
plugins.serverless.setBreadcrumbs(myDeeperContextBreadcrumbs);

plugins.serverless.setBreadcrumbs(myCustomBreadcrumbs, {absolute: true});
``` 

This PR adds an API and sets everything around the breadcrumb building
logic. Actual breadcrumbs building is not implemented and depends on
https://github.com/elastic/kibana/issues/157702 as we need the
navigation tree to be available in chrome service.


This PR doesn't have any visible changes
2023-06-06 15:10:35 +02:00
Sébastien Loix
1b04f5938a
[SharedUxChromeNavigation V2] Remove "v1" implementation (#158919) 2023-06-06 08:53:55 +01:00
Cee Chen
c52ff7f425
Upgrade EUI to v81.2.0 (#158781)
## Summary

`eui@81.0.0`  `eui@81.2.0`

- Most changes to source code in this PR are CSS cleanups/deprecations
in `EuiSuperDatePicker`/`EuiDatePickerRange`
- One team (ML) had a `inline` specific usage of `EuiDatePickerRange`
that they reached out to us about via Slack, and that we have fixed in
this PR.
- All other usages of date picker components should have remained
working as-is with no changes, but please ping us if you see otherwise!

___

## [`81.2.0`](https://github.com/elastic/eui/tree/v81.2.0)

- Updated `EuiSuperDatePicker` to accept an object configuration for
`isDisabled` ([#6821](https://github.com/elastic/eui/pull/6821))

**Bug fixes**

- Fixed broken `EuiSuperDatePicker` styles
([#6821](https://github.com/elastic/eui/pull/6821))

## [`81.1.0`](https://github.com/elastic/eui/tree/v81.1.0)

- Added `EuiInlineEditText` and `EuiInlineEditTitle` components
([#6757](https://github.com/elastic/eui/pull/6757))
- Updated `EuiDatePickerRange` to support `inline` display
([#6795](https://github.com/elastic/eui/pull/6795))
- Added an `onError` callback prop to `EuiErrorBoundary`
([#6810](https://github.com/elastic/eui/pull/6810))
- Updated `EuiDataGrid` to only render screen reader text announcing
cell position if the cell is currently focused. This should improve the
ability to copy and paste multiple cells without SR text.
([#6817](https://github.com/elastic/eui/pull/6817))

**Bug fixes**

- Fixed `EuiDatePicker`'s `inline` display to correctly render and
prevent user interaction when `disabled` or `readOnly`
([#6795](https://github.com/elastic/eui/pull/6795))
- Fixed `EuiDatePicker`'s `inline` display to correctly render
`isInvalid` and `isLoading` icons
([#6795](https://github.com/elastic/eui/pull/6795))

**CSS-in-JS conversions**

- Converted `EuiDatePickerRange` to Emotion
([#6795](https://github.com/elastic/eui/pull/6795))

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-05 13:51:40 -07:00
Alejandro Fernández Haro
9156d89eb5
[Versioned HTTP] Track adoption (#159026) 2023-06-05 16:40:42 +02:00
Alex Szabo
c57589ec57
Fix config stacking order (#158827)
## Summary
Fixes: #155154 (introduced in #149878), builds on #155436 .

- Adds tests to ensure the configuration merging order, check those for
reference.
- Updates the README to explain the intention
 
For the tests, I needed to output something to the logs. I hope it's not
a big issue to log it. If needed, I might hide that behind a verbose- or
feature flag.

### 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: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-05 15:15:07 +02:00
Christiane (Tina) Heiligers
fd068da3a4
[SOR] Adds support for validation schema with models (#158527)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-05 06:11:38 -07:00
Gerard Soldevila
94fb44ae0c
[Migrations] Update all aliases with a single updateAliases() when relocating SO documents (#158940)
Fixes https://github.com/elastic/kibana/issues/158733

The goal of this modification is to enforce migrators of all indices
involved in a relocation (e.g. as part of the [dot kibana
split](https://github.com/elastic/kibana/issues/104081)) to create the
index aliases in the same `updateAliases()` call.

This way, either:
* all the indices involved in the [dot kibana
split](https://github.com/elastic/kibana/issues/104081) relocation will
be completely upgraded (with the appropriate aliases).
* or none of them will.
2023-06-05 10:19:24 +02:00
Rudolf Meijering
8e7e2632bb
Migrations: Don't auto-create temp index (#158182)
## Summary

Try to fix
https://github.com/elastic/kibana/issues/156117#issuecomment-1557029863

## Release notes
Fixes a race condition that could cause intermittent upgrade migration
failures when Kibana connects to a single node Elasticsearch cluster.

### 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
- [ ] 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#kibana-release-notes-process)
2023-06-04 15:34:08 -07:00
Jon
43928cc9f5
Revert "[http] Make http headers required for internal and when in … (#158961)
…dev mode (#158667)"

This reverts commit de6d8ca33f.
2023-06-02 14:46:10 -05:00
Jean-Louis Leysens
de6d8ca33f
[http] Make http headers required for internal and when in dev mode (#158667)
## Summary

Updates the versioned router behaviour to require the setting of version
on requests when either requesting against:

(1) internal endpoints
or
(2) all endpoints when Kibana is in dev mode

The idea is that when calling our versioned endpoints we should always
be requesting a specific version to avoid possible inconsistent
behaviour if our defaults resolution changes onprem (oldest version) vs
serverless (newest version).

Partially addresses https://github.com/elastic/kibana/issues/158722

### Follow up
* We should update our dev docs to point out this behaviour


### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
2023-06-02 07:16:35 -07:00
Sébastien Loix
238d5bb825
[SharedUxChromeNavigation V2] Add EUI component to building blocks (#158297) 2023-06-02 13:50:48 +01:00
Pierre Gayvallet
1ba8be4b8a
V2 migration algorithm: add tests for model versions (#158697)
## Summary

Add integration tests of scenarios using the v2 migration algorithm with
SO types that are using the model version API
2023-06-02 03:35:48 -07:00
Alejandro Fernández Haro
312ba3a758
[Telemetry] Update notice message (#158669)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Jean-Louis Leysens <jloleysens@gmail.com>
2023-06-01 17:53:02 +02:00