Commit graph

66130 commits

Author SHA1 Message Date
Ignacio Rivas
ec02f088d9
[Index Management] Add enrich policies fetch api and expose in plugin api (#163556) 2023-08-14 17:55:49 +03:00
Paul Tavares
797104b4d0
[Security Solution][Endpoint] Improvements to the run_endpoint_agent.js CLI utility (#163748)
## Summary

- Increases the amount of time it waits for the Fleet Server agent to
show up in Fleet
- Add an `AxiosError` formatter utility and makes use of it in CLI
common services
2023-08-14 10:43:11 -04:00
Alison Goryachev
97f44c1e50
[Index Management] Disable legacy index templates (#163518) 2023-08-14 10:40:16 -04:00
Cauê Marcondes
e12ad9785c
[Profiling] remove prerelease tag from add data page (#163809)
<img width="1415" alt="Screenshot 2023-08-14 at 2 32 00 PM"
src="1273d5f5-0e33-477b-b141-4b37126adc38">
2023-08-14 07:36:09 -07:00
Joey F. Poon
bc241affd3
[Security Solution] move tier into source.metadata (#163670) 2023-08-14 07:34:51 -07:00
Juan Pablo Djeredjian
aaefcdf566
[Security Solution] Flaky Cypress test: Detection rules, Prebuilt Rules Installation and Update workflow - Installation of prebuilt rules package via Fleet should install package from Fleet in the background (#163468)
Fixes: https://github.com/elastic/kibana/issues/163447
https://github.com/elastic/kibana/issues/163586

## Summary

- Fixes flaky test:
`x-pack/plugins/security_solution/cypress/e2e/detection_response/prebuilt_rules/prebuilt_rules_install_update_workflows.cy.ts`
- Test title: `Detection rules, Prebuilt Rules Installation and Update
workflow - Installation of prebuilt rules package via Fleet should
install package from Fleet in the background`

## Details

- Initially ran the flaky test runner with multiple iterations and all
gave succesful results, i.e. no flakiness or failed tests.
- But: after checking the logs for the failed tests in the original
failed build, discovered that the reason the test failed is because:
- when checking Fleet's response for the installation of the
`security_detection_engine`, the API response was not as expected from
the API spec:
```
**Expected:** [{ name: 'security_detection_engine', installSource: 'registry' }]
**Actual:** [{ name: 'security_detection_engine', installSource: undefined }]
```
Since we cannot rely 100% that the Fleet API will return the correct
value for the installSource, this PR deletes this part of the test to
prevent any type of flakiness caused by external factors such as this.
2023-08-14 16:17:02 +02:00
Nicolas Chaulet
312b254266
[Fleet] Disable Fleet for serverless ES projects (#163609) 2023-08-14 10:01:54 -04:00
Marco Liberati
8e33e49fde
[Lens] Fix issues with field name that contains : char in it (#163626)
## Summary

Fix #162172 

This PR address all potential exists automatic generated filters within
Lens, not just `last_value`.

### Checklist

Delete any items that are not applicable to this PR.

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


### Risk Matrix

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

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

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

| Risk | Probability | Severity | Mitigation/Notes |

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


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2023-08-14 15:46:46 +02:00
Dario Gieselaar
6a369361a6
[Observability AI Assistant]: Adds several function implementations to the AI Asssistant (#163764)
Lots of small fixes, but mainly new (APM) functions for the
Observability AI Assistant.


f489a310-6ba8-4591-8ac9-54a176e0b58d

---------

Co-authored-by: Coen Warmer <coen.warmer@gmail.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Clint Andrew Hall <clint@clintandrewhall.com>
2023-08-14 15:39:02 +02:00
Vadim Kibana
cc8e8fe6a6
Update usage of deprecated EUI components in SharedUx plugins (#163560)
## Summary

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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-14 06:36:38 -07:00
Paul Tavares
1fe8ffd0c8
[Security Solution][Endpoint] Update t3_analyst role to ensure it only has read access to Policy Details (#163634)
## Summary

- Updates the roles YAML file (used in testing) to match update done to
project-controller for serverless
- adds additional tests to validate `t3_analyst` role in serverless
2023-08-14 09:28:45 -04:00
Miriam
5c103e054f
[APM] Show search bar on empty prompt (#163495)
Closes https://github.com/elastic/kibana/issues/156962

### What was done
- Added the search bar to service map other states (empty, failure, etc)
- Fixed loading spinner


19b97219-1493-49a1-ac6a-06258c21961f
2023-08-14 14:24:11 +01:00
Maryam Saeidi
cb3d22aed3
Add different data-test-subj for different alert details pages based on rule type id (#163709)
Closes #163682

## 📝 Summary 

Add different data-test-subj for different alert details pages based on
rule type id, this will help us in tracking these pages more easily.


![image](86a080f8-7a1c-4352-abab-9dcd93c93176)


![image](195358ef-e01d-42b6-b5ab-abdb55447604)
2023-08-14 15:11:42 +02:00
Jeramy Soucy
7cb6e2995b
Upgrade ansi-regex 3.0.0→3.0.1, 4.1.0→4.1.1 (#163755)
Upgrades `ansi-regex` development dependencies from v3.0.0 to v3.0.1,
and v4.1.0 to v4.1.1
2023-08-14 09:08:23 -04:00
Maryam Saeidi
90b011ce0f
Fix rules functional test by replacing uptime rule with metric threshold (#163712)
Fixes #163427

## Summary

Fix rules functional test by replacing uptime rule with a metric
threshold as uptime is now replaced with synthetics (Why understand and
solve an issue if we can remove it altogether?! :D)

Flaky test runner [100]:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2859
2023-08-14 14:52:09 +02:00
Ersin Erdal
458c67e8c4
Save ES Query Rule type alerts in alert-as-data index (#161685)
Resolves: #159493

This PR replaces `AlertFactory` in ES Query rule type with
`AlertsClient` so the alerts are persistent in an alert-as-data index.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-14 15:26:23 +03:00
Philippe Oberti
4b8e9285cd
[Security Solution] expandable flyout - add cell actions to severity and status component in header (#163695) 2023-08-14 14:07:15 +02:00
Julia Bardi
bfc6610ecf
Enable secretStorage feature flag by default (#163782)
## Summary

Related to https://github.com/elastic/kibana/issues/154715
Enable `secretStorage` feature flag by default as the feature is ready.
2023-08-14 13:47:41 +02:00
Janki Salvi
ebfb8322e5
[Cases] Handle lens actions in Serverless (#163581)
## Summary

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

This PR 
- hides owner selection while adding lens to case from dashboard for
observability and securitySolution serverless
- hides add to new case and add to existing case lens action for
Elasticsearch serverless

**How to test**

- Run Observability/Securtiy solution serverless project and add lens
visualization to case from dashboard
- Run ES serverless project and check that lens do not have option to
add to case
- Classic kibana works as before (check dashboard from securitySolution
and generic dashboard as well)

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [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>
2023-08-14 13:35:56 +02:00
Angela Chuang
e0c3c525ed
[SecuritySolution] Telemetry for data quality dashboard (#162680)
## Summary

https://github.com/elastic/security-team/issues/6531






### Success Criteria [Telemetry]
- [x] Date and time of the check
- [x] Number of indices that were checked
- [x] Time it took for each quality check to complete
- [x] Number of failures, if any
- [x] Number of incompatible fields per index
- [x] Identifying the fields that are incompatible to spot recurring
mapping conflicts in customers' environments - an array of incompatible
fields
- [x] Identifying unallowed values to determine patterns of unallowed
values found in customers' environments - an array of incompatible
fields
- [x] Number of documents per cluster, index pattern, and index -
pattern not tracked, index is tracked by uuid
- [x] Storage information per cluster, index pattern, and index -
pattern not tracked, index is tracked by uuid


### Additional properties tracked:
1. batchId: events triggered by the same action share the same batchId
2. ecsVersion



[sample
data](b0662610-31ff-11ee-adde-d5df298171dd?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-7d%2Fd,to:now))&_a=(columns:!(event_type,properties.pattern,properties.sizeInBytes,properties.numberOfIndices,properties.numberOfDocuments,properties.numberOfIncompatibleFields,properties.timeConsumedMs),filters:!(),grid:(),hideChart:!f,index:c5dc7cd0-2950-4e51-b428-d0451b1b8d9d,interval:auto,query:(language:kuery,query:'event_type%20:%20%22Data%20Quality%20Checked%22%20'),sort:!(!(timestamp,desc))))


### Prerequisit:
```
telemetry.optIn: true
```

### Steps to verify:
Create an index with invalid fields from dev tools, go to data quality
dashboard, click `Check All` button.
You should find `Data Quality Index Checked` in your console verbose
when each index is checked.
When everything completed, you should find `Data Quality Check All
Completed`

```
PUT auditbeat-custom-index-1

PUT auditbeat-custom-index-1/_mapping
{
  "properties": {
    "@timestamp": {
      "type": "date"
    },
    "event.category": {
      "type": "keyword",
      "ignore_above": 1024
    }
  }
}

POST auditbeat-custom-index-1/_doc
{
  "@timestamp": "2023-02-06T09:41:49.668Z",
  "host": {
    "name": "foo"
  },
  "event": {
    "category": "an_invalid_category"
  },
  "some.field": "this",
  "source": {
    "port": 90210,
    "ip": "10.1.2.3"
  }
}

POST auditbeat-custom-index-1/_doc
{
  "@timestamp": "2023-02-06T09:42:22.123Z",
  "host": {
    "name": "bar"
  },
  "event": {
    "category": "an_invalid_category"
  },
  "some.field": "space",
  "source": {
    "port": 867,
    "ip": "10.9.8.7"
  }
}

POST auditbeat-custom-index-1/_doc
{
  "@timestamp": "2023-02-06T09:43:35.456Z",
  "host": {
    "name": "baz"
  },
  "event": {
    "category": "theory"
  },
  "some.field": "for",
  "source": {
    "port": 5,
    "ip": "10.4.6.6"
  }
}

POST auditbeat-custom-index-1/_doc
{
  "@timestamp": "2023-02-06T09:44:36.700Z",
  "host": {
    "name": "@baz"
  },
  "event": {
    "category": "malware"
  },
  "some.field": "rent",
  "source": {
    "port": 309,
    "ip": "10.1.1.1"
  }
}
```



### event_type:

**Data Quality Index Checked**
```
{
      "sizeInBytes": 89517384,
      "numberOfIndices": 1,
      "numberOfIndicesChecked": 1,
      "ilmPhase": "hot",
      "ecsVersion": "8.6.1",
      "numberOfIncompatibleFields": 0,
      "batchId": "43c35a90-e700-45cf-b9e9-822686e16cff",
      "isCheckAll": false, // This is true when it's triggered by check all button clicked
      "unallowedValueFields": [field1, field2],
      "numberOfDocuments": 172327,
      "indexId": "m_liWv7CRGWOuY2Op3lHZw",
      "errorCount": 0,
      "unallowedMappingFields": [field3],
      "timeConsumedMs": 120
    }
```

**Data Quality Check All Completed:**
```
{
      "isCheckAll": true,
      "sizeInBytes": 94708547,
      "numberOfIndices": 4,
      "numberOfIndicesChecked": 4,
      "ecsVersion": "8.6.1",
      "numberOfDocuments": 178049,
      "numberOfIncompatibleFields": 3,
      "batchId": "bdbb47ba-ffbf-432c-8212-8c691145f0d3",
      "timeConsumedMs": 13786
    },
    "timestamp": "2023-08-08T14:39:37.380Z"
  }
```


### Checklist

Delete any items that are not applicable to this PR.


- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-14 12:21:08 +01:00
Cauê Marcondes
d53b1dd91f
[Profiling] Adding storage explorer page (#163530)
<img width="1695" alt="Screenshot 2023-08-09 at 8 04 22 PM"
src="04abc986-6f27-42c8-86dd-abf28ff0e4f7">
<img width="1688" alt="Screenshot 2023-08-09 at 8 04 33 PM"
src="4862d3e3-e258-4d98-bbf9-60644bf0e8b1">

I also removed the BETA badge in this PR:
<img width="762" alt="Screenshot 2023-08-10 at 10 44 38 AM"
src="60a2c66e-e5e8-449c-9049-cfa149991ba1">
<img width="1651" alt="Screenshot 2023-08-10 at 10 49 48 AM"
src="51200a6e-2489-410a-b8d9-7b3402f0cb8a">
2023-08-14 04:07:08 -07:00
Achyut Jhunjhunwala
379b35fd8a
[APM] Fix missing alert index issue (#163600)
## Summary

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

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-08-14 12:37:50 +02:00
Stratoula Kalafateli
8511078c19
[Graph] disable application in serverless (#163582)
## Summary

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

This PR disables graph in serverless. Specifically:

- creates a serverless yml setting for disabling graph
- adds the setting in serverless.yml
2023-08-14 13:21:21 +03:00
Yngrid Coello
f494bddae1
[Logs onboarding] Troubleshooting section (#163741)
Closes https://github.com/elastic/kibana/issues/158908.

### Changes
- `TroubleshootingLink` component was created and added to
installElasticAgent step.

#### before change
<img width="2056" alt="image"
src="eaae761b-14c4-4da0-971f-3a1fc0c592be">


#### after change
<img width="2060" alt="image"
src="8f07eb15-ab97-431a-9a0b-2af9a3a83295">

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-14 12:10:30 +02:00
Anton Dosov
933f2a5792
[Serverless] fix discover breadcrumbs missing search title (#163607)
## Summary

Aaddress https://github.com/elastic/kibana/issues/163337 for discover
saved search

### Context:

In serverless navigation, we changed how breadcrumbs work. Instead of
setting the full path manually, we automatically calculate the main
parts of the path from the side nav + current URL. This was done to keep
side nav and breadcrumbs in sync as much as possible and solve
consistency issues with breadcrumbs across apps.

https://docs.elastic.dev/kibana-dev-docs/serverless-project-navigation#breadcrumbs

Apps can append custom deeper context using the
serverless.setBreadcrumbs API. Regular core.chrome.setBreadcrumbs has no
effect when the serverless nav is rendered.

<img width="1624" alt="Screenshot 2023-08-10 at 15 22 08"
src="269879b0-6fcc-4606-816e-5d76616db60a">
2023-08-14 02:51:48 -07:00
Carlos Crespo
281cc224c9
Move Lens attribute builder to a package (#163422)
closes [#163491](https://github.com/elastic/kibana/issues/163491)

## Summary

This PR creates a new package that contains a utility API that helps to
generate the JSON with the attributes required to render a Lens chart
with the `EmbeddableComponent`.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-14 11:46:47 +02:00
Ignacio Rivas
6e241a8b02
[Remote clusters] Add new security model (#161836) 2023-08-14 11:58:53 +03:00
Mark Hopkin
56be6c6fb6
[Fleet] Only enable secret storage once all fleet servers are above 8.10.0 (#163627)
## Summary

Closes #157456

Secret storage requires that fleet servers are 8.10.0 or above. 

This PR adds a backend check that all fleet servers are above 8.10.0
before enabling secrets storage. Once all fleet servers are above that
version, secrets are permanently enabled.

the fleet server check checks all agents in policies that contain the
fleet server package.

A flag on the`ingest_manager_settings` saved. object
`secret_storage_requirements_met` is used to make a note that the check
has previously passed, meaning we don't have to keep querying the agents
and policies.

Test scenarios (all covered by integration tests) : 

- given a deployment with no fleet servers connected, on creating a
package policy with secret variables, the values should be stored in
plain text not as a secret reference
- given a deployment with at least one fleet server that is below
8.10.0, on creating a package policy with secret variables, the values
should be stored in plain text not as a secret reference
- given a deployment where all fleet servers are 8.10.0 or above,
secrets should be stored as secret references and in the secrets index
- if a package policy was created before secrets were enabled, and since
its creation the fleet server versions pass the check, when updating
that policy, all secrets should move to being secret references.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Julia Bardi <julia.bardi@elastic.co>
Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
2023-08-14 09:02:03 +02:00
Candace Park
5dd5ec2182
[Fleet][Agent Policy][Agent Tamper Protection] UI / API guard agent tamper protection only available if security defend integration present (#162196)
## Summary
UI
- [x] When there is no elastic defend integration present, the agent
tamper protection (`is_protected`) switch and instruction link are
disabled and there is an info tooltip explaining why the switch is
disabled

API
- [x] Requires the elastic defend integration to be present, in order to
set `is_protected` to true. Will allow the user to create the agent
policy and not throw an error, but will keep `is_protected` as false and
log a warning in the kibana server. In the next release, the response
will be modified to send back a 201 with the relevant messaging.
- [x] Sets `is_protected` to false when a user deletes the elastic
defend package policy

## Screenshots

### No Elastic Defend integration installed
<img width="970" alt="image"
src="910be766-1a1e-4580-9ace-306089b4626d">
2023-08-13 22:45:32 -07:00
Kibana Machine
4802b0dbfe
[api-docs] 2023-08-14 Daily api_docs build (#163775)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/429
2023-08-14 00:57:09 -04:00
Dario Gieselaar
384a1f16c0
[Observability AI Assistant] Update README.md (#163769)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Coen Warmer <coen.warmer@gmail.com>
2023-08-13 02:01:41 -07:00
Kibana Machine
e67ec4a3d8
[api-docs] 2023-08-13 Daily api_docs build (#163773)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/428
2023-08-13 01:02:09 -04:00
Alejandro Fernández Haro
0284cc158d
[Telemetry] Use header-based versioned APIs instead of path-based (#159839) 2023-08-12 14:20:06 -07:00
Kibana Machine
b336a195e0
[api-docs] 2023-08-12 Daily api_docs build (#163762)
Generated by
https://buildkite.com/elastic/kibana-api-docs-daily/builds/427
2023-08-12 00:50:44 -04:00
Devin W. Hurley
7b3cc8f573
[Security Solution] [Detections] Fixes flakey exceptions read-only viewer cypress test (#162839)
## Summary

Ref: https://github.com/elastic/kibana/issues/162569

The test was trying to load the exceptions tab before the rule details
page loaded. Now we wait for the rule tab to load before continuing.
Something I was unaware of was that `cy.url()` will [automatically
retry](https://docs.cypress.io/api/commands/url#Assertions) until all
chained assertions have passed, which I think can be an easy way to fix
future flake issues where cypress tries to click on an element before
the new page loads.
2023-08-11 20:35:20 -07:00
Matthew Kime
cafaa9295e
[data views] swap_references api improvements (#163225)
## Summary

Some simple dev UX improvements to the swap_references data views api - 

```
POST /api/data_views/swap_references/_preview
{
     "fromId" : "abcd-efg",
     "toId" : "xyz-123"
}

returns 
{
  result: [{ id: "123", type: "visualization" }],
}
```


```
POST /api/data_views/swap_references
{
     "fromId" : "abcd-efg",
     "toId" : "xyz-123",
     "delete" : true // optional, removes data view which is no longer referenced
}

returns 
{
  result: [{ id: "123", type: "visualization" }],
  deleteStatus: {
    remainingRefs: 0,
    deletePerformed: true
}
```

Additional params - 

```
fromType: string - specify the saved object type. Default is `index-pattern` for data view
forId: string | string[] - limit the affected saved objects to one or more by id
forType: string - limit the affected saved objects by type
```

Improves upon https://github.com/elastic/kibana/pull/157665

Docs will be created in follow up PR
2023-08-11 20:56:46 -05:00
Nick Clark
d59d778555
Add timeWindow type changes to slo docs (#163367) 2023-08-11 19:13:32 -04:00
Philippe Oberti
fda22d0d97
[Security Solution] expandable flyout - inverse Visualizations and Investigation order and expand Investigation by default (#163684) 2023-08-12 00:35:32 +02:00
Garrett Spong
6acf72f25c
[Security Solution] Adds RBAC for Assistant (#163031)
## Summary

Adds `All`/`None` RBAC for the Elastic AI Assistant within the Security
app via Kibana feature privileges, and also via serverless PLI App
Features for the Security `complete` product (see
https://github.com/elastic/security-team/issues/7023).

Added as high-level category to enable future support of sub-features
(included sample `Create Conversation` sub-feature plumbed as example).

<p align="center">
<img width="500"
src="b42ab3fe-65e1-49b9-a379-262f2438c0eb"
/>
</p> 

Note: Since [`minimumLicense:
'enterprise'`](https://github.com/elastic/kibana/pull/163031/files#diff-56de8b6234daf4e0e69efe680e5a4afc4f88d152243b773d90c3991fa9dabc19R28)
is configured on this privilege, when the license check isn't satisfied,
the privilege will be hidden (not disabled).

## Testing

Feature is available for `enterprise` licenses and when `All` privilege
is set, otherwise Assistant is hidden in Timeline, all `Chat` UI
elements are hidden, and the `cmd/ctrl + ;` shortcut is unavailable.

---

### On Prem Testing:
Create two roles, one for each `all`/`none` Security Elastic AI
Assistant privilege (via Dev Tools):

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

``` ts
PUT /_security/role/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>


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

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

Create a new `assistant_user` (assigned both roles above), log in and
test assistant availability, then remove one role at a time testing
each:

<details><summary>POST /_security/user/assistant_user (ALL)</summary>
<p>

``` ts
POST /_security/user/assistant_user
{
    "username": "assistant_user",
    "password": "changeme",
    "roles": [
      "assistant_all",
      "assistant_none"
    ],
    "full_name": "Assistant User",
    "email": "assistant-user@elastic.co",
    "metadata": {},
    "enabled": true
}
```
</p>
</details>

Test that assistant is available in UI via `Chat` buttons and shortcut
keys.

<details><summary>PUT /_security/user/assistant_user (NONE)</summary>
<p>

``` ts
PUT /_security/user/assistant_user
{
    "username": "assistant_user",
    "roles": [
      "assistant_none"
    ],
    "full_name": "Assistant User",
    "email": "assistant-user@elastic.co",
    "metadata": {},
    "enabled": true
}
```
</p>
</details>

Test that assistant is **NOT** available in UI via `Chat` buttons or
shortcut keys.

---

### Serverless Testing:

To test with the Assistant available, set `productTypes` to `complete`
in `config/serverless.security.yml`

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

otherwise to test without the Assistant, pick a different product type like `essentials`:

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

Then start Serverless Kibana: `yarn serverless-security`

---

### 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
2023-08-11 15:48:59 -06:00
Nathan Reese
0a74fa03a0
[controls] fix Dashboard getting stuck at loading in Kibana when Controls is used and mapping changed from integer to keyword (#163529)
Closes https://github.com/elastic/kibana/issues/162474

### Changes
* RangeSliderEmbeddable - call setInitializationFinished when
runRangeSliderQuery throws. This fixes the issue
* Investigated if OptionsListEmbeddable is vulnerable to the same issue.
It's not because it uses its own REST API that has a service wrapper
`OptionsListService`. `OptionsListService` handles REST API errors.
* Add unit test verifying OptionsListService.runOptionsListRequest does
not throw when there are REST API errors and always returns a response.
* Add unit tests ensuring setInitializationFinished is called for both
RangeSliderEmbeddable and OptionsListEmbeddable in all cases
* Other clean up
* Fix uses of `dataViewsService.get`. `dataViewsService.get` throws when
data view is not found. It does not return undefined. PR updates
OptionsListEmbeddable, RangeSliderEmbeddable, and mocked data service
* Fix uses of `dataView.getFieldByName`. `dataView.getFieldByName`
returns undefined when field is not found and never throws. PR updates
OptionsListEmbeddable and RangeSliderEmbeddable
    * Remove `resp` wrapper around mocked `fetch` results.

### Test instructions
1) In console run 
  ```
  PUT test1

  PUT test1/_mapping
  {
    "properties": {
      "value": {
        "type": "integer"
      }
    }
  }

  PUT test1/_doc/1
  {
      "value" : 1
  }

  PUT test1/_doc/2
  {
      "value" : 10
  }
  ```
2) create data view `test*`
3) create dashboard with range slider control on test*.value.
4) select a range in the range slider
5) save dashboard
6) run the following in console
  ```
  PUT test2

  PUT test2/_mapping
  {
    "properties": {
      "value": {
        "type": "keyword"
      }
    }
  }

  PUT test2/_doc/1
  {
      "value" : "foo"
  }

  DELETE test1
  ```
7) Open dashboard saved above. Verify dashboard opens and control
displays an error message about being unable to run aggregation on
keyword field.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Devon Thomson <devon.thomson@elastic.co>
2023-08-11 13:58:19 -06:00
Philippe Oberti
2a67e0f67c
[Security Solution] expandable flyout - expandable panel UI update (#163449) 2023-08-11 21:34:05 +02:00
Rickyanto Ang
349972cd3c
[Cloud Security]Added Beta tag + improvements for CIS GCP (#163663)
## Summary

- Added Beta tag for GCP option on CSPM
- Fix a bug where setup_access is stuck on google_cloud_shell ( This bug
occur when user clicks on Manual option, click the start of Project ID
name, and then click google cloud shell option again)
- Added unit test for getCspmCloudShellDefaultValue to help with
refactor later
<img width="950" alt="Screenshot 2023-08-10 at 2 02 46 PM"
src="ccd45ed1-8b6c-4631-8a01-22d35d1b62aa">
2023-08-11 10:58:04 -07:00
Ying Mao
3762df1a22
[Response Ops][Task Manager] Expose SLI metrics in HTTP API - Take 2 (#163652)
## Summary

Redo of this PR https://github.com/elastic/kibana/pull/162178 but
without the `native-hdr-histogram` library which caused issues in the
serverless build. In the future we may want to pursue generating a
custom build of this native library but for our current purposes, a
simple bucketed histogram should suffice. The only changes from the
original PR are in this commit:
dde5245ded,
where we create a `SimpleHistogram` class to bucket task claim durations
into `100ms` buckets.

Please reference the original PR for more description about this HTTP
API

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-08-11 13:54:31 -04:00
Anton Dosov
57c17c4927
[Serverless] Fix sidenav responsiveness (#163700)
## Summary

I was not sure if there are other plans for these stats, but I went
ahead and cleaned those up:

### Issue 1. Sidenav groups are collapsed on a smaller screen 

#### Before 

![Screenshot 2023-08-11 at 11 28
54](a3202f96-05c2-4792-8e9e-a25ea5e471cf)

#### After 

<img width="1456" alt="Screenshot 2023-08-11 at 14 13 23"
src="3e52d05f-12fa-4d38-addb-538239e7d8d1">

### Issue 2. Collapsed sidenav state is empty 

We reserved this for icons, but until we have them, I think it makes
sense to just hide the bar:

#### Berfore

![Screenshot 2023-08-11 at 11 29
01](e8f5f474-15c5-46d1-95cc-c2580d3c7050)


#### After

<img width="1456" alt="Screenshot 2023-08-11 at 14 14 35"
src="99adadb4-637b-404b-9909-fe7e78e0224e">


### Issue 3. Navigation is not initialized when Kibana loaded with
hidden navigation

We initialize the navigation as we render the nav tree (the sidenav).
But if the sidenav is hidden, then the navigation is not initialized.
**So, for example, breadcrumbs are not displayed correctly until the nav
is opened.** As a hack, we will always render the tree, but will make it
hidden.

#### Before 

<img width="1296" alt="Screenshot 2023-08-11 at 14 35 14"
src="499e4a97-b5c3-405d-968b-bae753f15b99">


#### After 

<img width="1296" alt="Screenshot 2023-08-11 at 14 34 37"
src="ae51dea4-8d98-40f6-b3bc-c4d5df8e97fa">
2023-08-11 19:50:05 +02:00
Robert Oskamp
fd08c62f05
Adjust global loading indicator data-test-subj for projects (#163697)
## Summary

This PR adjusts the `data-test-subj` for the global loading indicator in
serverless projects such that at matches the stateful version. This
makes sure that functional tests and corresponding test helper methods
continue to work the same in stateful and serverless environments when
comes to waiting for global loading to finish, which is a key mechanism
to avoid test flakiness.

### Additional information

- The serverless project specific global loading indicator was
introduced with #158523
- The stateful loading indicator `data-test-subj` naming is implemented
here:
https://github.com/elastic/kibana/blob/main/packages/core/chrome/core-chrome-browser-internal/src/ui/loading_indicator.tsx#L61

Co-authored-by: Tim Sullivan <tsullivan@users.noreply.github.com>
2023-08-11 10:40:26 -07:00
Faisal Kanout
2093a1fee3
[AO] Update the design of Threshold rule creation form (#163313)
## Summary

Fixes #162768 
Fixes #162544

### After update 
<img width="466" alt="Screenshot 2023-08-09 at 17 53 44"
src="926f0c9e-ca55-4711-be3a-2da39726caa8">
2023-08-11 10:28:04 -07:00
Efe Gürkan YALAMAN
1e7efae56a
[Enterprise Search] Reuse serverless panels on Enterprise Search (#163179)
## Summary

Reuse Serverless panels for API index overview. 
Updated Enterprise Search overview to latests designs.

Note: There will be another PR for layout changes on overview
afterwards.





51537e57-e822-4b9f-b9ed-49d82d192690


a3696897-40a5-4cb3-9fe6-53ce5b8f560f


de752063-04ff-42a3-8538-7fb10a9df1ca

![Screenshot 2023-08-09 at 01 55
33](083504c4-7fa6-424b-a833-89dd73c61e49)



### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [x] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] 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: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2023-08-11 19:00:40 +02:00
Julia
04d8a2646d
fix find tests (#163702)
## Summary

Fix flaky find rule e2e tests.

Tested using this tool:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2858
2023-08-11 18:28:22 +02:00
Kerry Gallagher
00ffe1d791
[Logs+] Create an integration while on-boarding logs (#163219)
## Summary

This closes https://github.com/elastic/kibana/issues/161960, a basic
integration will now be created whilst onboarding logs (though the
custom logs flow).

This implements the *initial* version of this work, and does not include
things like adding a dataset to an existing integration.

## UI / UX

General:

![Screenshot 2023-08-07 at 15 20
21](3ca4e300-41c3-4554-a095-0f3dcf9e9523)

Naming conflict errors:

![Screenshot 2023-08-11 at 13 34
45](2a138eac-73e2-4cc9-b1e8-56c586b852ee)

![Screenshot 2023-08-11 at 13 34
59](6e651de9-debd-46aa-a3d5-2b6eb4e3bb4f)

Lack of permissions error:

![Screenshot 2023-08-09 at 17 10
35](d47b40c8-fe4a-4b86-abf8-d8fda51515fd)

General errors:

![Screenshot 2023-08-07 at 16 49
40](346c28d0-ec3e-4f7e-ae16-3f1adf440c21)

Success callout on the next panel:

![Screenshot 2023-08-07 at 17 20
45](03e78e45-871b-4224-9999-5b3d7e2ccdf0)

Delete previous flow (happens in the background):


![delete_process](44c18793-9df7-4228-b351-5668f098e138)


## Pointers for reviewers  / next steps

- This PR also creates a new package for the `useTrackedPromise` hook,
as this is used in several places and I didn't want to just duplicate it
again (I haven't replaced other current uses in this PR, but will as a
followup).

- `useFetcher` was avoided as A) it's very tightly coupled with the
observability onboarding server route repository (and `callApi` is
scoped to this) and I wanted to call an "external" API in Fleet and B) I
wanted explicit control over when the request is dispatched (not on
mount), and whilst this can sort of be achieved by not returning a
promise from the callback it gets quite messy. I also wanted more
granular error handling control.

- Moving forward I think we'll need to enhance the state management of
the plugin. We'll want to add the ability to "add to existing
integration" and this is going to make the state more complex (even with
chunks of this functionality likely moved to it's own package). I did
actually have the Wizard state moved in to a constate container at one
point (as a starter) but I reverted this commit to make the changeset
less intrusive. It's for this same reason that, for now, I haven't
focussed too closely on extracting things like generating the friendly
error messages etc as we'll likely want to extract some of the "create
integration" hooks / UI in to a standalone package so they can be used
elsewhere (not just onboarding). There are also quite a few `
eslint-disable-next-line react-hooks/exhaustive-deps` rules in the
plugin at the moment due to the references not being stable, we could
improve that at the same time as any state changes.

- You can technically navigate directly to
`/fox/app/observabilityOnboarding/customLogs/installElasticAgent`, but
no state is stored in the URL, so nothing is rehydrated resulting in a
very empty configuration. I'm not entirely sure this is a behaviour we
want, but for now I've just made the callout conditional on state
existing (so coming from the previous panel).

- The Fleet custom integrations API now throws a 409 (conflict) when
using a name that already exists.

## Testing

- Head to `/app/observabilityOnboarding` to trigger the onboarding flow
- Select "Stream log files"
- When hitting "continue" an integration should be created in the
background (check the network requests for
`api/fleet/epm/custom_integrations`)
- When continuing (to install shipper), then going back **and** making
changes to your integration options, when clicking continue again there
should be a network request that deletes the previously created
integration (to clean things up). This should be seamless to the user.
- You should not be able to use a name that already exists (for an
existing custom integration)
- General errors (like permission issues, asset installation issues)
should display at the bottom
- When you hit the next panel (install shipper) there should be a
success callout that also contains the name of the integration that was
created

## In progress

~Two changes still in progress, but they don't need to hold up the
review (8.10 coming soon 👀):~

- ~To have a friendlier error for permissions issues (not just
"forbidden")~
- ~Fleet API integration test for the naming collision~

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-08-11 17:18:55 +01:00
Devon Thomson
4de61111b1
[Dashboard] Fix missing state on short URL alias match redirect (#163658)
Fixes an issue where URL state from short URLs could be lost on an alias match redirect.
2023-08-11 12:15:18 -04:00