Skip to content

Commit

Permalink
Merge branch 'main' into 123585_rules_page_read_permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Mar 22, 2022
2 parents 4685334 + 9845a5c commit f249324
Show file tree
Hide file tree
Showing 804 changed files with 17,952 additions and 8,058 deletions.
1 change: 0 additions & 1 deletion .buildkite/scripts/steps/cloud/build_and_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ if [ -z "${CLOUD_DEPLOYMENT_ID}" ]; then
else
ecctl deployment show "$CLOUD_DEPLOYMENT_ID" --generate-update-payload | jq '
.resources.kibana[0].plan.kibana.docker_image = "'$CLOUD_IMAGE'" |
.resources.elasticsearch[0].plan.elasticsearch.docker_image = "'$ELASTICSEARCH_CLOUD_IMAGE'" |
(.. | select(.version? != null).version) = "'$VERSION'"
' > /tmp/deploy.json
ecctl deployment update "$CLOUD_DEPLOYMENT_ID" --track --output json --file /tmp/deploy.json &> "$JSON_FILE"
Expand Down
2 changes: 1 addition & 1 deletion .ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# NOTE: This Dockerfile is ONLY used to run certain tasks in CI. It is not used to run Kibana or as a distributable.
# If you're looking for the Kibana Docker image distributable, please see: src/dev/build/tasks/os_packages/docker_generator/templates/dockerfile.template.ts

ARG NODE_VERSION=16.13.2
ARG NODE_VERSION=16.14.2

FROM node:${NODE_VERSION} AS base

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ npm-debug.log*
.vagrant
.envrc

## Snyk
.dccache

## @cypress/snapshot from apm plugin
/snapshots.js

Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.13.2
16.14.2
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.13.2
16.14.2
14 changes: 7 additions & 7 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ check_rules_nodejs_version(minimum_version_string = "4.0.0")
# we can update that rule.
node_repositories(
node_repositories = {
"16.13.2-darwin_amd64": ("node-v16.13.2-darwin-x64.tar.gz", "node-v16.13.2-darwin-x64", "900a952bb77533d349e738ff8a5179a4344802af694615f36320a888b49b07e6"),
"16.13.2-darwin_arm64": ("node-v16.13.2-darwin-arm64.tar.gz", "node-v16.13.2-darwin-arm64", "09d300008ad58792c12622a5eafdb14c931587bb88713df4df64cdf4ff2188d1"),
"16.13.2-linux_arm64": ("node-v16.13.2-linux-arm64.tar.xz", "node-v16.13.2-linux-arm64", "a3cf8e4e9fbea27573eee6da84720bf7227ddd22842b842d48049d6dfe55fb03"),
"16.13.2-linux_s390x": ("node-v16.13.2-linux-s390x.tar.xz", "node-v16.13.2-linux-s390x", "c4ba46fc19366f7377d28a60a98f741bfa38045d7924306244c51d1660afcc8d"),
"16.13.2-linux_amd64": ("node-v16.13.2-linux-x64.tar.xz", "node-v16.13.2-linux-x64", "7f5e9a42d6e86147867d35643c7b1680c27ccd45db85666fc52798ead5e74421"),
"16.13.2-windows_amd64": ("node-v16.13.2-win-x64.zip", "node-v16.13.2-win-x64", "107e3ece84b7fa1e80b3bdf03181d395246c7867e27b17b6d7e6fa9c7932b467"),
"16.14.2-darwin_amd64": ("node-v16.14.2-darwin-x64.tar.gz", "node-v16.14.2-darwin-x64", "d3076ca7fcc7269c8ff9b03fe7d1c277d913a7e84a46a14eff4af7791ff9d055"),
"16.14.2-darwin_arm64": ("node-v16.14.2-darwin-arm64.tar.gz", "node-v16.14.2-darwin-arm64", "a66d9217d2003bd416d3dd06dfd2c7a044c4c9ff2e43a27865790bd0d59c682d"),
"16.14.2-linux_arm64": ("node-v16.14.2-linux-arm64.tar.xz", "node-v16.14.2-linux-arm64", "f7c5a573c06a520d6c2318f6ae204141b8420386553a692fc359f8ae3d88df96"),
"16.14.2-linux_s390x": ("node-v16.14.2-linux-s390x.tar.xz", "node-v16.14.2-linux-s390x", "3197925919ca357e17a31132dc6ef4e5afae819fa09905cfe9f7ff7924a00bf5"),
"16.14.2-linux_amd64": ("node-v16.14.2-linux-x64.tar.xz", "node-v16.14.2-linux-x64", "e40c6f81bfd078976d85296b5e657be19e06862497741ad82902d0704b34bb1b"),
"16.14.2-windows_amd64": ("node-v16.14.2-win-x64.zip", "node-v16.14.2-win-x64", "4731da4fbb2015d414e871fa9118cabb643bdb6dbdc8a69a3ed563266ac93229"),
},
node_version = "16.13.2",
node_version = "16.14.2",
node_urls = [
"https://nodejs.org/dist/v{version}/{filename}",
],
Expand Down
4 changes: 2 additions & 2 deletions dev_docs/contributing/documentation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ node scripts/docs.js --open
## REST APIs
REST APIs should be documented using the following formats:

- [API doc template](https://raw.githubusercontent.com/elastic/docs/main/shared/api-ref-ex.asciidoc)
- [API object definition template](https://raw.githubusercontent.com/elastic/docs/main/shared/api-definitions-ex.asciidoc)
- [API doc template](https://raw.githubusercontent.com/elastic/docs/master/shared/api-ref-ex.asciidoc)
- [API object definition template](https://raw.githubusercontent.com/elastic/docs/master/shared/api-definitions-ex.asciidoc)

## Developer documentation

Expand Down
Binary file added dev_docs/tutorials/apm_ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions dev_docs/tutorials/debugging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,49 @@ logging:
- name: elasticsearch.query
level: debug
```

## Debugging Kibana with APM

Kibana is integrated with APM's node and RUM agents.
To learn more about how APM works and what it reports, refer to the [documentation](https://www.elastic.co/guide/en/apm/guide/current/index.html).

We currently track the following types of transactions from Kibana:

Frontend (APM RUM):
* `http-request`- tracks all outgoing API requests
* `page-load` - tracks the inidial loading time of kibana
* `app-change` - tracks application changes

Backend (APM Node):
* `request` - tracks all incoming API requests
* `kibana-platform` - tracks server initiation phases (preboot, setup and start)
* `task-manager` - tracks the operation of the task manager, including claiming pending tasks and marking them as running
* `task-run` - tracks the execution of individual tasks

### Enabling APM on a local environment

In some cases, it is beneficial to enable APM on a local development environment to get an initial undesrtanding of a feature's performance during manual or automatic tests.

1. Create a secondary monitoring deployment to collect APM data. The easiest option is to use [Elastic Cloud](https://cloud.elastic.co/deployments) to create a new deployment.
2. Open Kibana, go to `Integrations` and enable the Elastic APM integration.
3. Scroll down and copy the server URL and secret token. You may also find them in your cloud console under APM & Fleet.
4. Create or open `config\kibana.dev.yml` on your local development environment.
5. Add the following settings:
```
elastic.apm.active: true
elastic.apm.serverUrl: <serverUrl>
elastic.apm.secretToken: <secretToken>
```
6. Once you run kibana and start using it, two new services (kibana, kibana-frontend) should appear under the APM UI on the APM deployment.
![APM UI](./apm_ui.png)

### Enabling APM via environment variables

It is possible to enable APM via environment variables as well.
They take precedence over any values defined in `kibana.yml` or `kibana.dev.yml`

Set the following environment variables to enable APM:

* ELASTIC_APM_ACTIVE
* ELASTIC_APM_SERVER_URL
* ELASTIC_APM_SECRET_TOKEN
2 changes: 1 addition & 1 deletion dev_docs/tutorials/endpoints.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ HTTP method. All these APIs share the same signature, and receive two parameters

When invoked, the `handler` receive three parameters: `context`, `request`, and `response`, and must return a response that will be sent to serve
the request.
- `context` is a request-bound context exposed for the request. It allows for example to use an elasticsearch client bound to the request's credentials.
- `context` is a request-bound context exposed for the request. For example, it allows to use an elasticsearch client bound to the request's credentials.
- `request` contains information related to the request, such as the path and query parameter
- `response` contains factory helpers to create the response to return from the endpoint

Expand Down
7 changes: 5 additions & 2 deletions docs/api/cases.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ You can create, manage, configure, and send cases to external systems with
these APIs:

* {security-guide}/cases-api-add-comment.html[Add comment]
* {security-guide}/cases-api-create.html[Create case]
* <<cases-api-create>>
* {security-guide}/cases-api-delete-case.html[Delete case]
* {security-guide}/cases-api-delete-all-comments.html[Delete all comments]
* {security-guide}/cases-api-delete-comment.html[Delete comment]
Expand All @@ -24,5 +24,8 @@ these APIs:
* {security-guide}/cases-api-push.html[Push case]
* {security-guide}/assign-connector.html[Set default Elastic Security UI connector]
* {security-guide}/case-api-update-connector.html[Update case configurations]
* {security-guide}/cases-api-update.html[Update case]
* <<cases-api-update>>
* {security-guide}/cases-api-update-comment.html[Update comment]

include::cases/cases-api-create.asciidoc[leveloffset=+1]
include::cases/cases-api-update.asciidoc[leveloffset=+1]
237 changes: 237 additions & 0 deletions docs/api/cases/cases-api-create.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
[[cases-api-create]]
== Create case API
++++
<titleabbrev>Create case</titleabbrev>
++++

Creates a case.

=== Request

`POST <kibana host>:<port>/api/cases`

`POST <kibana host>:<port>/s/<space_id>/api/cases`

=== Prerequisite

You must have `all` privileges for the *Cases* feature in the *Management*,
*{observability}*, or *Security* section of the
<<kibana-feature-privileges,{kib} feature privileges>>, depending on the
`owner` of the case you're creating.

=== Path parameters

`<space_id>`::
(Optional, string) An identifier for the space. If it is not specified, the
default space is used.

=== Request body

`connector`::
(Required, object) An object that contains the connector configuration.
+
.Properties of `connector`
[%collapsible%open]
====
`fields`::
(Required, object) An object containing the connector fields.
+
--
To create a case without a connector, specify `null`. If you want to omit any
individual field, specify `null` as its value.
For {ibm-r} connectors, specify:
`issueTypes`:::
(Required, array of numbers) The type of the incident.
`severityCode`:::
(Required, number) The severity code of the incident.
For {jira} connectors, specify:
`issueType`:::
(Required, string) The type of the issue.
`parent`:::
(Required, string) The key of the parent issue, when the issue type is `Sub-task`.
`priority`:::
(Required, string) The priority of the issue.
For {sn-itsm} connectors, specify:
`category`:::
(Required, string) The category of the incident.
`impact`:::
(Required, string) The effect an incident had on business.
`severity`:::
(Required, string) The severity of the incident.
`subcategory`:::
(Required, string) The subcategory of the incident.
`urgency`:::
(Required, string) The extent to which the incident resolution can be delayed.
For {sn-sir} connectors, specify:
`category`:::
(Required, string) The category of the incident.
`destIp`:::
(Required, string) A comma separated list of destination IPs.
`malwareHash`:::
(Required, string) A comma separated list of malware hashes.
`malwareUrl`:::
(Required, string) A comma separated list of malware URLs.
`priority`:::
(Required, string) The priority of the incident.
`sourceIp`:::
(Required, string) A comma separated list of source IPs.
`subcategory`:::
(Required, string) The subcategory of the incident.
For {swimlane} connectors, specify:
`caseId`:::
(Required, string) The case ID.
--
`id`::
(Required, string) The identifier for the connector. To create a case without a
connector, use `none`.
//To retrieve connector IDs, use <<cases-api-find-connectors>>).
`name`::
(Required, string) The name of the connector. To create a case without a
connector, use `none`.
`type`::
(Required, string) The type of the connector. Valid values are: `.jira`, `.none`,
`.resilient`,`.servicenow`, `.servicenow-sir`, and `.swimlane`. To create a case
without a connector, use `.none`.
====

`description`::
(Required, string) The description for the case.

`owner`::
(Required, string) The application that owns the case. Valid values are:
`cases`, `observability`, or `securitySolution`. This value affects
whether the case is visible in the {stack-manage-app}, {observability}, or
{security-app}.

`settings`::
(Required, object)
An object that contains the case settings.
+
.Properties of `settings`
[%collapsible%open]
====
`syncAlerts`::
(Required, boolean) Turns alert syncing on or off.
====

`tags`::
(Required, string array) The words and phrases that help
categorize cases. It can be an empty array.

`title`::
(Required, string) A title for the case.

=== Response code

`200`::
Indicates a successful call.

=== Example

[source,sh]
--------------------------------------------------
POST api/cases
{
"description": "James Bond clicked on a highly suspicious email
banner advertising cheap holidays for underpaid civil servants.",
"title": "This case will self-destruct in 5 seconds",
"tags": [
"phishing",
"social engineering"
],
"connector": {
"id": "131d4448-abe0-4789-939d-8ef60680b498",
"name": "My connector",
"type": ".jira",
"fields": {
"issueType": "10006",
"priority": "High",
"parent": null
}
},
"settings": {
"syncAlerts": true
},
"owner": "securitySolution"
}
--------------------------------------------------
// KIBANA

The API returns a JSON object that includes the user who created the case and
the case identifier, version, and creation time. For example:

[source,json]
--------------------------------------------------
{
"id": "66b9aa00-94fa-11ea-9f74-e7e108796192", <1>
"version": "WzUzMiwxXQ==",
"comments": [],
"totalComment": 0,
"totalAlerts": 0,
"title": "This case will self-destruct in 5 seconds",
"tags": [
"phishing",
"social engineering",
"bubblegum"
],
"settings": {
"syncAlerts": true
},
"owner": "securitySolution",
"description": "James Bond clicked on a highly suspicious email banner advertising cheap holidays for underpaid civil servants. Operation bubblegum is active. Repeat - operation bubblegum is now active",
"closed_at": null,
"closed_by": null,
"created_at": "2022-05-13T09:16:17.416Z",
"created_by": {
"email": "ahunley@imf.usa.gov",
"full_name": "Alan Hunley",
"username": "ahunley"
},
"status": "open",
"updated_at": null,
"updated_by": null,
"connector": {
"id": "131d4448-abe0-4789-939d-8ef60680b498", <2>
"name": "My connector",
"type": ".jira",
"fields": {
"issueType": "10006",
"parent": null,
"priority": "High"
}
},
"external_service": null <3>
}
--------------------------------------------------

<1> The case identifier is also its saved object ID (`savedObjectId`), which is
used when pushing cases to external systems.
<2> The default connector used to push cases to external services.
<3> The `external_service` object stores information about the incident after it
is pushed to an external incident management system.
Loading

0 comments on commit f249324

Please sign in to comment.