Skip to content

Commit 313720f

Browse files
Merge branch 'master' of github.com:elastic/kibana into feat/siem-rule-notifications
# Conflicts: # x-pack/legacy/plugins/siem/server/lib/detection_engine/rules/update_rules.ts # x-pack/legacy/plugins/siem/server/lib/detection_engine/types.ts # x-pack/plugins/alerting/server/alerts_client.test.ts # x-pack/plugins/alerting/server/routes/update.ts
2 parents 039719f + 5c43653 commit 313720f

File tree

414 files changed

+3168
-2256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

414 files changed

+3168
-2256
lines changed

.github/workflows/pr-project-assigner.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ jobs:
1313
with:
1414
issue-mappings: |
1515
[
16-
{ "label": "Team:AppArch", "projectName": "kibana-app-arch", "columnId": 6173897 },
17-
{ "label": "Feature:Lens", "projectName": "Lens", "columnId": 6219362 },
18-
{ "label": "Team:Canvas", "projectName": "canvas", "columnId": 6187580 }
1916
]
2017
ghToken: ${{ secrets.PROJECT_ASSIGNER_TOKEN }}
18+
19+
# { "label": "Team:AppArch", "projectName": "kibana-app-arch", "columnId": 6173897 },
20+
# { "label": "Feature:Lens", "projectName": "Lens", "columnId": 6219362 },
21+
# { "label": "Team:Canvas", "projectName": "canvas", "columnId": 6187580 }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AuthNotHandled](./kibana-plugin-server.authnothandled.md)
4+
5+
## AuthNotHandled interface
6+
7+
8+
<b>Signature:</b>
9+
10+
```typescript
11+
export interface AuthNotHandled
12+
```
13+
14+
## Properties
15+
16+
| Property | Type | Description |
17+
| --- | --- | --- |
18+
| [type](./kibana-plugin-server.authnothandled.type.md) | <code>AuthResultType.notHandled</code> | |
19+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AuthNotHandled](./kibana-plugin-server.authnothandled.md) &gt; [type](./kibana-plugin-server.authnothandled.type.md)
4+
5+
## AuthNotHandled.type property
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
type: AuthResultType.notHandled;
11+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AuthRedirected](./kibana-plugin-server.authredirected.md)
4+
5+
## AuthRedirected interface
6+
7+
8+
<b>Signature:</b>
9+
10+
```typescript
11+
export interface AuthRedirected extends AuthRedirectedParams
12+
```
13+
14+
## Properties
15+
16+
| Property | Type | Description |
17+
| --- | --- | --- |
18+
| [type](./kibana-plugin-server.authredirected.type.md) | <code>AuthResultType.redirected</code> | |
19+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AuthRedirected](./kibana-plugin-server.authredirected.md) &gt; [type](./kibana-plugin-server.authredirected.type.md)
4+
5+
## AuthRedirected.type property
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
type: AuthResultType.redirected;
11+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AuthRedirectedParams](./kibana-plugin-server.authredirectedparams.md) &gt; [headers](./kibana-plugin-server.authredirectedparams.headers.md)
4+
5+
## AuthRedirectedParams.headers property
6+
7+
Headers to attach for auth redirect. Must include "location" header
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
headers: {
13+
location: string;
14+
} & ResponseHeaders;
15+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AuthRedirectedParams](./kibana-plugin-server.authredirectedparams.md)
4+
5+
## AuthRedirectedParams interface
6+
7+
Result of auth redirection.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
export interface AuthRedirectedParams
13+
```
14+
15+
## Properties
16+
17+
| Property | Type | Description |
18+
| --- | --- | --- |
19+
| [headers](./kibana-plugin-server.authredirectedparams.headers.md) | <code>{</code><br/><code> location: string;</code><br/><code> } &amp; ResponseHeaders</code> | Headers to attach for auth redirect. Must include "location" header |
20+

docs/development/core/server/kibana-plugin-server.authresult.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
<b>Signature:</b>
99

1010
```typescript
11-
export declare type AuthResult = Authenticated;
11+
export declare type AuthResult = Authenticated | AuthNotHandled | AuthRedirected;
1212
```

docs/development/core/server/kibana-plugin-server.authresultparams.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## AuthResultParams interface
66

7-
Result of an incoming request authentication.
7+
Result of successful authentication.
88

99
<b>Signature:</b>
1010

docs/development/core/server/kibana-plugin-server.authresulttype.md

+2
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ export declare enum AuthResultType
1616
| Member | Value | Description |
1717
| --- | --- | --- |
1818
| authenticated | <code>&quot;authenticated&quot;</code> | |
19+
| notHandled | <code>&quot;notHandled&quot;</code> | |
20+
| redirected | <code>&quot;redirected&quot;</code> | |
1921

docs/development/core/server/kibana-plugin-server.authtoolkit.md

+2
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ export interface AuthToolkit
1717
| Property | Type | Description |
1818
| --- | --- | --- |
1919
| [authenticated](./kibana-plugin-server.authtoolkit.authenticated.md) | <code>(data?: AuthResultParams) =&gt; AuthResult</code> | Authentication is successful with given credentials, allow request to pass through |
20+
| [notHandled](./kibana-plugin-server.authtoolkit.nothandled.md) | <code>() =&gt; AuthResult</code> | User has no credentials. Allows user to access a resource when authRequired: 'optional' Rejects a request when authRequired: true |
21+
| [redirected](./kibana-plugin-server.authtoolkit.redirected.md) | <code>(headers: {</code><br/><code> location: string;</code><br/><code> } &amp; ResponseHeaders) =&gt; AuthResult</code> | Redirect user to IdP when authRequired: true Allows user to access a resource without redirection when authRequired: 'optional' |
2022

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AuthToolkit](./kibana-plugin-server.authtoolkit.md) &gt; [notHandled](./kibana-plugin-server.authtoolkit.nothandled.md)
4+
5+
## AuthToolkit.notHandled property
6+
7+
User has no credentials. Allows user to access a resource when authRequired: 'optional' Rejects a request when authRequired: true
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
notHandled: () => AuthResult;
13+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AuthToolkit](./kibana-plugin-server.authtoolkit.md) &gt; [redirected](./kibana-plugin-server.authtoolkit.redirected.md)
4+
5+
## AuthToolkit.redirected property
6+
7+
Redirect user to IdP when authRequired: true Allows user to access a resource without redirection when authRequired: 'optional'
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
redirected: (headers: {
13+
location: string;
14+
} & ResponseHeaders) => AuthResult;
15+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [KibanaRequest](./kibana-plugin-server.kibanarequest.md) &gt; [auth](./kibana-plugin-server.kibanarequest.auth.md)
4+
5+
## KibanaRequest.auth property
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
readonly auth: {
11+
isAuthenticated: boolean;
12+
};
13+
```

docs/development/core/server/kibana-plugin-server.kibanarequest.md

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export declare class KibanaRequest<Params = unknown, Query = unknown, Body = unk
2222

2323
| Property | Modifiers | Type | Description |
2424
| --- | --- | --- | --- |
25+
| [auth](./kibana-plugin-server.kibanarequest.auth.md) | | <code>{</code><br/><code> isAuthenticated: boolean;</code><br/><code> }</code> | |
2526
| [body](./kibana-plugin-server.kibanarequest.body.md) | | <code>Body</code> | |
2627
| [events](./kibana-plugin-server.kibanarequest.events.md) | | <code>KibanaRequestEvents</code> | Request events [KibanaRequestEvents](./kibana-plugin-server.kibanarequestevents.md) |
2728
| [headers](./kibana-plugin-server.kibanarequest.headers.md) | | <code>Headers</code> | Readonly copy of incoming request headers. |

docs/development/core/server/kibana-plugin-server.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
5353
| [AssistanceAPIResponse](./kibana-plugin-server.assistanceapiresponse.md) | |
5454
| [AssistantAPIClientParams](./kibana-plugin-server.assistantapiclientparams.md) | |
5555
| [Authenticated](./kibana-plugin-server.authenticated.md) | |
56-
| [AuthResultParams](./kibana-plugin-server.authresultparams.md) | Result of an incoming request authentication. |
56+
| [AuthNotHandled](./kibana-plugin-server.authnothandled.md) | |
57+
| [AuthRedirected](./kibana-plugin-server.authredirected.md) | |
58+
| [AuthRedirectedParams](./kibana-plugin-server.authredirectedparams.md) | Result of auth redirection. |
59+
| [AuthResultParams](./kibana-plugin-server.authresultparams.md) | Result of successful authentication. |
5760
| [AuthToolkit](./kibana-plugin-server.authtoolkit.md) | A tool set defining an outcome of Auth interceptor for incoming request. |
5861
| [CallAPIOptions](./kibana-plugin-server.callapioptions.md) | The set of options that defines how API call should be made and result be processed. |
5962
| [Capabilities](./kibana-plugin-server.capabilities.md) | The read-only set of capabilities available for the current UI session. Capabilities are simple key-value pairs of (string, boolean), where the string denotes the capability ID, and the boolean is a flag indicating if the capability is enabled or disabled. |

docs/development/core/server/kibana-plugin-server.routeconfigoptions.authrequired.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
## RouteConfigOptions.authRequired property
66

7-
A flag shows that authentication for a route: `enabled` when true `disabled` when false
7+
Defines authentication mode for a route: - true. A user has to have valid credentials to access a resource - false. A user can access a resource without any credentials. - 'optional'. A user can access a resource if has valid credentials or no credentials at all. Can be useful when we grant access to a resource but want to identify a user if possible.
88

9-
Enabled by default.
9+
Defaults to `true` if an auth mechanism is registered.
1010

1111
<b>Signature:</b>
1212

1313
```typescript
14-
authRequired?: boolean;
14+
authRequired?: boolean | 'optional';
1515
```

docs/development/core/server/kibana-plugin-server.routeconfigoptions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface RouteConfigOptions<Method extends RouteMethod>
1616

1717
| Property | Type | Description |
1818
| --- | --- | --- |
19-
| [authRequired](./kibana-plugin-server.routeconfigoptions.authrequired.md) | <code>boolean</code> | A flag shows that authentication for a route: <code>enabled</code> when true <code>disabled</code> when false<!-- -->Enabled by default. |
19+
| [authRequired](./kibana-plugin-server.routeconfigoptions.authrequired.md) | <code>boolean &#124; 'optional'</code> | Defines authentication mode for a route: - true. A user has to have valid credentials to access a resource - false. A user can access a resource without any credentials. - 'optional'. A user can access a resource if has valid credentials or no credentials at all. Can be useful when we grant access to a resource but want to identify a user if possible.<!-- -->Defaults to <code>true</code> if an auth mechanism is registered. |
2020
| [body](./kibana-plugin-server.routeconfigoptions.body.md) | <code>Method extends 'get' &#124; 'options' ? undefined : RouteConfigOptionsBody</code> | Additional body options [RouteConfigOptionsBody](./kibana-plugin-server.routeconfigoptionsbody.md)<!-- -->. |
2121
| [tags](./kibana-plugin-server.routeconfigoptions.tags.md) | <code>readonly string[]</code> | Additional metadata tag strings to attach to the route. |
2222
| [xsrfRequired](./kibana-plugin-server.routeconfigoptions.xsrfrequired.md) | <code>Method extends 'get' ? never : boolean</code> | Defines xsrf protection requirements for a route: - true. Requires an incoming POST/PUT/DELETE request to contain <code>kbn-xsrf</code> header. - false. Disables xsrf protection.<!-- -->Set to true by default |

packages/kbn-config-schema/src/byte_size_value/__snapshots__/index.test.ts.snap

-11
This file was deleted.

packages/kbn-config-schema/src/byte_size_value/index.test.ts

+15-5
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,29 @@ describe('parsing units', () => {
4242
});
4343

4444
test('throws an error when unsupported unit specified', () => {
45-
expect(() => ByteSizeValue.parse('1tb')).toThrowErrorMatchingSnapshot();
45+
expect(() => ByteSizeValue.parse('1tb')).toThrowErrorMatchingInlineSnapshot(
46+
`"Failed to parse value as byte value. Value must be either number of bytes, or follow the format <count>[b|kb|mb|gb] (e.g., '1024kb', '200mb', '1gb'), where the number is a safe positive integer."`
47+
);
4648
});
4749
});
4850

4951
describe('#constructor', () => {
5052
test('throws if number of bytes is negative', () => {
51-
expect(() => new ByteSizeValue(-1024)).toThrowErrorMatchingSnapshot();
53+
expect(() => new ByteSizeValue(-1024)).toThrowErrorMatchingInlineSnapshot(
54+
`"Value in bytes is expected to be a safe positive integer."`
55+
);
5256
});
5357

5458
test('throws if number of bytes is not safe', () => {
55-
expect(() => new ByteSizeValue(NaN)).toThrowErrorMatchingSnapshot();
56-
expect(() => new ByteSizeValue(Infinity)).toThrowErrorMatchingSnapshot();
57-
expect(() => new ByteSizeValue(Math.pow(2, 53))).toThrowErrorMatchingSnapshot();
59+
expect(() => new ByteSizeValue(NaN)).toThrowErrorMatchingInlineSnapshot(
60+
`"Value in bytes is expected to be a safe positive integer."`
61+
);
62+
expect(() => new ByteSizeValue(Infinity)).toThrowErrorMatchingInlineSnapshot(
63+
`"Value in bytes is expected to be a safe positive integer."`
64+
);
65+
expect(() => new ByteSizeValue(Math.pow(2, 53))).toThrowErrorMatchingInlineSnapshot(
66+
`"Value in bytes is expected to be a safe positive integer."`
67+
);
5868
});
5969

6070
test('accepts 0', () => {

packages/kbn-config-schema/src/byte_size_value/index.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class ByteSizeValue {
3838
const number = Number(text);
3939
if (typeof number !== 'number' || isNaN(number)) {
4040
throw new Error(
41-
`Failed to parse [${text}] as byte value. Value must be either number of bytes, or follow the format <count>[b|kb|mb|gb] ` +
41+
`Failed to parse value as byte value. Value must be either number of bytes, or follow the format <count>[b|kb|mb|gb] ` +
4242
`(e.g., '1024kb', '200mb', '1gb'), where the number is a safe positive integer.`
4343
);
4444
}
@@ -53,9 +53,7 @@ export class ByteSizeValue {
5353

5454
constructor(private readonly valueInBytes: number) {
5555
if (!Number.isSafeInteger(valueInBytes) || valueInBytes < 0) {
56-
throw new Error(
57-
`Value in bytes is expected to be a safe positive integer, but provided [${valueInBytes}].`
58-
);
56+
throw new Error(`Value in bytes is expected to be a safe positive integer.`);
5957
}
6058
}
6159

packages/kbn-config-schema/src/duration/index.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function stringToDuration(text: string) {
2828
const number = Number(text);
2929
if (typeof number !== 'number' || isNaN(number)) {
3030
throw new Error(
31-
`Failed to parse [${text}] as time value. Value must be a duration in milliseconds, or follow the format ` +
31+
`Failed to parse value as time value. Value must be a duration in milliseconds, or follow the format ` +
3232
`<count>[ms|s|m|h|d|w|M|Y] (e.g. '70ms', '5s', '3d', '1Y'), where the duration is a safe positive integer.`
3333
);
3434
}
@@ -43,9 +43,7 @@ function stringToDuration(text: string) {
4343

4444
function numberToDuration(numberMs: number) {
4545
if (!Number.isSafeInteger(numberMs) || numberMs < 0) {
46-
throw new Error(
47-
`Value in milliseconds is expected to be a safe positive integer, but provided [${numberMs}].`
48-
);
46+
throw new Error(`Value in milliseconds is expected to be a safe positive integer.`);
4947
}
5048

5149
return momentDuration(numberMs);

packages/kbn-config-schema/src/types/__snapshots__/any_type.test.ts.snap

-5
This file was deleted.

packages/kbn-config-schema/src/types/__snapshots__/boolean_type.test.ts.snap

-15
This file was deleted.

packages/kbn-config-schema/src/types/__snapshots__/buffer_type.test.ts.snap

-11
This file was deleted.

0 commit comments

Comments
 (0)