Skip to content
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

[Security Solution] Add missing Exceptions API OpenAPI specifications #185951

Merged
merged 15 commits into from
Jul 15, 2024

Conversation

maximpn
Copy link
Contributor

@maximpn maximpn commented Jun 11, 2024

Resolves: #183837

Summary

This PR adds missing OpenAPI specifications for Exceptions API which are the following

  • POST /api/exception_lists/_export
  • POST /api/exception_lists/_import
  • POST /api/exception_lists
  • GET /api/exception_lists
  • PUT /api/exception_lists
  • DELETE /api/exception_lists
  • GET /api/exception_lists/_find
  • POST /api/exception_lists/_duplicate
  • POST /api/exception_lists/items
  • GET /api/exception_lists/items
  • PUT /api/exception_lists/items
  • DELETE /api/exception_lists/items
  • GET /api/exception_lists/items/_find
  • GET /api/exception_lists/summary
  • POST /api/exceptions/shared
  • POST /api/detection_engine/rules/{id}/exceptions

@maximpn maximpn added release_note:skip Skip the PR/issue when compiling release notes docs Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team Team:Detection Engine Security Solution Detection Engine Area v8.15.0 labels Jun 11, 2024
@maximpn maximpn self-assigned this Jun 11, 2024
@maximpn maximpn force-pushed the add-missing-exceptions-api-oas branch 2 times, most recently from 22d2fc8 to 61ad063 Compare June 12, 2024 14:03
@maximpn maximpn force-pushed the add-missing-exceptions-api-oas branch 11 times, most recently from d4d7cd8 to 09f4a03 Compare June 21, 2024 20:40
@maximpn maximpn marked this pull request as ready for review June 22, 2024 05:28
@maximpn maximpn requested review from a team as code owners June 22, 2024 05:28
@maximpn maximpn requested review from parkiino and paul-tavares June 22, 2024 05:28
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@maximpn maximpn requested a review from rylnd June 22, 2024 05:28
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@maximpn maximpn requested a review from e40pud July 9, 2024 07:35
Copy link
Contributor

@marshallmain marshallmain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good, just a couple schemas that I don't see used anywhere?

export type CreateExceptionListItemRequestBodyCamelCase = z.infer<
typeof CreateExceptionListItemRequestBodyCamelCase
>;
export const CreateExceptionListItemRequestBodyCamelCase = z.object({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this camel case schema for? I don't see it used in the API routes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially I had an idea to replace existing type CreateExceptionListItemOptions in x-pack/plugins/lists/server/services/exception_lists/exception_list_client_types.ts with CreateExceptionListItemRequestBodyCamelCase but rolled back the changes due to a number of changes required.

I removed the schema. We can add it back if needed.

export type UpdateExceptionListItemRequestBodyCamelCase = z.infer<
typeof UpdateExceptionListItemRequestBodyCamelCase
>;
export const UpdateExceptionListItemRequestBodyCamelCase = z.object({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where do we use this camel case schema?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially I had an idea to replace existing type UpdateExceptionListItemOptions in x-pack/plugins/lists/server/services/exception_lists/exception_list_client_types.ts with UpdateExceptionListItemRequestBodyCamelCase but rolled back the changes due to a number of changes required.

I removed the schema. We can add it back if needed.

- name: list_id
in: query
required: true
description: List's ide
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: List's ide
description: List's id

@maximpn maximpn force-pushed the add-missing-exceptions-api-oas branch from b7a273b to c9a716e Compare July 10, 2024 05:12
@maximpn maximpn requested a review from marshallmain July 10, 2024 05:15
Copy link
Contributor

@banderror banderror left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @maximpn, overall and code owners changes LGTM 👍

@maximpn maximpn force-pushed the add-missing-exceptions-api-oas branch from c9a716e to cd6d3ac Compare July 10, 2024 12:29
@elasticmachine
Copy link
Contributor

elasticmachine commented Jul 10, 2024

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Defend Workflows Cypress Tests on Serverless #4 / Automated Response Actions From alerts "before all" hook for "should have generated endpoint and rule" "before all" hook for "should have generated endpoint and rule"
  • [job] [logs] Defend Workflows Cypress Tests on Serverless #7 / Endpoints page "before all" hook for "Shows endpoint on the list" "before all" hook for "Shows endpoint on the list"
  • [job] [logs] Defend Workflows Cypress Tests on Serverless #14 / Response console Execute operations: "before all" hook for ""execute --command" - should execute a command" "before all" hook for ""execute --command" - should execute a command"
  • [job] [logs] Defend Workflows Cypress Tests on Serverless #4 / Response console Host Isolation: "before all" hook for "should release an isolated host via response console" "before all" hook for "should release an isolated host via response console"
  • [job] [logs] Defend Workflows Cypress Tests on Serverless #5 / Response console Scan operation: "before all" hook for ""scan --path" - should scan a file" "before all" hook for ""scan --path" - should scan a file"

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
lists 290 289 -1
securitySolution 5638 5637 -1
total -2

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/securitysolution-io-ts-list-types 525 521 -4
Unknown metric groups

API count

id before after diff
@kbn/securitysolution-io-ts-list-types 538 534 -4

History

  • 💔 Build #220505 failed c9a716e21eb0b98494c658a17c9196079830135a
  • 💔 Build #220277 failed b7a273b6abdef22132ad725be3c5d161c609fa76

cc @maximpn

@maximpn maximpn force-pushed the add-missing-exceptions-api-oas branch from cd6d3ac to 33a1a17 Compare July 12, 2024 08:16
Copy link
Contributor

@e40pud e40pud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the feedback! LGTM

@maximpn maximpn force-pushed the add-missing-exceptions-api-oas branch from 33a1a17 to a93fe4e Compare July 15, 2024 09:38
@maximpn maximpn merged commit 4d7c36c into elastic:main Jul 15, 2024
42 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jul 15, 2024
@maximpn maximpn deleted the add-missing-exceptions-api-oas branch July 15, 2024 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting docs release_note:skip Skip the PR/issue when compiling release notes Team:Detection Engine Security Solution Detection Engine Area Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants