[8.10] [EDR Workflows] Change Osquery shards schema (#166178) (#166279)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[EDR Workflows] Change Osquery shards schema
(#166178)](https://github.com/elastic/kibana/pull/166178)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Tomasz
Ciecierski","email":"tomasz.ciecierski@elastic.co"},"sourceCommit":{"committedDate":"2023-09-12T15:26:16Z","message":"[EDR
Workflows] Change Osquery shards schema
(#166178)","sha":"fb5f8e379b5f91f7b9a53e4f394bdf862dbfddcc","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Defend
Workflows","Feature:Osquery","v8.10.0","v8.11.0"],"number":166178,"url":"https://github.com/elastic/kibana/pull/166178","mergeCommit":{"message":"[EDR
Workflows] Change Osquery shards schema
(#166178)","sha":"fb5f8e379b5f91f7b9a53e4f394bdf862dbfddcc"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/166178","number":166178,"mergeCommit":{"message":"[EDR
Workflows] Change Osquery shards schema
(#166178)","sha":"fb5f8e379b5f91f7b9a53e4f394bdf862dbfddcc"}}]}]
BACKPORT-->

Co-authored-by: Tomasz Ciecierski <tomasz.ciecierski@elastic.co>
This commit is contained in:
Kibana Machine 2023-09-12 12:36:39 -04:00 committed by GitHub
parent 173521b824
commit 7de3a740e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -13,7 +13,7 @@ export const createPackRequestBodySchema = t.type({
description: t.union([t.string, t.undefined]),
enabled: t.union([t.boolean, t.undefined]),
policy_ids: t.union([t.array(t.string), t.undefined]),
shards: t.record(t.string, toNumberRt),
shards: t.union([t.record(t.string, toNumberRt), t.undefined]),
queries: t.record(
t.string,
t.type({

View file

@ -67,7 +67,7 @@ export const createPackRoute = (router: IRouter, osqueryContext: OsqueryAppConte
const currentUser = await osqueryContext.security.authc.getCurrentUser(request)?.username;
// eslint-disable-next-line @typescript-eslint/naming-convention
const { name, description, queries, enabled, policy_ids, shards } = request.body;
const { name, description, queries, enabled, policy_ids, shards = {} } = request.body;
const conflictingEntries = await savedObjectsClient.find({
type: packSavedObjectType,
filter: `${packSavedObjectType}.attributes.name: "${name}"`,