-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.7] [Cloud Security]
posture_type
Backward compatibility changes (#…
…151647) (#153276) # Backport This will backport the following commits from `main` to `8.7`: - [[Cloud Security] `posture_type` Backward compatibility changes (#151647)](#151647) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jordan","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-02-22T12:00:53Z","message":"[Cloud Security] `posture_type` Backward compatibility changes (#151647)","sha":"5037ca12bee23fc1b51ae6ec7a3091a4139e444f","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Cloud Security","v8.7.0","v8.8.0"],"number":151647,"url":"https://github.com/elastic/kibana/pull/151647","mergeCommit":{"message":"[Cloud Security] `posture_type` Backward compatibility changes (#151647)","sha":"5037ca12bee23fc1b51ae6ec7a3091a4139e444f"}},"sourceBranch":"main","suggestedTargetBranches":["8.7"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/151647","number":151647,"mergeCommit":{"message":"[Cloud Security] `posture_type` Backward compatibility changes (#151647)","sha":"5037ca12bee23fc1b51ae6ec7a3091a4139e444f"}}]}] BACKPORT--> --------- Co-authored-by: Jordan <[email protected]>
- Loading branch information
Showing
15 changed files
with
184 additions
and
72 deletions.
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
34 changes: 34 additions & 0 deletions
34
...s/cloud_security_posture/common/runtime_mappings/get_safe_posture_type_runtime_mapping.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,34 @@ | ||
/* | ||
* 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 { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/types'; | ||
|
||
/** | ||
* Creates the `safe_posture_type` runtime field with the value of either | ||
* `kspm` or `cspm` based on the value of `rule.benchmark.posture_type` | ||
*/ | ||
export const getSafePostureTypeRuntimeMapping = (): MappingRuntimeFields => ({ | ||
safe_posture_type: { | ||
type: 'keyword', | ||
script: { | ||
source: ` | ||
if (!doc.containsKey('rule.benchmark.posture_type')) | ||
{ | ||
def safe_posture_type = 'kspm'; | ||
emit(safe_posture_type); | ||
return | ||
} | ||
else | ||
{ | ||
def safe_posture_type = doc["rule.benchmark.posture_type"].value; | ||
emit(safe_posture_type); | ||
return | ||
} | ||
`, | ||
}, | ||
}, | ||
}); |
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.