Commit graph

238 commits

Author SHA1 Message Date
Gerard Soldevila
6049493e4a
Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-core (#201653)
## Summary

Start relocating Kibana modules (packages and plugins) to the new folder
structure, according to the _Kibana Sustainable Architecture_
initiative.
#### 16 plugin(s) are going to be relocated:

| Id | Target folder |
| -- | ------------- |
| `@kbn/cloud-chat-plugin` |
`x-pack/platform/plugins/private/cloud_integrations/cloud_chat` |
| `@kbn/cloud-experiments-plugin` |
`x-pack/platform/plugins/shared/cloud_integrations/cloud_experiments` |
| `@kbn/cloud-full-story-plugin` |
`x-pack/platform/plugins/private/cloud_integrations/cloud_full_story` |
| `@kbn/cloud-links-plugin` |
`x-pack/platform/plugins/private/cloud_integrations/cloud_links` |
| `@kbn/cloud-plugin` | `x-pack/platform/plugins/shared/cloud` |
| `@kbn/features-plugin` | `x-pack/platform/plugins/shared/features` |
| `@kbn/ftr-apis-plugin` | `src/platform/plugins/private/ftr_apis` |
| `@kbn/kibana-usage-collection-plugin` |
`src/platform/plugins/private/kibana_usage_collection` |
| `@kbn/licensing-plugin` | `x-pack/platform/plugins/shared/licensing` |
| `@kbn/newsfeed-plugin` | `src/platform/plugins/shared/newsfeed` |
| `@kbn/saved-objects-management-plugin` |
`src/platform/plugins/shared/saved_objects_management` |
| `@kbn/telemetry-collection-manager-plugin` |
`src/platform/plugins/shared/telemetry_collection_manager` |
| `@kbn/telemetry-collection-xpack-plugin` |
`x-pack/platform/plugins/private/telemetry_collection_xpack` |
| `@kbn/telemetry-management-section-plugin` |
`src/platform/plugins/shared/telemetry_management_section` |
| `@kbn/telemetry-plugin` | `src/platform/plugins/shared/telemetry` |
| `@kbn/usage-collection-plugin` |
`src/platform/plugins/shared/usage_collection` |

#### 22 package(s) are going to be relocated:

| Id | Target folder |
| -- | ------------- |
| `@kbn/analytics` | `src/platform/packages/shared/kbn-analytics` |
| `@kbn/analytics-collection-utils` |
`src/platform/packages/private/analytics/utils/analytics_collection_utils`
|
| `@kbn/apm-config-loader` |
`src/platform/packages/private/kbn-apm-config-loader` |
| `@kbn/cloud` | `src/platform/packages/shared/cloud` |
| `@kbn/config` | `src/platform/packages/shared/kbn-config` |
| `@kbn/config-mocks` | `src/platform/packages/private/kbn-config-mocks`
|
| `@kbn/config-schema` |
`src/platform/packages/shared/kbn-config-schema` |
| `@kbn/crypto-browser` |
`src/platform/packages/shared/kbn-crypto-browser` |
| `@kbn/ebt-tools` | `src/platform/packages/shared/kbn-ebt-tools` |
| `@kbn/es-errors` | `src/platform/packages/shared/kbn-es-errors` |
| `@kbn/es-types` | `src/platform/packages/shared/kbn-es-types` |
| `@kbn/hapi-mocks` | `src/platform/packages/private/kbn-hapi-mocks` |
| `@kbn/health-gateway-server` |
`src/platform/packages/private/kbn-health-gateway-server` |
| `@kbn/i18n` | `src/platform/packages/shared/kbn-i18n` |
| `@kbn/i18n-react` | `src/platform/packages/shared/kbn-i18n-react` |
| `@kbn/logging` | `src/platform/packages/shared/kbn-logging` |
| `@kbn/logging-mocks` |
`src/platform/packages/shared/kbn-logging-mocks` |
| `@kbn/router-to-openapispec` |
`src/platform/packages/shared/kbn-router-to-openapispec` |
| `@kbn/server-http-tools` |
`src/platform/packages/shared/kbn-server-http-tools` |
| `@kbn/std` | `src/platform/packages/shared/kbn-std` |
| `@kbn/utility-types` |
`src/platform/packages/shared/kbn-utility-types` |
| `@kbn/zod` | `src/platform/packages/shared/kbn-zod` |

---------

Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-01-04 11:47:24 -07:00
Alejandro Fernández Haro
2ed34427c0
[Deprecations] Logs Sources settings in all spaces (#203042) 2024-12-16 13:40:56 +01:00
elastic-renovate-prod[bot]
e061b4c352
Update dependency @elastic/elasticsearch to ^8.16.0 (main) (#200275)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[@elastic/elasticsearch](http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html)
([source](https://togithub.com/elastic/elasticsearch-js)) | dependencies
| minor | [`^8.15.2` ->
`^8.16.0`](https://renovatebot.com/diffs/npm/@elastic%2felasticsearch/8.15.2/8.16.0)
|

---

### Release Notes

<details>
<summary>elastic/elasticsearch-js
(@&#8203;elastic/elasticsearch)</summary>

###
[`v8.16.0`](https://togithub.com/elastic/elasticsearch-js/releases/tag/v8.16.0)

[Compare
Source](https://togithub.com/elastic/elasticsearch-js/compare/v8.15.2...v8.16.0)


[Changelog](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/8.16/changelog-client.html)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjUuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQyNS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJUZWFtOkNvcmUiLCJUZWFtOk9wZXJhdGlvbnMiLCJiYWNrcG9ydDpza2lwIiwicmVsZWFzZV9ub3RlOnNraXAiXX0=-->

Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-12-13 02:47:34 -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
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
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
elastic-renovate-prod[bot]
4f53a11347
Update dependency @elastic/elasticsearch to ^8.15.1 (main) (#196478) 2024-11-11 21:08:40 +01: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
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
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
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
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
Kyra Cho
c36a894398
Add logging to importer. Closes issue #192212 (#192234)
## Summary
Hello, this closes issue #192212 by adding a custom logger to the
importer, making debugging issues easier.
### Checklist

Delete any items that are not applicable to this PR.

- [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
- [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 TODO
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed TODO
- [N/A] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [N/A] 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))
- [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 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))
- [N/A] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### For maintainers

- [X] 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)
(no API changes)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-10-08 03:58:32 +02:00
Gerard Soldevila
d4cc182e8a
[Migrations] Upgrade tests to use 9.x compatible archives (#193696)
## Summary

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

Merges some tested code paths into `v2_migration.test.ts` which uses an
archive that is generated in 9.0.0.
Gets rid of the related failing tests.
2024-09-24 05:05:46 -05:00
Jean-Louis Leysens
3fa5bdf873
[HTTP] Set explicit access for public HTTP APIs (#192554)
## Summary

We will be enforcing restricted access to internal HTTP APIs [from
9.0](https://github.com/elastic/kibana/issues/186781). This PR is part 1
of audit checking that our public APIs have their access tag set
explicitly to ensure they are still available to end users after we
start enforcing HTTP API restrictions. APIs reviewed in this PR
([docs](https://www.elastic.co/guide/en/kibana/current/dashboard-import-api.html)):

<img width="260" alt="Screenshot 2024-09-11 at 11 25 55"
src="https://github.com/user-attachments/assets/499b1f1f-8e01-4463-9410-4500e438cd23">

## Note to reviewers

This audit is focussed on set `access: 'public'` where needed. Per the
screenshot our public-facing documentation is taken as the source of
truth for which APIs should be public. This may differ per offering so
please consider whether a given HTTP API should be public on both
serverless and stateful offerings.

## Risks

* If we miss an API that should be public, end users will encounter a
`400` response when they try to use the HTTP API on 9.0
* If we set an API's access to "public" it will not have the same
restrictions applied to it.
2024-09-23 09:53:31 -05:00
Lisa Cawley
9833f0f598
[OAS][DOCS] Add example for import saved objects API (#192291) 2024-09-09 12:17:31 -07:00
Luke Elmers
b6287708f6
Adds AGPL 3.0 license (#192025)
Updates files outside of x-pack to be triple-licensed under Elastic
License 2.0, AGPL 3.0, or SSPL 1.0.
2024-09-06 19:02:41 -06:00
Christiane (Tina) Heiligers
dd221a7be1
[Docs] Add details to SO APIs landing page (#191693)
Fix https://github.com/elastic/kibana/issues/191534
The deprecation warning in the Kibana Saved Objects API main page was
removed in https://github.com/elastic/kibana/pull/190654.

This PR adds a section about when the APIs will be removed and what to
use instead.

The PR also includes updates to other API main pages that mention the SO
APIs.

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

VIew the [html
diff](https://kibana_bk_191693.docs-preview.app.elstc.co/diff) for these
changes:

![Short URLs API landing
page](https://github.com/user-attachments/assets/3716f33e-0d00-4ff7-b29d-7a5ba0a0f1f2)

![Data views API landing
page](https://github.com/user-attachments/assets/81c8a843-27ca-4510-a181-7ec9b20f86d6)

The updated OpenAPI document looks like this in a Bump.sh preview:


![image](https://github.com/user-attachments/assets/a8b58142-5082-4b75-8b3f-339b8a6b57e4)

---------

Co-authored-by: lcawl <lcawley@elastic.co>
2024-08-29 15:04:00 -05:00
elastic-renovate-prod[bot]
68a924411b
Update dependency @elastic/elasticsearch to ^8.15.0 (main) (#190378)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@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>
Co-authored-by: Walter Rafelsberger <walter.rafelsberger@elastic.co>
2024-08-23 12:48:10 -05:00
Larry Gregory
74d88580a5
Migrate codebase to use Object.hasOwn instead of Object.hasOwnProperty (#186829)
## Summary

This PR has breadth, but not depth. This adds 3 new `eslint` rules. The
first two protect against the use of code generated from strings (`eval`
and friends), which will not work client-side due to our CSP, and is not
something we wish to support server-side. The last rule aims to prevent
a subtle class of bugs, and to defend against a subset of prototype
pollution exploits:

- `no-new-func` to be compliant with our CSP, and to prevent code
execution from strings server-side:
https://eslint.org/docs/latest/rules/no-new-func
- `no-implied-eval` to be compliant with our CSP, and to prevent code
execution from strings server-side:
https://eslint.org/docs/latest/rules/no-implied-eval. Note that this
function implies that it prevents no-new-func, but I don't see [test
cases](https://github.com/eslint/eslint/blob/main/tests/lib/rules/no-implied-eval.js)
covering this behavior, so I think we should play it safe and enable
both rules.
- `no-prototype-builtins` to prevent accessing shadowed properties:
https://eslint.org/docs/latest/rules/no-prototype-builtins


In order to be compliant with `no-prototype-builtins`, I've migrated all
usages and variants of `Object.hasOwnProperty` to use the newer
[`Object.hasOwn`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn).
2024-08-13 10:30:19 -05:00
Gerard Soldevila
d9c1f9702b
[Usage Counters] Enhancements to the APIs (#187665)
## Summary

Part of https://github.com/elastic/kibana/issues/186530
Follow-up of https://github.com/elastic/kibana/pull/187064 

The goal of this PR is to provide the necessary means to allow
implementing the [Counting
views](https://docs.google.com/document/d/1W77qoweixcjrq0sEKh_LjIk3j33Xyy9umod9mG9BlOM/edit)
part of the _Dashboards++_ initiative.
We do this by extending the capabilities of the _usage counters_ APIs:
* We support custom retention periods. Currently data is only kept in SO
indices for 5 days. Having 90 days worth of counting was required for
Dashboards++.
* We expose a Search API that will allow retrieving persisted counters.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-08-05 09:33:27 -05:00
Lisa Cawley
e4a0658225
[OAS][DOCS] Deprecate saved object APIs (#189223) 2024-07-30 21:38:04 -05:00
Alejandro Fernández Haro
11b750b10a
Minimize shared-common everywhere (#188606)
## Summary


![8xfggo](https://github.com/user-attachments/assets/f3d9312f-2ad3-4fa2-9daf-01e2b1ad6cac)

At the moment, our package generator creates all packages with the type
`shared-common`. This means that we cannot enforce boundaries between
server-side-only code and the browser, and vice-versa.

- [x] I started fixing `packages/core/*`
- [x] It took me to fixing `src/core/` type to be identified by the
`plugin` pattern (`public` and `server` directories) vs. a package
(either common, or single-scoped)
- [x] Unsurprisingly, this extended to packages importing core packages
hitting the boundaries eslint rules. And other packages importing the
latter.
- [x] Also a bunch of `common` logic that shouldn't be so _common_ 🙃 

### For maintainers

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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-29 12:47:46 -06:00
Nick Partridge
49a985625b
Upgrade prettier dependencies (#188032)
## Summary

- Upgrade `prettier` to `v2.8.x`.
- Upgrade related decencies.
- Adds `prettier` group to renovate config.
- Fixes bootstrapping type error.

## Main Changes

### Add parentheses for `TypeofTypeAnnotation` to improve readability

[link](https://github.com/prettier/prettier/blob/main/CHANGELOG.md#add-parentheses-for-typeoftypeannotation-to-improve-readability-14458-by-fisker)

```ts
// Input
type A = (typeof node.children)[];

// Prettier 2.8.4
type A = typeof node.children[];

// Prettier 2.8.5
type A = (typeof node.children)[];
```

### Add parentheses to head of `ExpressionStatement` instead of the
whole statement


[link](https://github.com/prettier/prettier/blob/main/CHANGELOG.md#add-parentheses-to-head-of-expressionstatement-instead-of-the-whole-statement-14077-by-fisker)

```ts
// Input
({}).toString.call(foo) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo);

// Prettier 2.8.1
({}.toString.call(foo) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo));

// Prettier 2.8.2
({}).toString.call(foo.forEach) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo);
```

## Details

This started because I noticed we were on `typescript@^5` but still on
an old prettier that complained about use of new TS features such as
[`satisfies`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-9.html#the-satisfies-operator).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-24 17:29:05 +01:00
Pierre Gayvallet
10edbf1054
Enforce correct shape for SO attributes and id during create operations (#187876)
## Summary

Fix https://github.com/elastic/kibana/issues/123575
Fix https://github.com/elastic/kibana/issues/105039

This PR does two things:
- adapt SO ID validation to block empty strings (`""`), we we were
already doing with `undefined`
- add validation of the `attributes` to reject primitives and
`undefined` (only accept objects)
2024-07-12 01:10:48 +10:00
Lisa Cawley
dddcf2ef43
[HTTP/OAS] Add tags and summaries for saved object APIs (#184184)
Co-authored-by: Jean-Louis Leysens <jloleysens@gmail.com>
2024-07-08 09:54:52 -04:00
Gerard Soldevila
e524fb6324
Relocate usage-counters to dedicated index and split server Vs ui (#187064)
## Summary

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

This PR sets the basis for allowing namespaced usage counters.
It relocates `usage-counters` SO type from `.kibana` to a dedicated
`.kibana_usage_counters`.

Furthermore, the original SO type is removed, and replaced by 2 separate
types:
* `server-counters`
* `ui-counters`

Note that these 2 steps are necessary if we want to leverage
`namespaces` property of the saved objects.
We can't currently update the `namespaceType: 'agnostic'` without
causing a migration.
Thus, these two types will be defined as `namespaceType: single`.

Up until now, UI counters were stored under a special `domainId:
uiCounter`.
This forced a workaround that consisted in storing `appName:eventName`
in the `counterName` property of the SO.
Having a dedicated SO type for them allows to store `appName` as
`domainId`, avoiding the need for a
[workaround](https://github.com/elastic/kibana/blob/main/src/plugins/usage_collection/common/ui_counters.ts).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-05 21:18:36 +10:00
Pierre Gayvallet
1dee2872f3
Bump @elastic/elasticsearch to 8.14.0 (reloaded) (#186848)
## Summary

Reopening https://github.com/elastic/kibana/pull/186326 with my account,
non-internal PRs are just terrible to work with

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@elastic.co>
2024-06-26 08:29:15 -07:00
Gerard Soldevila
37426f0bde
Check compatible cluster.routing.allocation.enable only on reindex migrations (#186090)
## Summary

Addresses https://github.com/elastic/kibana/issues/177831.

The PR introduces specific steps to check that
`cluster.routing.allocation.enable` has a suitable value for _reindex
migrations_.
Up until now, this check was done systematically after the `INIT` step.

Now, a couple new dedicated steps have been introduced, which allow
verifying this setting on _reindex migrations_ only (highlighted in
orange):


![image](07c7f0b4-fa11-4925-908a-3cb222685796)
2024-06-20 09:19:18 +02:00
Gerard Soldevila
dbdc797781
Prevent write blocking target index during reindex migration (#185939)
## Summary

Addresses https://github.com/elastic/kibana/issues/185918

The idea is to simply check whether the index that a migrator is trying
to `write_block` (aka the source of the reindex operation) matches the
target index name. In this case:
* We assume that other migrators are half way through, ahead of us.
* We abort operation and trust other instances' migrators to finish the
job.
* Subsequent restart, when migration has finished, should basically be a
no-op.
2024-06-19 10:15:05 +02:00
Lisa Cawley
88621152e0
[OAS] Refresh saved objects API document (#186134) 2024-06-13 10:11:59 -07:00
Jean-Louis Leysens
dc78221e2a
[HTTP/OAS] Make SO CRUD and resolve APIs internal on serverless (#184408) 2024-06-11 17:40:03 +02:00
Pierre Gayvallet
374282ded0
SOR: re-enable ES client retry mechanism (#184761)
## Summary

We recently "discovered" that ES calls performed from the SOR were not
having the default retry mechanism used by the ES client.

This is caused by the way we construct the ES client wrapper used for
the SOR, that forces the `maxRetries` option to `0`


8911bfabb0/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository_es_client.ts (L38-L40)

I initially tried to fully get rid of `retryCallCluster` in
https://github.com/elastic/kibana/pull/184658, as we assumed that
re-enabling the retry mechanism would be sufficient, but this was
causing flakiness in test suites (uncaught rejections in plugins not
properly stopping after ES and Kibana are shut down, with
`NoLivingConnectionsError` errors...)

So instead, I just re-enabled the ES client native mechanism by removing
the `maxRetries` override.
2024-06-05 10:34:20 +02:00
Anton Dosov
88757a30a6
Add updated_by to saved objects (#182687)
## Summary

close https://github.com/elastic/kibana-team/issues/899

- Adds `updated_by` to saved object, similar to recently added
`created_by` https://github.com/elastic/kibana/pull/179344
- Fixes `created_by` / `created_at` should be set during upsert
- Improves functional tests coverage
2024-05-29 08:03:11 -07:00
Julia Bardi
ad03dfb1f5
[Fleet] Add warning if need root integrations trying to be used with unprivileged agents (#183283)
## Summary

Closes https://github.com/elastic/ingest-dev/issues/3252

## Add integration
Added warning to Add integration when the integration requires root
privilege and the selected existing agent policy has unprivileged agents
enrolled.

To verify:
- enroll an agent with docker (it has unprivileged: true)
- try to add an integration that requires root e.g. auditd_manager
- verify that when trying to save the integration, the warning callout
is part of the confirm deploy modal

<img width="807" alt="image"
src="420da729-a4f4-4861-9767-001699629397">

## Add agent flyout
Added warning to Add agent flyout when an unprivileged agent is detected
in combination with an agent policy that has integrations requiring root

To verify:
- add an integration to an agent policy that requires root e.g.
auditd_manager
- open Add agent flyout, verify that the warning callout is visible

<img width="1273" alt="image"
src="e4ae1d73-358b-4d3c-9ca0-27e88bc734a6">

### Open question:
- Do we want to show the warning on `Add agent flyout` only for newly
enrolled agents (in the last 10 mins like we query enrolled agents), or
any unprivileged agents that are enrolled to this policy?
- Decision: No longer applicable as we decided to not show a count here

### 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: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-05-21 03:45:00 -07:00
Konrad Szwarc
3d1d2a5d43
[EDR Workflows] Unified Manifest - Manifest Manager (#179698)
This pull request introduces a new SO used for keeping relations between
artifactId and policyId. It addresses an issue where some users found
the single SO structure containing too many nested entries. Originally,
we planned to rewrite the existing Manifest Manager. However, during the
POC implementation, it became clear that the effort required to refactor
and retest the existing solution would be substantial. Therefore, this
pull request can be considered as the first step in transitioning our
approach from one SO to this new, distributed one.

The main idea behind these changes is to modify the structure of the SO,
rather than the logic of the Manifest Manager. To accomplish this, we
need to retrieve the SO from the new source, translate it into the
existing SO format (many SOs to one), execute the unchanged operations
of the Manifest Manager on artifacts, translate the resulting SO into
multiple SOs, and save them.

This change is expected to be deployed with a Feature Flag, and we need
to ensure that everything continues to function correctly in both cases.
Therefore, I've introduced a new FTR suite with the Feature Flag
enabled, which should be run alongside tests with the Feature Flag
disabled. This suite contains duplicated test files that depend on SO
logic. When we activate the Feature Flag, these tests should replace the
existing ones, as the Unified Manifest SO will become the default
approach.

It appears that there is no need to introduce any kind of migrations, as
the Manifest Manager is capable of recreating missing SOs (which has
been tested).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-05-17 16:57:12 +02:00
Gerard Soldevila
ed2e59fea9
Kbn 176803 cleanup 8.14 md5 check (#183416)
## Summary

Follow-up of #176803

Now that `8.14` has been branched and it is about to be released, we can
remove the test that ensures the `HASH_TO_VERSION_MAP` is aligned.

This PR also rolls back a few changes on the map that shouldn't have
been performed, as they belong to `8.15.0`.
2024-05-15 11:37:42 +02:00
Pierre Gayvallet
61e408c963
SOR: Add attr override option for update and bulkUpdate (#183267)
## Summary

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

Add a new `mergeAttributes` option for both `update` and `bulkUpdate`,
which, when set to `false`, allows to perform a "full" update (fully
replacing the current attributes of the document) instead of a "partial"
one (merging the attributes).

Technically, ES doesn't really support it, so it was only made possible
due to the "client-side" update we implemented for ZDT / SO version BWC.
2024-05-15 11:02:32 +02:00
Cristina Amico
eb5e329382
[Fleet] Add support_agentless property in agent policy schema and preconfiguration (#182709)
Closes https://github.com/elastic/kibana/issues/180377

## Summary
Add a new `support_agentless` property in agent policy and in
preconfiguration; this property is only allowed when the environment has
both `isServerless` set to `true` and `agentless` feature flag enabled,
otherwise policy creation/update will throw error `supports_agentless is
only allowed in serverless environments that support agentless feature`.

No UI change is required for now as this property will be needed as part
of a wider support to agentless policies.

## Testing

### Serverless
- Run serverless env configured for agentless following [this
guide](https://docs.elastic.dev/security-solution/cloud-security/serverless/develop-for-kibana#agentless-local-set-up)
- Make sure to have `agentless` feature flag enabled
- Create an agent policy with `support_agentless`  property:
```
POST kbn:/api/fleet/agent_policies
{
  "name": "New agent policy",
  "namespace": "default",
  "supports_agentless": true
}
```
- Update an existing agent policy with the new property:
```
PUT kbn:/api/fleet/agent_policies/<opolicy_id>
{
  "name": "New agent policy",
  "supports_agentless": true
}
```

- Create a preconfigured agent policy in kibana.dev.yml, and verify it
that it's correct via `GET kbn:/api/fleet/agent_policies`:

```
xpack.fleet.agentPolicies: [
  {
    "name": "Agentless Policy",
    "id": "agentless",
    "is_managed": true,
    "namespace": "default",
    "supports_agentless": true,
  },
]
```

- Note that if `agentless` feature flag is disabled, any of the above
will throw an error.

### Stateful
Spin up a stateful env and verify that all of the previous commands fail
with `400` and above error message.

### Checklist
- [ ]
[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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-05-08 10:58:24 +02:00
Cristina Amico
2ecda69e64
[Fleet] Add overrides to package policies update endpoint (#181453)
Closes https://github.com/elastic/kibana/issues/177323

## Summary
Allow to override `inputs` in `PUT package_policies/:id` endpoint. This
functionality will be useful for support and troubleshooting purposes,
but it shouldn't be used in place of normal updates to the policies.

- `inputs` parameters are saved in package policy SO `overrides` field
and then
[merged](https://github.com/elastic/kibana/pull/181453/files#diff-ee6c1fe752205768ab54e6107a869041bcbb6130a0c982fa169bf5aba570a30eR84)
to the full agent policy
- `compiled_streams` and `compiled_inputs` are not allowed


Example with an Nginx policy:
```
PUT kbn:/api/fleet/package_policies/d4fd9578-534f-4e1a-bc75-dfbd4ff0aa14
{
  "overrides": {
    "inputs": {
        "logfile-system-d4fd9578-534f-4e1a-bc75-dfbd4ff0aa14": {
           "log_level": "debug"
        }
      }
  }
}
```
Result in full agent policy:

![Screenshot 2024-05-02 at 10 24
08](3772460b-de29-4679-90e6-d9fdb0d6d67d)


### Checklist

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

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-05-02 13:14:47 +02:00
Gerard Soldevila
9d01ab1ee8
Add per SO type telemetry to core usage counters (#181063)
## Summary

Tackles https://github.com/elastic/kibana/issues/180366

Leverages existing `'core'` _Usage Counters_ to add per SO type
telemetry for the HTTP SO API calls.
2024-04-26 13:14:38 +02:00
Ying Mao
ee1552f10d
[Response Ops][Alerting] Backfill Rule Runs (#177622)
This is the feature branch that contains the following commits. Each
individual PR contains a summary and verification instructions.

- [Schedule backfill API](https://github.com/elastic/kibana/pull/176185)
- [Backfill task runner](https://github.com/elastic/kibana/pull/177640)
- [Get/Find/Delete backfill
API](https://github.com/elastic/kibana/pull/179975)
- [API key invalidation
update](https://github.com/elastic/kibana/pull/180749)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-04-25 15:36:01 -04:00
Kevin Delemme
721d354a13
[SLO] Implement federated views (#178050) 2024-04-16 09:15:51 -04:00
Pierre Gayvallet
65b1d9489a
Add log entry and telemetry info about time Kibana waits for ES during startup (#180765)
## Summary

This PR attempts to make it easier to quantity the time we're spending
waiting on ES during Kibana startup.

- Add a log entry once successfully connected to ES, surfacing the info
of how much time we waited.
- Add two new metric to our `kibana_started` event:
  - the time we spent waiting for ES
  - the time it took to perform the SO migration
 
Note that for "BWC" reasons (primarily - and simplicity's sake too)
we've not subtracting the time we spent from the `start` lifecycle
timing we already had.
2024-04-16 00:46:06 -07:00
Shahzad
29e8394c3d
[Synthetics] Monitor CRUD's public api's (#169928)
## Summary

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

View docs at [Changed
pages](https://kibana_169928.docs-preview.app.elstc.co/diff)

Add monitor api public api 

### Testing

Make sure you have some monitors populated before testing this PR and
before switching to the branch

- [ ] Try editing already added monitors via API
- [ ] Test adding monitors via API, and then edit those via and
subsqeuently try editing via API the same monitor
- [ ] Test editing monitors via API
- [ ] Test deleting monitors via API
- [ ] Test getting monitors via API
- [ ] Testing private as well public locations

Basic workflow that i am interesting in testing is to make sure, you can
add/edit via both API and UI without any issues


Test each of HTTP/TCP/ICMP browser examples

<img width="1728" alt="image"
src="3575d93a-5f04-4c80-ac62-038643f466f8">

---------

Co-authored-by: Justin Kambic <jk@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
2024-04-12 15:10:11 -04:00