Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
43b55e5
Registers new route + scafolding for schema
paul-tavares Nov 25, 2025
8afdb92
Initial query schema definition + adjustments to list service types
paul-tavares Nov 25, 2025
d08ce99
stash
paul-tavares Nov 26, 2025
9205e40
Return results for `list()`
paul-tavares Nov 26, 2025
6162d23
Add `kuery` attribute to `list()` API/method
paul-tavares Nov 26, 2025
be26f21
Parse `kuery` string and add OS type prefix
paul-tavares Dec 1, 2025
1eaf46f
Add some additional feedback from prior PR
paul-tavares Dec 1, 2025
df66109
add validation to schema for `kuery` fields that can be used
paul-tavares Dec 1, 2025
fa4819e
Updated SO mappings and include created/updated_at as stored attributes
paul-tavares Dec 2, 2025
aeb884d
Ensure created_at and updated_at are stored in SO attributes when cre…
paul-tavares Dec 2, 2025
eecda62
Add additional sort fields and use internal field name for sorting
paul-tavares Dec 2, 2025
31000dd
Updated OpenApi docs for list API
paul-tavares Dec 2, 2025
a9fa8cb
Fix API path (remove `/action/`)
paul-tavares Dec 2, 2025
c1372c1
Merge branch 'main' into task/olm-14713-scripts-list-api
paul-tavares Dec 2, 2025
699a2ad
Changes from yarn openapi:bundle
kibanamachine Dec 2, 2025
7216f3e
Fix mocks + tests due to new properties in SO
paul-tavares Dec 2, 2025
7fad353
Merge remote-tracking branch 'origin/task/olm-14713-scripts-list-api'…
paul-tavares Dec 2, 2025
9c7a8b9
Changes from make api-docs
kibanamachine Dec 2, 2025
2a41cb9
Fix openAPI docs for scripts list api
paul-tavares Dec 2, 2025
4ec053d
Merge remote-tracking branch 'origin/task/olm-14713-scripts-list-api'…
paul-tavares Dec 2, 2025
97cc601
(temporary) enable output of docs
paul-tavares Dec 2, 2025
9b147bb
Changes from yarn openapi:bundle
kibanamachine Dec 2, 2025
c3abf7f
(revert) disable api docs output for list plugin
paul-tavares Dec 2, 2025
121ac58
Tests for list api request schema
paul-tavares Dec 2, 2025
8791179
Changes from make api-docs
kibanamachine Dec 2, 2025
bba60ba
Tests for list scripts route
paul-tavares Dec 3, 2025
ac136de
tests for `list()` method of client
paul-tavares Dec 3, 2025
8124aa6
Merge remote-tracking branch 'origin/task/olm-14713-scripts-list-api'…
paul-tavares Dec 3, 2025
8bd42d0
Fix openAPI docs
paul-tavares Dec 3, 2025
c658da0
Merge remote-tracking branch 'upstream/main' into task/olm-14713-scri…
paul-tavares Dec 3, 2025
f4f2c3c
Fix mock type
paul-tavares Dec 3, 2025
e509edd
Updated built openAPI doc files
paul-tavares Dec 3, 2025
893d77e
Enable openAPI output for list API (Temporary)
paul-tavares Dec 3, 2025
3f6f544
Updated GET metadata open API doc to not generate code
paul-tavares Dec 3, 2025
c164bc3
manual update generated files
paul-tavares Dec 3, 2025
29d80fb
Disable output of lists api docs for scripts
paul-tavares Dec 3, 2025
632918b
Changes from yarn openapi:generate
kibanamachine Dec 3, 2025
e23b4ba
Merge upstream/main
paul-tavares Dec 3, 2025
2585b61
updated generated docs
paul-tavares Dec 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31,911 changes: 17,849 additions & 14,062 deletions oas_docs/output/kibana.serverless.yaml

Large diffs are not rendered by default.

35,319 changes: 19,451 additions & 15,868 deletions oas_docs/output/kibana.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import type { EndpointKillProcessActionRequestBodyInput } from '@kbn/security-so
import type { EndpointScanActionRequestBodyInput } from '@kbn/security-solution-plugin/common/api/endpoint/actions/response_actions/scan/scan.gen';
import type { EndpointSuspendProcessActionRequestBodyInput } from '@kbn/security-solution-plugin/common/api/endpoint/actions/response_actions/suspend_process/suspend_process.gen';
import type { EndpointUnisolateActionRequestBodyInput } from '@kbn/security-solution-plugin/common/api/endpoint/actions/response_actions/unisolate/unisolate.gen';
import type { GetEndpointMetadataListRequestQueryInput } from '@kbn/security-solution-plugin/common/api/endpoint/metadata/get_metadata.gen';
import type {
GetEndpointSuggestionsRequestParamsInput,
GetEndpointSuggestionsRequestBodyInput,
Expand Down Expand Up @@ -256,14 +255,6 @@ const securitySolutionApiServiceFactory = (supertest: SuperTest.Agent) => ({
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana');
},
getEndpointMetadataList(props: GetEndpointMetadataListProps, kibanaSpace: string = 'default') {
return supertest
.get(getRouteUrlForSpace('/api/endpoint/metadata', kibanaSpace))
.set('kbn-xsrf', 'true')
.set(ELASTIC_HTTP_VERSION_HEADER, '2023-10-31')
.set(X_ELASTIC_INTERNAL_ORIGIN_REQUEST, 'kibana')
.query(props.query);
},
getEndpointSuggestions(props: GetEndpointSuggestionsProps, kibanaSpace: string = 'default') {
return supertest
.post(
Expand Down Expand Up @@ -390,9 +381,6 @@ export interface EndpointSuspendProcessActionProps {
export interface EndpointUnisolateActionProps {
body: EndpointUnisolateActionRequestBodyInput;
}
export interface GetEndpointMetadataListProps {
query: GetEndpointMetadataListRequestQueryInput;
}
export interface GetEndpointSuggestionsProps {
params: GetEndpointSuggestionsRequestParamsInput;
body: GetEndpointSuggestionsRequestBodyInput;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ paths:
get:
summary: Get a metadata list
operationId: GetEndpointMetadataList
x-codegen-enabled: true
x-codegen-enabled: false
x-labels: [ess, serverless]
parameters:
- name: page
Expand All @@ -34,7 +34,18 @@ paths:
in: query
required: false
schema:
$ref: '../model/schema/common.schema.yaml#/components/schemas/SortField'
allOf:
- $ref: '../model/schema/common.schema.yaml#/components/schemas/SortField'
- enum:
- enrolled_at
- metadata.host.hostname
- host_status
- metadata.Endpoint.policy.applied.name
- metadata.Endpoint.policy.applied.status
- metadata.host.os.name
- metadata.host.ip
- metadata.agent.version
- last_checkin
- name: sortDirection
in: query
required: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
*/

export * from './get_metadata';
export * from './get_metadata.gen';

export * from './list_metadata';
export * from './list_metadata.gen';
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,7 @@ export const SortDirectionEnum = SortDirection.enum;
* Determines which field is used to sort the results.
*/
export type SortField = z.infer<typeof SortField>;
export const SortField = z.enum([
'enrolled_at',
'metadata.host.hostname',
'host_status',
'metadata.Endpoint.policy.applied.name',
'metadata.Endpoint.policy.applied.status',
'metadata.host.os.name',
'metadata.host.ip',
'metadata.agent.version',
'last_checkin',
]);
export type SortFieldEnum = typeof SortField.enum;
export const SortFieldEnum = SortField.enum;
export const SortField = z.string();

/**
* A list of agent IDs. Max of 50.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,6 @@ components:
type: string
description: Determines which field is used to sort the results.
example: enrolled_at
enum:
- enrolled_at
- metadata.host.hostname
- host_status
- metadata.Endpoint.policy.applied.name
- metadata.Endpoint.policy.applied.status
- metadata.host.os.name
- metadata.host.ip
- metadata.agent.version
- last_checkin

AgentIds:
oneOf:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ components:
downloadUri:
type: string
description: URI to download the script file. Note that this is the relative path and does not include the space (if applicable)
example: /api/endpoint/action/scripts_library/123e4567-e89b-12d3-a456-426655440000/download
example: /api/endpoint/scripts_library/123e4567-e89b-12d3-a456-426655440000/download
description:
type: string
description: Description of the script and its purpose/functionality
Expand All @@ -40,7 +40,7 @@ components:
description: Instructions for using the script, including details around its supported input arguments
example:
type: string
executable:
pathToExecutable:
type: string
description: >
The relative path to the file included in the archive that should be executed once its contents
Expand Down Expand Up @@ -72,7 +72,7 @@ components:
name: Collect host data
platform: [ linux, macos ]
requiresInput: false
downloadUri: /api/endpoint/action/scripts_library/123e4567-e89b-12d3-a456-426655440000/download
downloadUri: /api/endpoint/scripts_library/123e4567-e89b-12d3-a456-426655440000/download
description: Collects host data for investigation
instructions: Collects host data for investigation
example: ./collect_host_data.sh --help
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ info:
title: Create script schema
version: '2023-10-31'
paths:
/api/endpoint/action/scripts_library:
/api/endpoint/scripts_library:
post:
summary: Create script
operationId: EndpointScriptLibraryCreateScript
Expand Down Expand Up @@ -72,7 +72,7 @@ components:
requiresInput:
type: boolean
description: Whether the script requires input arguments
executable:
pathToExecutable:
type: string
description: >
Used only for when the uploaded script is an archive (.zip file for example).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
*/

export * from './create_script';
export * from './list_scripts';
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: List scripts schema
* version: 2023-10-31
*/

import { z } from '@kbn/zod';

import { PageSize, SortField } from '../model/schema/common.gen';

export type ApiPageSize = z.infer<typeof ApiPageSize>;
export const ApiPageSize = PageSize.merge(z.unknown());

export type ApiSortField = z.infer<typeof ApiSortField>;
export const ApiSortField = SortField.merge(z.unknown()).merge(z.unknown());
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
openapi: 3.0.0
info:
title: List scripts schema
version: '2023-10-31'
paths:
/api/endpoint/scripts_library:
get:
summary: Get a list of scripts
operationId: EndpointScriptLibraryListScripts
description: Retrieve a list of scripts
x-codegen-enabled: false
x-labels: []
# TODO: When feature flag is enable, remove empty `x-labels` and un-comment the line below.
# x-labels: [ ess, serverless ]
parameters:
- name: page
in: query
required: false
description: Page number of the results to return. Defaults to 1.
schema:
$ref: '../model/schema/common.schema.yaml#/components/schemas/Page'
- name: pageSize
in: query
required: false
description: Number of results to return per page. Defaults to 10. Max value is 1000.
schema:
$ref: '#/components/schemas/ApiPageSize'
- name: sortField
in: query
required: false
description: The field to sort the results by. Defaults to name.
schema:
$ref: '#/components/schemas/ApiSortField'
- name: sortDirection
in: query
required: false
description: The direction to sort the results by. Defaults to asc (ascending).
schema:
$ref: '../model/schema/common.schema.yaml#/components/schemas/SortDirection'
- name: kuery
in: query
required: false
description: >
A KQL query string to filter the list of scripts. Nearly all fields in the script object are searchable.
schema:
allOf:
- $ref: '../model/schema/common.schema.yaml#/components/schemas/Kuery'
- example: "platform:windows"

responses:
'200':
description: List of scripts response
content:
application/json:
schema:
type: object
properties:
page:
$ref: '../model/schema/common.schema.yaml#/components/schemas/Page'
pageSize:
$ref: '#/components/schemas/ApiPageSize'
total:
type: integer
description: The total number of scripts matching the query
sortField:
$ref: '#/components/schemas/ApiSortField'
sortDirection:
$ref: '../model/schema/common.schema.yaml#/components/schemas/SortDirection'
data:
type: array
items:
$ref: './common.yaml#/components/schemas/EndpointScript'
examples:
response:
summary: List of scripts response example
value:
page: 1
pageSize: 10
total: 100
sortField: name
sortDirection: asc
data: []


components:
schemas:
ApiPageSize:
allOf:
- $ref: '../model/schema/common.schema.yaml#/components/schemas/PageSize'
- maximum: 1000
ApiSortField:
allOf:
- $ref: '../model/schema/common.schema.yaml#/components/schemas/SortField'
- enum:
- name
- createdAt
- createdBy
- updatedAt
- updatedBy
- example: name
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { schema, type TypeOf } from '@kbn/config-schema';
import { isScriptsLibraryKqlFilterValid } from '../../../endpoint/service/scripts_library/scripts_library_utils';
import { ENDPOINT_DEFAULT_PAGE_SIZE } from '../../../endpoint/constants';
import type { DeepMutable } from '../../../endpoint/types';

export const ListScriptsRequestSchema = {
query: schema.maybe(
schema.object({
page: schema.maybe(schema.number({ defaultValue: 1, min: 1 })),
pageSize: schema.maybe(
schema.number({ defaultValue: ENDPOINT_DEFAULT_PAGE_SIZE, min: 1, max: 1000 })
),
sortField: schema.maybe(
schema.oneOf([
schema.literal('name'),
schema.literal('createdAt'),
schema.literal('createdBy'),
schema.literal('updatedAt'),
schema.literal('updatedBy'),
])
),
sortDirection: schema.maybe(schema.oneOf([schema.literal('asc'), schema.literal('desc')])),
kuery: schema.maybe(
schema.string({
validate: (value) => isScriptsLibraryKqlFilterValid(value).error,
})
),
})
),
};

export type ListScriptsRequestQuery = DeepMutable<TypeOf<typeof ListScriptsRequestSchema.query>>;
Loading