-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SecuritySolution][Endpoint] Add scan
response action API
#184437
Merged
ashokaditya
merged 22 commits into
elastic:main
from
ashokaditya:task/dw-scan-response-action-api
Jun 3, 2024
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
2ccc4e5
Add `scan` action request API
ashokaditya db07eb3
fix types
ashokaditya b27d2a8
fix tests
ashokaditya e5f4b8c
route behind feature flag
ashokaditya 9e62e59
fix type
ashokaditya ae882df
fix tests
ashokaditya 4fdc8a3
Merge branch 'main' into task/dw-scan-response-action-api
ashokaditya 42c4454
remove redundant schema field
ashokaditya 3b6cf46
Merge branch 'main' into task/dw-scan-response-action-api
ashokaditya 3ae76aa
Merge branch 'main' into task/dw-scan-response-action-api
ashokaditya 8fa21e2
Merge branch 'main' into task/dw-scan-response-action-api
ashokaditya ea349a0
Merge branch 'main' into task/dw-scan-response-action-api
ashokaditya 8cb121a
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine 881a8bb
fix mock creation
ashokaditya c44b3e6
Update actions.test.ts
ashokaditya 471539e
update generator action errors for `scan`
ashokaditya e72d14c
Merge branch 'main' into task/dw-scan-response-action-api
ashokaditya 022377b
Merge branch 'main' into task/dw-scan-response-action-api
ashokaditya a548ffc
Merge branch 'main' into task/dw-scan-response-action-api
ashokaditya 3db5e62
Merge branch 'main' into task/dw-scan-response-action-api
ashokaditya 23e73ef
Merge branch 'main' into task/dw-scan-response-action-api
ashokaditya 63d93c5
Merge branch 'main' into task/dw-scan-response-action-api
ashokaditya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,6 @@ components: | |
- type: object | ||
required: | ||
- parameters | ||
- file | ||
properties: | ||
parameters: | ||
required: | ||
|
28 changes: 28 additions & 0 deletions
28
x-pack/plugins/security_solution/common/api/endpoint/actions/scan.gen.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* 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 { z } from 'zod'; | ||
|
||
/* | ||
* NOTICE: Do not edit this file manually. | ||
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator. | ||
* | ||
* info: | ||
* title: Scan Schema | ||
* version: 2023-10-31 | ||
*/ | ||
|
||
import { BaseActionSchema } from '../model/schema/common.gen'; | ||
|
||
export type ScanActionRequestBody = z.infer<typeof ScanActionRequestBody>; | ||
export const ScanActionRequestBody = BaseActionSchema.merge( | ||
z.object({ | ||
parameters: z.object({ | ||
path: z.string(), | ||
}), | ||
}) | ||
); |
41 changes: 41 additions & 0 deletions
41
x-pack/plugins/security_solution/common/api/endpoint/actions/scan.schema.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Scan Schema | ||
version: '2023-10-31' | ||
paths: | ||
/api/endpoint/action/scan: | ||
post: | ||
summary: Scan Action | ||
operationId: EndpointScanAction | ||
x-codegen-enabled: false | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ScanActionRequestBody' | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../model/schema/common.schema.yaml#/components/schemas/SuccessResponse' | ||
|
||
components: | ||
schemas: | ||
ScanActionRequestBody: | ||
allOf: | ||
- $ref: '../model/schema/common.schema.yaml#/components/schemas/BaseActionSchema' | ||
- type: object | ||
required: | ||
- parameters | ||
properties: | ||
parameters: | ||
required: | ||
- path | ||
type: object | ||
properties: | ||
path: | ||
type: string | ||
|
29 changes: 29 additions & 0 deletions
29
x-pack/plugins/security_solution/common/api/endpoint/actions/scan_route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* 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 type { TypeOf } from '@kbn/config-schema'; | ||
import { schema } from '@kbn/config-schema'; | ||
import { BaseActionRequestSchema } from './common/base'; | ||
|
||
export const ScanActionRequestSchema = { | ||
body: schema.object({ | ||
...BaseActionRequestSchema, | ||
|
||
parameters: schema.object({ | ||
path: schema.string({ | ||
minLength: 1, | ||
validate: (value) => { | ||
if (!value.trim().length) { | ||
return 'path cannot be an empty string'; | ||
} | ||
}, | ||
}), | ||
}), | ||
}), | ||
}; | ||
|
||
export type ScanActionRequestBody = TypeOf<typeof ScanActionRequestSchema.body>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this removed on purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. The
file
param is redundant. The schema needs aparameters
only.