Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ export const getSafePostureTypeRuntimeMapping = (): MappingRuntimeFields => ({
type: 'keyword',
script: {
source: `
def postureTypeAvailable = doc.containsKey("rule.benchmark.posture_type") &&
!doc["rule.benchmark.posture_type"].empty;
def postureTypeAvailable = doc.containsKey("rule.benchmark.posture_type") && !doc["rule.benchmark.posture_type"].empty;
boolean isNativeCsp = doc.containsKey("data_stream.dataset") && !doc["data_stream.dataset"].empty && doc["data_stream.dataset"].value == "cloud_security_posture.findings";

if (!postureTypeAvailable) {
// Before 8.7 release
emit("kspm");
} else {
emit(doc["rule.benchmark.posture_type"].value);
if (isNativeCsp) {
if (!postureTypeAvailable) {
// Before 8.7 release
emit("kspm");
} else {
emit(doc["rule.benchmark.posture_type"].value);
}
}
`,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const checkIndexStatus = async (
],
},
};

try {
const queryResult = await esClient.search({
index,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export const findingsMockData = [
ingested: '2023-08-19T18:20:41Z',
created: '2023-08-19T18:17:15.609124281Z',
},
data_stream: {
dataset: 'cloud_security_posture.findings',
},
},
{
resource: { id: chance.guid(), name: `Pod`, sub_type: 'Upper case sub type' },
Expand All @@ -48,6 +51,9 @@ export const findingsMockData = [
ingested: '2023-08-19T18:20:41Z',
created: '2023-08-19T18:17:15.609124281Z',
},
data_stream: {
dataset: 'cloud_security_posture.findings',
},
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export const findingsMockData = [
orchestrator: {
cluster: { id: 'Upper case cluster id' },
},
data_stream: {
dataset: 'cloud_security_posture.findings',
},
},
{
'@timestamp': '2023-06-29T02:08:44.993Z',
Expand All @@ -55,5 +58,8 @@ export const findingsMockData = [
cloud: {
account: { id: 'Another Upper case account id' },
},
data_stream: {
dataset: 'cloud_security_posture.findings',
},
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
},
},
cluster_id: 'Upper case cluster id',
data_stream: {
dataset: 'cloud_security_posture.findings',
},
},
];

Expand Down