[8.10] [Cloud Security] Only clean up AWS creds (#164154) (#164271)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[Cloud Security] Only clean up AWS creds
(#164154)](https://github.com/elastic/kibana/pull/164154)

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

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

<!--BACKPORT [{"author":{"name":"Or
Ouziel","email":"or.ouziel@elastic.co"},"sourceCommit":{"committedDate":"2023-08-21T09:23:15Z","message":"[Cloud
Security] Only clean up AWS creds
(#164154)","sha":"81a151ef712b76838480f6216f4ad667e7570cb6","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Cloud
Security","backport:prev-minor","v8.10.0","v8.11.0"],"number":164154,"url":"https://github.com/elastic/kibana/pull/164154","mergeCommit":{"message":"[Cloud
Security] Only clean up AWS creds
(#164154)","sha":"81a151ef712b76838480f6216f4ad667e7570cb6"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/164154","number":164154,"mergeCommit":{"message":"[Cloud
Security] Only clean up AWS creds
(#164154)","sha":"81a151ef712b76838480f6216f4ad667e7570cb6"}},{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Or Ouziel <or.ouziel@elastic.co>
This commit is contained in:
Kibana Machine 2023-08-21 05:29:21 -04:00 committed by GitHub
parent 955ce39a3c
commit 989dc1c8b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -104,7 +104,7 @@ export const getStatusForIndexName = (indexName: string, status?: BaseCspSetupSt
export const cleanupCredentials = (packagePolicy: NewPackagePolicy | UpdatePackagePolicy) => {
const enabledInput = packagePolicy.inputs.find((i) => i.enabled);
const credentialType: AwsCredentialsType | undefined =
enabledInput?.streams?.[0].vars?.['aws.credentials.type'].value;
enabledInput?.streams?.[0].vars?.['aws.credentials.type']?.value;
if (credentialType) {
const credsToKeep = AWS_CREDENTIALS_TYPE_TO_FIELDS_MAP[credentialType];