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

[Cloud Posture] Update latest findings index mapping #131504

Merged
merged 16 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from 12 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 @@ -37,7 +37,7 @@ const getDescriptionDisplay = (value: unknown) => {
return <EuiText size="s">{value as string}</EuiText>;
};

export const prepareDescriptionList = (data: Record<string, unknown>) =>
export const prepareDescriptionList = (data: any) =>
Object.entries(getFlattenedObject(data))
.sort((a, b) => a[0].localeCompare(b[0]))
.map(([key, value]) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ const getFakeFindings = (name: string): CspFinding & { id: string } => ({
version: chance.string(),
},
resource: {
filename: chance.string(),
name: chance.string(),
type: chance.string(),
path: chance.string(),
uid: chance.string(),
mode: chance.string(),
raw: {} as any,
sub_type: chance.string(),
id: chance.string(),
},
cycle_id: chance.string(),
host: {} as any,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ interface CspFindingResult {
}

interface CspFindingResource {
uid: string;
filename: string;
// gid: string;
mode: string;
path: string;
name: string;
sub_type: string;
raw: object;
id: string;
type: string;
[other_keys: string]: unknown;
}

interface CspFindingHost {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,24 @@ export const latestFindingsMapping: MappingTypeMapping = {
result: {
properties: {
evaluation: {
type: 'text',
type: 'keyword',
fields: {
keyword: {
ignore_above: 1024,
type: 'keyword',
type: 'text',
},
},
},
},
},

agent: {
properties: {
id: {
type: 'text',
type: 'keyword',
fields: {
keyword: {
ignore_above: 1024,
type: 'keyword',
type: 'text',
},
},
},
Expand All @@ -39,42 +38,65 @@ export const latestFindingsMapping: MappingTypeMapping = {
type: 'date',
},
cycle_id: {
type: 'text',
type: 'keyword',
fields: {
keyword: {
ignore_above: 1024,
type: 'keyword',
type: 'text',
},
},
},
resource: {
properties: {
filename: {
type: 'text',
type: {
type: 'keyword',
fields: {
keyword: {
ignore_above: 256,
type: 'text',
},
},
},
id: {
type: 'keyword',
fields: {
keyword: {
ignore_above: 256,
type: 'text',
},
},
},
name: {
type: 'keyword',
fields: {
keyword: {
ignore_above: 1024,
type: 'keyword',
type: 'text',
},
},
},
type: {
type: 'text',
sub_type: {
type: 'keyword',
fields: {
keyword: {
ignore_above: 1024,
type: 'keyword',
type: 'text',
},
},
},
raw: {
type: 'object',
enabled: false,
},
},
},
resource_id: {
type: 'text',
// deprecated - the new field is resource.id
type: 'keyword',
fields: {
keyword: {
ignore_above: 1024,
type: 'keyword',
type: 'text',
},
},
},
Expand All @@ -93,33 +115,33 @@ export const latestFindingsMapping: MappingTypeMapping = {
benchmark: {
properties: {
name: {
type: 'text',
type: 'keyword',
fields: {
keyword: {
ignore_above: 1024,
type: 'keyword',
type: 'text',
},
},
},
},
},
section: {
type: 'text',
type: 'keyword',
fields: {
keyword: {
ignore_above: 1024,
type: 'keyword',
type: 'text',
},
},
},
},
},
cluster_id: {
type: 'text',
type: 'keyword',
fields: {
keyword: {
ignore_above: 1024,
type: 'keyword',
type: 'text',
},
},
},
Expand Down