Commit graph

77610 commits

Author SHA1 Message Date
Tim Sullivan
193458417e
[Reporting] [API/Functional tests] Remove/Reorganize tests that trigger failure (#190099)
## Summary

Functional tests and API integration tests that trigger failures are
problematic. These have the potential to run in a monitored environment.
Engineers that are on-call and watching for failures in HTTP responses
could see these as a false positive of an actual problem.

1. Remove Reporting API integration that generally tests for error
codes. These tests are suitably covered in jest integration tests.
2. Reorganize Screenshotting tests that test for error codes. WIP: find
out if these can be covered in jest integration tests and if so, remove
them
3. Reorganize tests of export types by creating `csv` and `screenshot`
directories. This change facilitates finer-grained code ownership.
2024-08-13 13:50:52 -07:00
Nick Partridge
2f9dca4b02
fix: kbn-config-schema tests for conditional config schemas (#190259) 2024-08-13 13:54:56 -05:00
elastic-renovate-prod[bot]
f3dc8a6d5d
Update actions/checkout action to v4.1.7 (main) (#190439)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [actions/checkout](https://togithub.com/actions/checkout) | action |
minor | `v4` -> `v4.1.7` |

---

### Release Notes

<details>
<summary>actions/checkout (actions/checkout)</summary>

###
[`v4.1.7`](https://togithub.com/actions/checkout/blob/HEAD/CHANGELOG.md#v417)

[Compare
Source](https://togithub.com/actions/checkout/compare/v4.1.6...v4.1.7)

- Bump the minor-npm-dependencies group across 1 directory with 4
updates by [@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/actions/checkout/pull/1739](https://togithub.com/actions/checkout/pull/1739)
- Bump actions/checkout from 3 to 4 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/actions/checkout/pull/1697](https://togithub.com/actions/checkout/pull/1697)
- Check out other refs/\* by commit by
[@&#8203;orhantoy](https://togithub.com/orhantoy) in
[https://github.com/actions/checkout/pull/1774](https://togithub.com/actions/checkout/pull/1774)
- Pin actions/checkout's own workflows to a known, good, stable version.
by [@&#8203;jww3](https://togithub.com/jww3) in
[https://github.com/actions/checkout/pull/1776](https://togithub.com/actions/checkout/pull/1776)

###
[`v4.1.6`](https://togithub.com/actions/checkout/blob/HEAD/CHANGELOG.md#v416)

[Compare
Source](https://togithub.com/actions/checkout/compare/v4.1.5...v4.1.6)

- Check platform to set archive extension appropriately by
[@&#8203;cory-miller](https://togithub.com/cory-miller) in
[https://github.com/actions/checkout/pull/1732](https://togithub.com/actions/checkout/pull/1732)

###
[`v4.1.5`](https://togithub.com/actions/checkout/blob/HEAD/CHANGELOG.md#v415)

[Compare
Source](https://togithub.com/actions/checkout/compare/v4.1.4...v4.1.5)

- Update NPM dependencies by
[@&#8203;cory-miller](https://togithub.com/cory-miller) in
[https://github.com/actions/checkout/pull/1703](https://togithub.com/actions/checkout/pull/1703)
- Bump github/codeql-action from 2 to 3 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/actions/checkout/pull/1694](https://togithub.com/actions/checkout/pull/1694)
- Bump actions/setup-node from 1 to 4 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/actions/checkout/pull/1696](https://togithub.com/actions/checkout/pull/1696)
- Bump actions/upload-artifact from 2 to 4 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/actions/checkout/pull/1695](https://togithub.com/actions/checkout/pull/1695)
- README: Suggest `user.email` to be
`41898282+github-actions[bot]@&#8203;users.noreply.github.com` by
[@&#8203;cory-miller](https://togithub.com/cory-miller) in
[https://github.com/actions/checkout/pull/1707](https://togithub.com/actions/checkout/pull/1707)

###
[`v4.1.4`](https://togithub.com/actions/checkout/blob/HEAD/CHANGELOG.md#v414)

[Compare
Source](https://togithub.com/actions/checkout/compare/v4.1.3...v4.1.4)

- Disable `extensions.worktreeConfig` when disabling `sparse-checkout`
by [@&#8203;jww3](https://togithub.com/jww3) in
[https://github.com/actions/checkout/pull/1692](https://togithub.com/actions/checkout/pull/1692)
- Add dependabot config by
[@&#8203;cory-miller](https://togithub.com/cory-miller) in
[https://github.com/actions/checkout/pull/1688](https://togithub.com/actions/checkout/pull/1688)
- Bump the minor-actions-dependencies group with 2 updates by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/actions/checkout/pull/1693](https://togithub.com/actions/checkout/pull/1693)
- Bump word-wrap from 1.2.3 to 1.2.5 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/actions/checkout/pull/1643](https://togithub.com/actions/checkout/pull/1643)

###
[`v4.1.3`](https://togithub.com/actions/checkout/blob/HEAD/CHANGELOG.md#v413)

[Compare
Source](https://togithub.com/actions/checkout/compare/v4.1.2...v4.1.3)

- Check git version before attempting to disable `sparse-checkout` by
[@&#8203;jww3](https://togithub.com/jww3) in
[https://github.com/actions/checkout/pull/1656](https://togithub.com/actions/checkout/pull/1656)
- Add SSH user parameter by
[@&#8203;cory-miller](https://togithub.com/cory-miller) in
[https://github.com/actions/checkout/pull/1685](https://togithub.com/actions/checkout/pull/1685)
- Update `actions/checkout` version in `update-main-version.yml` by
[@&#8203;jww3](https://togithub.com/jww3) in
[https://github.com/actions/checkout/pull/1650](https://togithub.com/actions/checkout/pull/1650)

###
[`v4.1.2`](https://togithub.com/actions/checkout/blob/HEAD/CHANGELOG.md#v412)

[Compare
Source](https://togithub.com/actions/checkout/compare/v4.1.1...v4.1.2)

- Fix: Disable sparse checkout whenever `sparse-checkout` option is not
present [@&#8203;dscho](https://togithub.com/dscho) in
[https://github.com/actions/checkout/pull/1598](https://togithub.com/actions/checkout/pull/1598)

###
[`v4.1.1`](https://togithub.com/actions/checkout/blob/HEAD/CHANGELOG.md#v411)

[Compare
Source](https://togithub.com/actions/checkout/compare/v4.1.0...v4.1.1)

- Correct link to GitHub Docs by
[@&#8203;peterbe](https://togithub.com/peterbe) in
[https://github.com/actions/checkout/pull/1511](https://togithub.com/actions/checkout/pull/1511)
- Link to release page from what's new section by
[@&#8203;cory-miller](https://togithub.com/cory-miller) in
[https://github.com/actions/checkout/pull/1514](https://togithub.com/actions/checkout/pull/1514)

###
[`v4.1.0`](https://togithub.com/actions/checkout/blob/HEAD/CHANGELOG.md#v410)

[Compare
Source](https://togithub.com/actions/checkout/compare/v4...v4.1.0)

- [Add support for partial checkout
filters](https://togithub.com/actions/checkout/pull/1396)

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjUuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQyNS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJUZWFtOk9wZXJhdGlvbnMiLCJiYWNrcG9ydDphbGwtb3BlbiIsInJlbGVhc2Vfbm90ZTpza2lwIl19-->

Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
2024-08-13 13:40:15 -05:00
Shahzad
f47f853eab
[Synthetics] Make overview grid embeddable (#160597)
## Summary

Overview grid can be embedded as part of dashboard !!

Can be added by selecting type `Select Type -> Synthetics -> `

<img width="1728" alt="image"
src="https://github.com/user-attachments/assets/b13f7e06-5f35-4415-9001-4a4340a6ce55">

<img width="1728" alt="image"
src="https://github.com/user-attachments/assets/d9fb7b2a-c339-4a9c-85c7-f273db601e9e">
2024-08-13 19:46:24 +02:00
Jonathan Budzenski
a9c4d2fa34 Revert "[OAS] Include alerting rule APIs (#189962)"
This reverts commit b85b1cb506.
2024-08-13 12:25:03 -05:00
Sébastien Loix
8dee365bda
[Stateful sidenav] Don't fetch active space on unauthenticated routes (#190408) 2024-08-13 17:00:08 +01:00
Jen Huang
826641505c
[UII] Support integration-level outputs (#189125)
## Summary

Resolves #143905. This PR adds support for integration-level outputs.
This means that different integrations within the same agent policy can
now be configured to send data to different locations. This feature is
gated behind `enterprise` level subscription.

For each input, the agent policy will configure sending data to the
following outputs in decreasing order of priority:
1. Output set specifically on the integration policy
2. Output set specifically on the integration's parent agent policy
(including the case where an integration policy belongs to multiple
agent policies)
3. Global default data output set via Fleet Settings

Integration-level outputs will respect the same rules as agent
policy-level outputs:
- Certain integrations are disallowed from using certain output types,
attempting to add them to each other via creation, updating, or
"defaulting", will fail
- `fleet-server`, `synthetics`, and `apm` can only use same-cluster
Elasticsearch output
- When an output is deleted, any integrations that were specifically
using it will "clear" their output configuration and revert back to
either `#2` or `#3` in the above list
- When an output is edited, all agent policies across all spaces that
use it will be bumped to a new revision, this includes:
- Agent policies that have that output specifically set in their
settings (existing behavior)
- Agent policies that contain integrations which specifically has that
output set (new behavior)
- When a proxy is edited, the same new revision bump above will apply
for any outputs using that proxy

The final agent policy YAML that is generated will have:
- `outputs` block that includes:
- Data and monitoring outputs set at the agent policy level (existing
behavior)
- Any additional outputs set at the integration level, if they differ
from the above
- `outputs_permissions` block that includes permissions for each
Elasticsearch output depending on which integrations and/or agent
monitoring are assigned to it

Integration policies table now includes `Output` column. If the output
is defaulting to agent policy-level output, or global setting output, a
tooltip is shown:

<img width="1392" alt="image"
src="https://github.com/user-attachments/assets/5534716b-49b5-402a-aa4a-4ba6533e0ca8">

Configuring an integration-level output is done under Advanced options
in the policy editor. Setting to the blank value will "clear" the output
configuration. The list of available outputs is filtered by what outputs
are available for that integration (see above):

<img width="799" alt="image"
src="https://github.com/user-attachments/assets/617af6f4-e8f8-40b1-b476-848f8ac96e76">

An example of failure: ES output cannot be changed to Kafka while there
is an integration
<img width="1289" alt="image"
src="https://github.com/user-attachments/assets/11847eb5-fd5d-4271-8464-983d7ab39218">


## TODO
- [x] Adjust side effects of editing/deleting output when policies use
it across different spaces
- [x] Add API integration tests
- [x] Update OpenAPI spec
- [x] Create doc issue

### 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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-08-13 08:49:57 -07:00
Andrew Macri
8ee04937fe
[Security Solution] [Attack discovery] Attack Discovery RBAC / Display an upgrade CTA for the serverless essentials product tier (#188788)
## [Security Solution] [Attack discovery] Attack Discovery RBAC / Display an upgrade CTA for the serverless essentials product tier

### Summary

This PR adds Role Based Access Control (RBAC) to Attack discovery.

Security users may enable or disable the new `Attack Discovery` RBAC feature shown in the figure below:

![rbac](https://github.com/user-attachments/assets/2ca3de6e-3e87-401f-8a06-0eb06d36d081)

_Above: The new `Attack discovery` RBAC feature_

It is possible to for example, configure a custom role that enables Attack discovery, but disables the assistant, as illustrated by the table below:

| Role                                      | License    | Navigation visible | Show upsell | Upsell has actions | View in assistant enabled |
|-------------------------------------------|------------|--------------------|-------------|--------------------|---------------------------|
| `has_attack_discovery_all_assistant_none`     | Basic      |                   |            |                   |                          |
| `has_attack_discovery_all_assistant_none` | Trial      |                   |            |                   |                          |
| `has_attack_discovery_all_assistant_none` | Platinum   |                   |            |                   |                          |
| `has_attack_discovery_all_assistant_none` | Enterprise |                   |            |                   |                          |

_Above: An example role that enables Attack discovery, but disables the assistant_

See the `Desk Testing` section of this PR for details.

This PR also fixes an issue where Attack discovery does not display an upgrade call to action (CTA) for the serverless _essentials_ product tier, per the before and after screenshots below:

#### Before

![serverless_essentials_before](https://github.com/user-attachments/assets/90e8f433-896d-40a3-b095-8f0cca0f7073)

_Above: Before the fix, an upgrade CTA is NOT displayed for the serverless essentials product tier_

#### After

![serverless_essentials_after](https://github.com/user-attachments/assets/4cdd146e-afac-4f3e-925b-4786e1908312)

_Above: After the fix, an upgrade CTA is displayed for the serverless essentials product tier_

The fix above is implemented by adopting the upselling framework.

### New Feature ID

This PR adds a new Feature ID for attack discovery:

```typescript
export const ATTACK_DISCOVERY_FEATURE_ID = 'securitySolutionAttackDiscovery' as const;
```

in `x-pack/packages/security-solution/features/src/constants.ts`

### Upselling framework usage

This PR updates the Attack discovery page to use the upselling framework via the following summarized steps:

1. Removed the branching logic from `x-pack/plugins/security_solution/public/attack_discovery/pages/upgrade/index.tsx`, and moved the component to an upselling `section` component in `x-pack/packages/security-solution/upselling/sections/attack_discovery/index.tsx`, where the component was renamed to `AttackDiscoveryUpsellingSection`.

This `section` component handles (just) the styling of the upselling message and actions (by itself, without the page wrapper), and receives the following props:

```typescript
interface Props {
  actions?: React.ReactNode;
  availabilityMessage: string;
  upgradeMessage: string;
}
```

The self managed and serverless-specific actions and `i18n` messages are passed down via the components described in the later steps below.

2. Removed all previous references to the `Upgrade` component (and references to `useProductTypes`) from the Attack discovery page in `x-pack/plugins/security_solution/public/attack_discovery/pages/index.tsx`, because the framework manages the upgrade case instead of the page itself.

3. Created an upselling `page` component `AttackDiscoveryUpsellingPage` in `x-pack/packages/security-solution/upselling/pages/attack_discovery/index.tsx`.

This component handles (just) the styling of the _page_ that wraps the Attack discovery `section`. It passes the same props to the previously described `AttackDiscoveryUpsellingSection` component.

4. Created a self-managed-specific `AttackDiscoveryUpsellingPageESS` component in `x-pack/plugins/security_solution_ess/public/upselling/pages/attack_discovery/index.tsx`

This component passes self-managed-specific upgrade action buttons / links and `i18n` strings to the previously described `AttackDiscoveryUpsellingPage`

5. Also for self managed, added a new `AttackDiscoveryUpsellingPageLazy` component to the existing file: `x-pack/plugins/security_solution_ess/public/upselling/lazy_upselling.tsx`

This component lazy loads the previously described `AttackDiscoveryUpsellingPageESS` component.

6. Added registration for the previously described `AttackDiscoveryUpsellingPageLazy` component to the existing `UpsellingPages` section in `x-pack/plugins/security_solution_ess/public/upselling/register_upsellings.tsx` with a `minimumLicenseRequired` of `enterprise`:

```
minimumLicenseRequired: 'enterprise',
```

7. Created a serverless-specific `AttackDiscoveryUpsellingPageServerless` component in `x-pack/plugins/security_solution_serverless/public/upselling/pages/attack_discovery/index.tsx`

This component passes serverless-specific `i18n` messages to the platform agnostic `AttackDiscoveryUpsellingPage` component.

8. Also for serverless, added a new `AttackDiscoveryUpsellingPageLazy` component to the existing file: `x-pack/plugins/security_solution_serverless/public/upselling/lazy_upselling.tsx`

9. Added registration for the previously described `AttackDiscoveryUpsellingPageLazy` component to the existing `upsellingPages` section in `x-pack/plugins/security_solution_serverless/public/upselling/upsellings.tsx` with the `assistant` PLI:

```
pli: ProductFeatureKey.assistant,
```

10. Added the `${ASSISTANT_FEATURE_ID}.ai-assistant` capability as an OR condition (via nested array, per the [framework](https://github.com/elastic/kibana/blob/main/x-pack/plugins/security_solution/public/common/lib/capabilities/has_capabilities.ts#L11-L22)) to the Attack discovery link in `x-pack/plugins/security_solution/public/attack_discovery/links.ts`. This addition enables the security route wrapper to check for upselling pages in serverless:

```
capabilities: [[`${SERVER_APP_ID}.show`, `${ASSISTANT_FEATURE_ID}.ai-assistant`]],
```

11. Added `licenseType: 'enterprise'` to the Attack discovery link in `x-pack/plugins/security_solution/public/attack_discovery/links.ts` to require an `enterprise` license for self managed

### Upgrade CTA gallery

The screenshots in this section document the CTA (or Welcome message when the feature is licensed) displayed for various license levels after the fix:

#### Users with the `None` privilege

If users with the `None` privilege manually enter an Attack discovery URL, e.g. `http://localhost:5601/app/security/attack_discovery`, the framework will display the following error prompt:

![privelages_required](https://github.com/user-attachments/assets/d282609e-5400-4ba9-8130-de5e10f8973d)

#### Self managed BASIC

![self_managed_basic_after](https://github.com/user-attachments/assets/048b2a3b-9e2d-4b95-a697-c739ea2dc5bb)

#### Self managed PLATINUM

![self_managed_platinum_after](https://github.com/user-attachments/assets/d7c49551-a8cf-4afb-b3bf-c3243e892219)

#### Self managed TRIAL

![self_managed_trial_after](https://github.com/user-attachments/assets/d5cc03a9-97aa-4c78-a5f5-92e5af3a85ac)

#### Self managed ENTERPRISE

![self_managed_enterprise_after](https://github.com/user-attachments/assets/a849b534-7e07-4481-9641-c48dee126466)

#### Serverless ESSENTIALS

![serverless_essentials_after](https://github.com/user-attachments/assets/4cdd146e-afac-4f3e-925b-4786e1908312)

#### Serverless COMPLETE

![serverless_complete_after](https://github.com/user-attachments/assets/8cab60c3-dea6-4d7a-b86a-b2cd11c9b4dd)

## Desk Testing

### Severless: Desk testing (just) the upgrade CTA

Reproduction steps:

1) Comment-out any preconfigured connectors in `config/kibana.dev.yml`

2) Edit the configuration of `config/serverless.security.yml` to enable the `essentials` product tier:

```yaml
xpack.securitySolutionServerless.productTypes:
  [
    { product_line: 'security', product_tier: 'essentials' }
  ]
```

3) Start Elasticsearch

```sh
yarn es serverless --projectType security
```

4) Start a development instance of Kibana

```
yarn start --serverless=security --no-base-path
```

5) Navigate to Security > Attack discovery

**Expected result**

- An upgrade CTA is displayed, as illustrated by the _after_ screenshot below:

![serverless_essentials_after](https://github.com/user-attachments/assets/4cdd146e-afac-4f3e-925b-4786e1908312)

- The video tour is NOT displayed for serverless, as noted in the [original PR](https://github.com/elastic/kibana/pull/182605#issuecomment-2100607857)

**Actual result**

- An upgrade CTA is NOT displayed, as illustrated by the _before_ screenshot below:

![serverless_essentials_before](https://github.com/user-attachments/assets/90e8f433-896d-40a3-b095-8f0cca0f7073)

### Desk testing Self Managed

To desk test self manged, we will:

1) Create (three) roles for testing
2) Create (three) users assigned to the roles
3) Test each role at `Basic`, `Trial`, `Platinum`, and `Enterprise` levels to verify:

- `Attack discovery` link visibility in the Security solution navigation
- Visibility of the upsell empty prompt for license levels where Attack discovery is unavailable
- The upsell empty prompt includes the `Subscription plans` and `Manage license` actions
- When Attack discoveries are generated, the `View in Ai Assistant` button and popover menu action are enabled / disabled, based on availability of the `AI Assistant` feature

#### Creating (three) roles for testing

In this section, we will start a new (development) self managed deployment, and create the following three roles via Kibana Dev Tools:

- `has_attack_discovery_all_assistant_all`
- `has_attack_discovery_all_assistant_none`
- `has_attack_discovery_none_assistant_all`

To start the deployment and create the roles:

1) Add a pre-configured GenAI connector to `config/kibana.dev.yml`

2) Start a new (development) instance of Elasticsearch:

```sh
yarn es snapshot -E path.data=/Users/$USERNAME/data-2024-07-31a
```

3) Start a local (development) instance of Kibana:

```
yarn start --no-base-path
````

4) Login to Kibana as the `elastic` user

5) Generate some alerts

6) Navigate to Dev Tools

7) Execute the following three API calls to create the roles:

<details><summary>PUT /_security/role/has_attack_discovery_all_assistant_all</summary>
<p>

``` ts
PUT /_security/role/has_attack_discovery_all_assistant_all
{
  "cluster": [
    "all"
  ],
  "indices": [
    {
      "names": [
        "*"
      ],
      "privileges": [
        "all"
      ],
      "field_security": {
        "grant": [
          "*"
        ],
        "except": []
      },
      "allow_restricted_indices": false
    }
  ],
  "applications": [
    {
      "application": "kibana-.kibana",
      "privileges": [
        "feature_securitySolutionAssistant.minimal_all",
        "feature_securitySolutionAttackDiscovery.minimal_all",
        "feature_siem.all",
        "feature_securitySolutionCases.all",
        "feature_actions.all"
      ],
      "resources": [
        "*"
      ]
    }
  ],
  "run_as": [],
  "metadata": {},
  "transient_metadata": {
    "enabled": true
  }
}
```

</p>
</details>

<details><summary>PUT /_security/role/has_attack_discovery_all_assistant_none</summary>
<p>

``` ts
PUT /_security/role/has_attack_discovery_all_assistant_none
{
  "cluster": [
    "all"
  ],
  "indices": [
    {
      "names": [
        "*"
      ],
      "privileges": [
        "all"
      ],
      "field_security": {
        "grant": [
          "*"
        ],
        "except": []
      },
      "allow_restricted_indices": false
    }
  ],
  "applications": [
    {
      "application": "kibana-.kibana",
      "privileges": [
        "feature_securitySolutionAttackDiscovery.minimal_all",
        "feature_siem.all",
        "feature_securitySolutionCases.all",
        "feature_actions.all"
      ],
      "resources": [
        "*"
      ]
    }
  ],
  "run_as": [],
  "metadata": {},
  "transient_metadata": {
    "enabled": true
  }
}
```

</p>
</details>

<details><summary>PUT /_security/role/has_attack_discovery_none_assistant_all</summary>
<p>

``` ts
PUT /_security/role/has_attack_discovery_none_assistant_all
{
  "cluster": [
    "all"
  ],
  "indices": [
    {
      "names": [
        "*"
      ],
      "privileges": [
        "all"
      ],
      "field_security": {
        "grant": [
          "*"
        ],
        "except": []
      },
      "allow_restricted_indices": false
    }
  ],
  "applications": [
    {
      "application": "kibana-.kibana",
      "privileges": [
        "feature_securitySolutionAssistant.minimal_all",
        "feature_siem.all",
        "feature_securitySolutionCases.all",
        "feature_actions.all"
      ],
      "resources": [
        "*"
      ]
    }
  ],
  "run_as": [],
  "metadata": {},
  "transient_metadata": {
    "enabled": true
  }
}
```

</p>
</details>

#### Creating (three) users assigned to the roles

In this section, we will create the following three users via Kibana Dev Tools using the API calls below (expand for details):

- `attack_discovery_all_assistant_all`
- `attack_discovery_all_assistant_none`
- `attack_discovery_none_assistant_all`

1) Navigate to Dev Tools

2) Execute the following three API calls to create the users:

<details><summary>POST /_security/user/attack_discovery_all_assistant_all</summary>
<p>

``` ts
POST /_security/user/attack_discovery_all_assistant_all
{
    "username": "attack_discovery_all_assistant_all",
    "password": "changeme",
    "roles": [
      "has_attack_discovery_all_assistant_all"
    ],
    "full_name": "Attack Discovery All Assistant All",
    "email": "user@example.com",
    "metadata": {},
    "enabled": true
}
```

</p>
</details>

<details><summary>POST /_security/user/attack_discovery_all_assistant_none</summary>
<p>

``` ts
POST /_security/user/attack_discovery_all_assistant_none
{
    "username": "attack_discovery_all_assistant_none",
    "password": "changeme",
    "roles": [
      "has_attack_discovery_all_assistant_none"
    ],
    "full_name": "Attack Discovery All Assistant None",
    "email": "user@example.com",
    "metadata": {},
    "enabled": true
}
```

</p>
</details>

<details><summary>POST /_security/user/attack_discovery_none_assistant_all</summary>
<p>

``` ts
POST /_security/user/attack_discovery_none_assistant_all
{
    "username": "attack_discovery_none_assistant_all",
    "password": "changeme",
    "roles": [
      "has_attack_discovery_none_assistant_all"
    ],
    "full_name": "Attack Discovery None Assistant All",
    "email": "user@example.com",
    "metadata": {},
    "enabled": true
}
```

</p>
</details>

#### Testing each role at `Basic`, `Trial`, `Platinum`, and `Enterprise` levels

In this section, we will test each of the self managed `Basic`, `Trial`, `Platinum`, and `Enterprise` license levels with the three roles we created for testing.

##### Testing the `has_attack_discovery_all_assistant_all` role

1) Login as the `attack_discovery_all_assistant_all` user

2) Navigate to the Security solution

3) For each of the `Basic`, `Trial`, `Platinum`, and `Enterprise` levels, verify your observations match the expected behavior in the table below:

| Role                                     | License    | Navigation visible | Show upsell | Upsell has actions | View in assistant enabled |
|------------------------------------------|------------|--------------------|-------------|--------------------|---------------------------|
| `has_attack_discovery_all_assistant_all` | Basic      |                   |            |                   |                          |
| `has_attack_discovery_all_assistant_all` | Trial      |                   |            |                   |                          |
| `has_attack_discovery_all_assistant_all` | Platinum   |                   |            |                   |                          |
| `has_attack_discovery_all_assistant_all` | Enterprise |                   |            |                   |                          |

##### Testing the `has_attack_discovery_all_assistant_none` role

1) Login as the `attack_discovery_all_assistant_none` user

2) Navigate to the Security solution

3) For each of the `Basic`, `Trial`, `Platinum`, and `Enterprise` levels, verify your observations match the expected behavior in the table below:

| Role                                      | License    | Navigation visible | Show upsell | Upsell has actions | View in assistant enabled |
|-------------------------------------------|------------|--------------------|-------------|--------------------|---------------------------|
| `has_attack_discovery_all_assistant_none`     | Basic      |                   |            |                   |                          |
| `has_attack_discovery_all_assistant_none` | Trial      |                   |            |                   |                          |
| `has_attack_discovery_all_assistant_none` | Platinum   |                   |            |                   |                          |
| `has_attack_discovery_all_assistant_none` | Enterprise |                   |            |                   |                          |

##### Testing the `has_attack_discovery_none_assistant_all` role

1) Login as the `attack_discovery_none_assistant_all` user

2) Navigate to the Security solution

3) For each of the `Basic`, `Trial`, `Platinum`, and `Enterprise` levels, verify your observations match the expected behavior in the table below:

| Role                                      | License    | Navigation visible | Show upsell | Upsell has actions | View in assistant enabled |
|-------------------------------------------|------------|--------------------|-------------|--------------------|---------------------------|
| `has_attack_discovery_none_assistant_all` | Basic      |                   |            |                   |                          |
| `has_attack_discovery_none_assistant_all` | Trial      |                   |            |                   |                          |
| `has_attack_discovery_none_assistant_all` | Platinum   |                   |            |                   |                          |
| `has_attack_discovery_none_assistant_all` | Enterprise |                   |            |                   |                          |

---------------------------------------------

### Serverless Testing

To desk test serverless, we will test the `essentials` and `complete` product tiers to verify:

- `Attack discovery` link visibility in the Security project navigation
- Visibility of the upsell empty prompt for license levels where Attack discovery is unavailable
- The upsell empty prompt does NOT include the `Subscription plans` and `Manage license` actions
- When Attack discoveries are generated, the `View in Ai Assistant` button and popover menu action are enabled

#### Essentials tier testing

1) Add a pre-configured GenAI connector to `config/kibana.dev.yml`

2) Edit the configuration of `config/serverless.security.yml` to enable the `essentials` product tier:

```yaml
xpack.securitySolutionServerless.productTypes:
  [
    { product_line: 'security', product_tier: 'essentials' },
    { product_line: 'endpoint', product_tier: 'essentials' },
  ]
```

2) Start a new (development) instance of Elasticsearch:

```sh
yarn es serverless --clean --projectType security
```

3) Start a local (development) instance of Kibana:

```
yarn start --serverless=security --no-base-path
````

4) select the `admin` role

5) Generate some alerts

6) Verify your observations match the expected behavior in the table below:

| Role                          | Tier       | Navigation visible | Show upsell | Upsell has actions | View in assistant enabled |
|-------------------------------|------------|--------------------|-------------|--------------------|---------------------------|
| `viewer`                      | essentials |                   |            |                   |                          |
| `editor`                      | essentials |                   |            |                   |                          |
| `t1_analyst`                  | essentials |                   |            |                   |                          |
| `t2_analyst`                  | essentials |                   |            |                   |                          |
| `t3_analyst`                  | essentials |                   |            |                   |                          |
| `threat_intelligence_analyst` | essentials |                   |            |                   |                          |
| `rule_author`                 | essentials |                   |            |                   |                          |
| `soc_manager`                 | essentials |                   |            |                   |                          |
| `detections_admin`            | essentials |                   |            |                   |                          |
| `platform_engineer`           | essentials |                   |            |                   |                          |
| `endpoint_operations_analyst` | essentials |                   |            |                   |                          |
| `endpoint_policy_manager`     | essentials |                   |            |                   |                          |
| `admin`                       | essentials |                   |            |                   |                          |
| `system_indices_superuser`    | essentials |                   |            |                   |                          |

### Complete tier testing

1) Stop the running Kibana server (from the previous Essentials tier testing)

2) Edit the configuration of `config/serverless.security.yml` to enable the `complete` product tier:

```yaml
xpack.securitySolutionServerless.productTypes:
  [
    { product_line: 'security', product_tier: 'complete' },
    { product_line: 'endpoint', product_tier: 'complete' },
  ]
```

3) Restart a local (development) instance of Kibana:

```
yarn start --serverless=security --no-base-path
````

4) Verify your observations match the expected behavior in the table below:

| Role                          | Tier     | Navigation visible | Show upsell | Upsell has actions | View in assistant enabled |
|-------------------------------|----------|--------------------|-------------|--------------------|---------------------------|
| `viewer`                      | complete |                   |            |                   |                          |
| `editor`                      | complete |                   |            |                   |                          |
| `t1_analyst`                  | complete |                   |            |                   |                          |
| `t2_analyst`                  | complete |                   |            |                   |                          |
| `t3_analyst`                  | complete |                   |            |                   |                          |
| `threat_intelligence_analyst` | complete |                   |            |                   |                          |
| `rule_author`                 | complete |                   |            |                   |                          |
| `soc_manager`                 | complete |                   |            |                   |                          |
| `detections_admin`            | complete |                   |            |                   |                          |
| `platform_engineer`           | complete |                   |            |                   |                          |
| `endpoint_operations_analyst` | complete |                   |            |                   |                          |
| `endpoint_policy_manager`     | complete |                   |            |                   |                          |
| `admin`                       | complete |                   |            |                   |                          |
| `system_indices_superuser`    | complete |                   |            |                   |                          |
2024-08-13 11:46:20 -04:00
Nathan Reese
571fe047c1
react control group: implement reload (#190366)
PR adds reload implementation for react control group.
2024-08-13 09:38:24 -06: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
Shahzad
386d290ea4
[Synthetics] Unskip get too many monitors test !! (#190404)
## Summary

Fixes https://github.com/elastic/kibana/issues/169753 !!

Flaky test runner
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6753
2024-08-13 10:29:48 -05:00
Jean-Louis Leysens
b85b1cb506
[OAS] Include alerting rule APIs (#189962)
## Summary

Includes alerting rule APIs in our OAS snapshots.

## How to test

Using bump CLI you can preview the output:

```sh
bump preview ./oas_docs/bundle.json
# or
bump preview ./oas_docs/bundle.serverless.json
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-08-13 17:21:10 +02:00
Nicolas Chaulet
7fb1577c1d
[Fleet] Fix duplicates in agent version list (#190411) 2024-08-13 10:13:23 -05:00
Melissa Alvarez
8be5ad8fc9
[ML][Fleet] Link to ML assets from Integration > Assets tab (#189767)
## Summary

Related issue: https://github.com/elastic/kibana/issues/182199

This PR adds links for ML assets installed via Integrations. 

For `transform` and `ml_model` (as they are ES asset types) the manual
mappings in
[get_bulk_assets.ts](ac6f643904/x-pack/plugins/fleet/server/services/epm/packages/get_bulk_assets.ts (L21))
has been modified to include a link to the Transform management page and
the Trained models page, respectively. The pages will be filtered to the
asset id.

This PR also adds the ability to save state in the url for the Transform
list to allow the url to link to a filtered list of transforms.

### To test:

- From the side navigation - click the `Add integrations` button at the
bottom to get to the Integrations page.
<img width="318" alt="image"
src="https://github.com/user-attachments/assets/d4632221-7f83-4678-ac0f-cb1e20853a6d">

- To test ml models link, install the `Living off the Land Attack
Detection` integration
- To test transform link, install the `Lateral Movement Detection`
integration

- Once they are installed you can navigate to the `Installed
Integrations` tab on the Integrations page
<img width="660" alt="image"
src="https://github.com/user-attachments/assets/8dc1db76-4b93-4057-b502-a90980a2a484">

- Select the installed package you want to view and then go to the
`Assets` tab
<img width="1256" alt="image"
src="https://github.com/user-attachments/assets/c3382f9d-b1ed-4043-ac3f-73180effefe8">

- You can then expand the desired asset section (Ml models or
transforms) and click the link to ensure it takes you to the correct
place


### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-08-13 08:55:55 -06:00
Jon
0719f5c110
[renovate] Test github action package match (#190427)
Another attempt at fixing github action pinning. This scopes us to the
actions/checkout package only for now, and we can expand it later.

Previously: https://github.com/elastic/kibana/pull/190377, which was
successful for the auto-approve-backport acttion.
2024-08-13 09:48:13 -05:00
Mark Hopkin
919844da4f
[Entity Analytics] Tidy Asset Criticality API docs (#190037)
**Addresses:** https://github.com/elastic/kibana/issues/190038

## Summary

Tidy the asset criticality API docs after reviewing the doc previews for
[Serverless](https://bump.sh/per-solution-example/doc/security-solution-api-playground)
and
[ESS](https://bump.sh/per-solution-example/doc/security-solution-api-playground-ess)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-08-13 15:30:46 +01:00
Robert Oskamp
bd5927fab4
Stabilize Discover sidebar tests (#190405)
## Summary

This PR tries to stabilize the Discover sidebar tests which started to
be flaky when running against MKI.

### Details

The serverless Discover sidebar tests (`Common Group
5.x-pack/test_serverless/functional/test_suites/common/discover/group6/_sidebar·ts`)
started to become flaky when running against MKI. 5 out of the last 10
runs failed for the same reason:
```
discover/group6 discover sidebar renders field groups should render even when retrieving documents failed with an error

Error: expected '48 available fields. 6 empty fields. 4 meta fields.' to equal '49 available fields. 5 empty fields. 4 meta fields.'
    at Assertion.assert (expect.js💯11)
    at Assertion.apply (expect.js:227:8)
    at Assertion.be (expect.js:69:22)
    at Context. (_sidebar.ts:644:83)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Object.apply (wrap_function.js:73:16)
```

So it seems the newly added field is sometimes listed as `empty` instead
of `available`.

Failure screenshot:

![image](https://github.com/user-attachments/assets/e3615604-90ad-445c-9026-fd7c7865991e)

The screenshot shows an active global loading indicator, so that might
be the reason for the flakiness (loading not quite done sometimes, so
field listed as `empty`).

This PR tries to fix this flakiness by adding a wait for the global
loading right before fetching the sidebar details.
2024-08-13 16:16:07 +02:00
Charis Kalpakis
1dd0c8d353
Additional validation for painless test (#190226) 2024-08-13 17:13:42 +03:00
Stratoula Kalafateli
105ffd8a76
[ES|QL] Removes the unnecessary index pattern references from the Lens charts (#190296)
## Summary

ES|QL charts do not use permanent dataviews. They are just using adHoc
dataviews for technical reasons and only (as the entire Lens
architecture is based on them). By calculating (and exporting to the
state) the references is creating some bad UX behavior as the dashboards
expect the dataviews to exist.

This PR is fixing this by removing the unnecessary references from the
Lens charts.
2024-08-13 16:08:19 +02:00
Ryan Keairns
b5f6d7754d
Remove border from primary buttons in the toolbar (#190017)
## Summary

2nd attempt at removing the border on the blue, primary button in the
shared toolbar.
Previously, I didn't account for the 'text' colored buttons in the Lens
toolbar. This time around, I narrowed the issue down to the custom
styles being passed down via `cssProps` and simply ignore them for
primary/fill buttons.

**Before**
<img
src="https://github.com/user-attachments/assets/95c7539e-2446-4a6e-a776-f5f799a5821c"
width="420" />


**After**
_Dashboard_
No gray border on the Create visualization button
<img
src="https://github.com/user-attachments/assets/3f7b4c87-d2b1-4bcf-a7e3-611961a06f46"
width="420" />

_Lens_
Borders for axis settings remain

<img
src="https://github.com/user-attachments/assets/465cdf50-1ca5-49fa-9ae5-f84d8ee82191"
width="420" />



### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

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

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

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

| Risk | Probability | Severity | Mitigation/Notes |

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


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-08-13 06:57:46 -07:00
Marius Dragomir
0f56e50093
[QA] Change CCS stack functional integration test to account for Monaco Dev Console. (#190382)
## Summary
The default editor for the Kibana Dev Console has been changed from the
Ace editor to the Monaco editor. This PR updates the ccs n-1 test to
account for this.

PS: The screen size change is done to account the size of the response
headers in case of requests done to CCS configured indices.
Backport is only needed for 8.15 branch.
2024-08-13 15:44:23 +02:00
Anton Dosov
b8fc60b30e
Allow to "star" (favorite) a dashboard from the listing table (#189285)
## Summary

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

- Allows to "star" (favorite) a dashboard from the listing table 

![Screenshot 2024-07-26 at 15 17
41](https://github.com/user-attachments/assets/18f8e3d6-3c83-4d62-8a70-811b05ecd99b)
![Screenshot 2024-07-26 at 15 17
45](https://github.com/user-attachments/assets/45462395-1db1-4858-a2d8-3f681bb2072b)

- Favorites are isolated per user (user profile id) and per space




### Implementation Details

Please refer to and comment on the README.md 🙏
https://github.com/elastic/kibana/pull/189285/files#diff-307fab4354532049891c828da893b4efcf0df9391b1f3018d8d016a2288c5d4c


### TODO


- Telemetry: I will add telemetry in a separate PR
2024-08-13 08:10:18 -05:00
Jamie Tanna
bec63eca4c
chore(renovate): add Regex Manager to enabledManagers (#190385)
## Summary

As it's required for us to extract Chainguard images, as well as some
other cases like Buildkite.

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

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

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

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

| Risk | Probability | Severity | Mitigation/Notes |

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


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-08-13 07:05:50 -05:00
Maxim Palenov
7a2e7bef96
[HTTP/OAS] Merge OpenAPI specs by using kbn-openapi-bundler (#189262)
**Addresses:** https://github.com/elastic/kibana/issues/186356
**Relates to:** https://github.com/elastic/kibana/issues/184428

## Summary

This PR adds a merging JS script based on the utility implemented in https://github.com/elastic/kibana/issues/186356. Resulted OpenAPI bundle as committed in `oas_docs/output/kibana.serverless.bundled.yaml`.

## Details

https://github.com/elastic/kibana/pull/188110 implements and exposes `merge` utility design to merge source OpenAPI specs without processing. It's has only a programmatic API. To merge OpenAPI specs it's required to add a JS script like below

```js
const { merge } = require('@kbn/openapi-bundler');

(async () => {
  await merge({
   sourceGlobs: [/* a list of source globs goes here */],
   outputFilePath: 'path/to/the/output/file.yaml',
  });
})();
```

The JS script added in this PR includes source OpenAPI specs presented in `oas_docs/makefile` plus Security Solution OpenAPI specs based on https://github.com/elastic/kibana/issues/184428.

**To run** the script use the following command from Kibana root folder

```bash
node ./oas_docs/scripts/merge_serverless_oas.js 
```

## Known linting issues with Security Solution OpenAPI specs

Running Spectral OpenAPI linter on the result bundle shows a number of errors caused by `no-$ref-siblings` rule. This caused by the current code generator implementation which requires `default` property to be set next to `$ref` though it's not correct for OpenAPI `3.0.3` while it's allowed in `3.1`. It seems that Bump.sh handles such cases properly though by properly showing a default value.

We need to analyze the problem and decide if/when we should fix it.

The rest of warnings look fixable and will be addressed in the next stage after setting up linter rules.

## Next steps

Since `@kbn/openapi-bundler` package is tailored specifically for Kibana it should replace Redocly currently used to merge OpenAPI specs. It also means `oas_docs/makefile` should be superseded by JS script(s) using `merge` utility form `@kbn/openapi-bundler` package.

`@kbn/openapi-bundler` SHOULD NOT replace OpenAPI linters since it doesn't perform thorough linting. It's good if we continue adopting `spectral-cli` for linting purposes.
2024-08-13 12:45:35 +02:00
mohamedhamed-ahmed
2de0dd6a6c
[Synthtrace] Support LogsDb Mode (#190286)
closes [#3757
](https://github.com/elastic/observability-dev/issues/3757)


## 📝  Summary

This PR adds support of `LogsDb` to all current Logs scenarios.

To be able to use the newly added flag from CLI:

`node scripts/synthtrace degraded_logs.ts --scenarioOpts.logsdb=true`

This creates a new `Logsdb` Index template that mimics the default
`Logs` one but sets the `mode=logsdb` and matches on index pattern
`logs-logsdb.*-*`.

## 🎥 Demo


https://github.com/user-attachments/assets/378be9ac-215a-40ca-b57c-3bb9751292b2
2024-08-13 05:40:09 -05:00
Khristinin Nikita
6589cd3cf1
Revert override alert timestamp (#189724)
## Revert override alert timestamp

Previously we added override of alert timestamp for manual rule runs.
Later was decided, that timestamp for manual rule run should behave the
same as regular alert and represent time when alert generated.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-08-13 12:36:54 +02:00
Vitalii Dmyterko
94cec41250
[Security solution][Detection engine] fix flaky useAllEsqlRuleFields jest tests (#190306)
## Summary

- addresses https://github.com/elastic/kibana/issues/190063
2024-08-13 11:27:48 +01:00
Mykola Harmash
760acd13a3
[Observability Onboarding] 'Add data' button in SLO header (#190388)
Closes https://github.com/elastic/kibana/issues/190389

Replaces "Add integrations" with "Add data" that point to the onboarding
page.

![CleanShot 2024-08-13 at 10 31
32@2x](https://github.com/user-attachments/assets/f78f35c8-f3eb-4cb6-b5b0-b3f475c202f4)
2024-08-13 05:02:55 -05:00
Kevin Lacabane
5290b35e5b
[eem] allow definition to be only installed and not started (#190339)
When creating a definition we automatically start the transforms when
all the components are installed. This change introduces `installOnly:
boolean` query string that can be passed to routes that create
definitions (`POST /internal/entities/definition` and `PUT
/internal/entities/managed/enablement`) in order to only install the
components

### Testing
- `PUT kbn:/internal/entities/managed/enablement?installOnly=true`
- `GET kbn:/internal/entities/definition` returns builtin definitions
with `{ state: { installed: true, running: false } }`
- check the installed transforms are not started
2024-08-13 11:37:22 +02:00
jennypavlova
fe592d4f3b
[Infra] Legacy metrics changes (#189974)
Closes #189628 
Closes #190118

## Summary

This PR changes the way we show the legacy metrics. It changes the hosts
table `rx` and `tx` values to use the `v2` and renames
`availablefieldsOptions` to `availableFieldsOptions`

It covers `1.` and `2.` from this
[comment](https://github.com/elastic/kibana/pull/189261#pullrequestreview-2223770001)

## Testing: 

Legacy metrics changes in inventory


https://github.com/user-attachments/assets/d2a74b0f-8a63-49f2-8d4b-e9c738440609

The legacy metrics are currently visible only for hosts so in other
asset types they should not be visible (Inventory + Alerts)

<img width="1624" alt="Screenshot 2024-08-06 at 14 34 49"
src="https://github.com/user-attachments/assets/b24df6b1-5a0d-4a01-ac88-412a419c5d6c">

Alert rules creation and metrics drop-down (with/without legacy metric)


https://github.com/user-attachments/assets/a403c96a-764d-4451-b370-e05a9ae1c5b4

On the Alerts page when creating a rule the default metric is CPU Usage
(not the legacy one):


![image](https://github.com/user-attachments/assets/08ed4a7a-6f6c-4aa2-8f10-5b76d6e84ea6)

Align CPU usage (Legacy) label and position with RX / TX metrics: 

<img width="1415" alt="image"
src="https://github.com/user-attachments/assets/2ce9269e-6f88-47ca-b76c-105f1daab152">
2024-08-13 10:34:40 +02:00
Joe McElroy
c53cb3c06e
[Search] [Playground] Fix Stream Buffer issue (#190363)
## Summary

This occurs when the context is very large and has difficulty flushing
to the stream. When writing a large blob to stream, the stream may not
be ready to process any further chunks. When it isn't ready, the stream
will return false. The fix is we honour this scenario, creating a back
pressure buffer to keep it in memory and checking on each new chunk
whether the write is ready.

### 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
- [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
- [ ] 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) |
2024-08-13 09:33:52 +01:00
Irene Blanco
aaf35ce945
[APM][Settings][Custom links] Default field filter option always present (#190309)
## Summary

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

It was discovered that when users manually select the default option
(`Select field`) for the field input, the option would disappear in some
scenarios, causing other input values to change automatically. This
issue occurred specifically when the default option was selected
manually by the user.

This happens because as options are selected by the user, they are
removed from the selection list to prevent duplicates.

With the fix
([commit](985cdc5317))
we are never removing the default option from the list.

|Scenario|Before|After|
|-|-|-|
|Two filters|<img
src="https://github.com/user-attachments/assets/2268b92f-e9be-4c06-aa74-5f2f003117d5"
width="280"> |<img
src="https://github.com/user-attachments/assets/278a4860-f691-4121-acb5-f61a76147b56"
width="280">|
|More than two filters|<img
src="https://github.com/user-attachments/assets/23aeb355-4932-452d-a6a8-ed1a2ccba428"
width="280">|<img
src="https://github.com/user-attachments/assets/30d7978e-1ec0-4736-8163-64790831bba0"
width="280">|
2024-08-13 09:19:50 +02:00
Kibana Machine
8b2e05b09e
[ES|QL] Update function metadata (#190290)
This PR updates the function definitions and inline docs based on the
latest metadata from Elasticsearch.

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2024-08-13 07:47:18 +02:00
Kibana Machine
5426c21ed6
[api-docs] 2024-08-13 Daily api_docs build (#190383)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/798
2024-08-13 04:53:22 +00:00
Jon
2373da5fbc
[renovate] Attempt at fixing action format (#190377)
Attempt at fixing `Could not determine new digest for update`. I don't
have a lot to go on otherwise, this is the only difference I can see
from the docs.

https://docs.renovatebot.com/modules/manager/github-actions/
2024-08-12 17:32:38 -05:00
Jon
8e99dafa8d
[optimizer] Mute SASS mixed-decls warnings (#190348)
These are impacting DX. Remediation will be tracked at
https://github.com/elastic/kibana/issues/190345.

## Testing

`node scripts/build_kibana_platform_plugins` and `yarn start` should not
log warnings about the `mixed-decls` sass rule
2024-08-12 17:15:13 -05:00
Jon
6ca1df0115
[sonar scan] Scan public directories (#190350)
legrego helpfully pointed out that these files should be scanned - they
include client side code. The replaces the exclusion of `public` with
`target`, the compiled version of this source.
2024-08-12 17:14:48 -05:00
Jon
aae7a3b058
[build] Update chainguard-base (#190351)
Manual update, still working out some issues with renovate
2024-08-12 17:14:13 -05:00
Jon
97fd4e4a42
[ci] Validate renovate config (#190234)
Adds `renovate.json` config validation to `Quick Checks`
2024-08-12 17:13:07 -05:00
Steph Milovic
b037ea7720
[Security solution] Title prompt improvements (#190087) 2024-08-12 15:54:54 -06:00
Maxim Palenov
7f8b565d2f
[Security Solution] Use more specific bulk action operationIds (#190040)
**Addresses:** https://github.com/elastic/kibana/issues/190035

## Summary

This PR fixes `operationId` conflicts in Security Solution OpenAPI specs.

## Details

API reference documentation platform (Bump.sh) expects unique `operationId`s to build proper navigation on the documentation page. It's expected each `operationId` throughout whole Kibana since Kibana API reference documentation will contain all available API endpoints.
2024-08-12 23:50:22 +02:00
Lola
a23f63db0e
[Cloud Security] add agentless ux creation flow (#189932)
## Summary
This PR add UX updates to agentless creation flow which include the
following:
 * Disabling Agent-based popups when newly created policy is Agentless
 * Adding Cloud Credentials Instructions 
* Minor UX adjustments such as adding Readme doc link on AWS credentials
form and spacing between Azure Credentials form.
 
<img width="985" alt="image"
src="https://github.com/user-attachments/assets/47b8dcaa-b63d-478d-b12e-ab6ba1d075eb">


https://github.com/user-attachments/assets/48d3a49e-043d-48f6-ac0c-8e131d47e976

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-08-12 16:26:46 -05:00
Davis McPhee
012be928f8
[Discover] Ensure fields prefixed with 'log.' are ignored in log document profile resolution if their values are null (#190184)
## Summary

This PR fixes an issue where non-log ES|QL results were being recognized
as logs and showing the log overview doc viewer tab for mixed index
patterns like `FROM logs-synth-default,metrics-*`. This is because they
technically have `log.` prefixed fields in the returned ES|QL results,
but the values are always null.

### 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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### 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)
2024-08-12 17:36:53 -03:00
Dominique Clarke
eef66610fc
[Synthetics ] prevent excess calls to get agent namespace (#189995)
## Summary

Increases the performance of the synthetics project monitor API by
reducing response times by approximately 85%.

When generating a Synthetics package policy, we need to know the
namespace the policy should be applied to. The priority on main is as
follows
1. Use the namespace of monitor config when available and not default
2. Use the namespace of the private location
3. Use the namespace of the agent policy

There's a few problems with this
1. There is never a namespace on the private location. We do not need
that conditional
2. To support fallback number 3, we make a call to get the agent policy
to fetch the namespace. Previously, this happened for every package
policy generation, which means this happened for every monitor and
private location combination. As it turns out, we don't need to fetch
the agent policy at all, because when we provide `undefined` as the
namespace, agent already knows to fall back to the agent policy
namespace.


5. This PR removes the unnecessary conditional and call to get the agent
policy to add the namespace. Additionally, it removes another
unnecessary call to get the agent policies when fetching all available
locations, and a third unnecessary call to fetch the number of agents
per policy.

---------

Co-authored-by: Shahzad <shahzad31comp@gmail.com>
2024-08-12 16:35:35 -04:00
Shahzad
69f6687af9
[Synthetics] Delete monitor API via id param !! (#190210)
## Summary

Allow deletion of monitor via id param !!

User can now delete monitor via passing id as url param

`DELETE <kibana host>:<port>/api/synthetics/monitors/<config_id>`

Previous bulk delete via list of ids via API body still works as well !!

Docs are updated !!
2024-08-12 21:13:33 +02:00
Paul Tavares
8dbc2a08c3
[Security Solution][Endpoint] Enable processes response action for SentinelOne hosts (#189884)
## Summary

- Enables the `processes` response action for SentinelOne hosts
    - Feature flag enabled: `responseActionsSentinelOneProcessesEnabled`
2024-08-12 15:03:46 -04:00
Paul Tavares
9aa39105b6
[Security Solution][Endpoint] Change SentinelOne response actions to use agent.id instead of observer.serial_number (#189535)
## Summary

### Security Solution impacts

PR updates the SentinelOne response actions to:

- use `sentinel_one.[data_type].agent.id` field to identify the host ID
- With this change, our uses are no longer restricted to creating SIEM
alerts only from the `logs-sentinel_one.alert*` index
    - Indexes that currently include the `*.agent.id` field:
        - `logs-sentinel_one.alert*`
        - `logs-sentinel_one.threat*`
        - `logs-sentinel_one.activity*`
        - `logs-sentinel_one.agent*`
        -   IMPORTANT  : 
- Environments with a SIEM rule that looks for
`observable.serial_number` field _(the field used prior to this PR to
identify the agent id in the SentinelOne document)_ should update the
rule to use one of the new fields (see screen capture below)
- The following impacts were identified during testing for existing
deployments that may already be using the SentinelOne bi-directional
response actions (currently in Tech. Preview):
1. User will no longer be able to download the output from a previous
`get-file` command (this was just release 2 weeks ago to serverless).
2. After an upgrade, if a user opens the console and clicks on the
"Response actions history" button to display the host's response
actions, they will **not** see the response actions in the list that
were submitted prior to the upgrade. Those, however, will still be
displayed in the (global) Response Actions History Log page.
- Dev script was updated to create a SIEM rule that looks at both
`*.alert*` and `*.threat*` indexes
- Fixed the output for `processes` for SentinelOne to NOT display a Zip
file passcode for the download (not needed)
- Fixed bug that prevented the Host's OS platform icon (linux, windows,
macos) from being displayed in the console.



### Connector impacts

- SentinelOne connector sub-actions were updated to take in `agentId` as
an argument instead of `agentUUID`
2024-08-12 15:03:21 -04:00
Paul Tavares
017a9fdbb1
[Security Solution][Endpoint] Enable kill-process response action for SentinelOne hosts (#189403)
## Summary

- Enables the `responseActionsSentinelOneKillProcessEnabled` feature
flag, making `kill-process` available for use with SentinelOne Hosts
2024-08-12 15:02:25 -04:00
Marta Bondyra
bb73fc41bd
Unskip Dashboard to TSVB to Lens should convert a by reference (#190230)
## Summary

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

What I suspect happening is that some 'ghost' click is somehow happening
outside of the panel settings area (that should be open the point where
tests breaks, but the screenshot shows it's closed) and that's why it is
closed. Adding a retry around the whole panel settings actions should
help, but let's keep an eye on it.


<img width="1100" alt="Screenshot 2024-08-09 at 13 44 20"
src="https://github.com/user-attachments/assets/17d61852-c371-453d-9f41-46fd52f9e384">

The flakiness is rare so not sure if running the flaky test runner makes
sense, but I'd do it anyway:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6733
2024-08-12 20:46:20 +02:00
Alison Goryachev
bff550081f
[Index Management] Fix semantic text copy (#190262) 2024-08-12 13:52:46 -04:00