-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 Security Posture][Benchmark Improvements] Rules Page Improvements phase 1 + Empty Benchmark #173345
Merged
Merged
[Cloud Security Posture][Benchmark Improvements] Rules Page Improvements phase 1 + Empty Benchmark #173345
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2073cda
first commit for rules page and empty benchmark page
animehart e3bffb6
added initial versioning
animehart 134b596
Merge branch 'main' into rule-page-phase1-clean
animehart 9ea963b
CI Fixes, updates, some clean up
animehart 4f0da28
clean up
animehart 8773e03
Merge branch 'main' into rule-page-phase1-clean
animehart 26c20a8
small updates
animehart 3f1047c
Merge branch 'rule-page-phase1-clean' of github.com:animehart/kibana …
animehart f5685ae
ci fix, removed dupe file
animehart a82383a
removed unused translation
animehart 92f1850
pr comments
animehart 6877d64
failure fix
animehart 2777599
change to use camelcase
animehart a33b704
Merge branch 'main' into rule-page-phase1-clean
animehart c1083c8
pr comments and small fix
animehart 308e048
Merge branch 'rule-page-phase1-clean' of github.com:animehart/kibana …
animehart 37c6f68
comments
animehart 30d797b
Merge branch 'main' into rule-page-phase1-clean
animehart File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -5,5 +5,5 @@ | |
* 2.0. | ||
*/ | ||
|
||
export * from './rules/v3'; | ||
export * from './rules/v4'; | ||
export * from './benchmarks/v2'; |
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
115 changes: 115 additions & 0 deletions
115
x-pack/plugins/cloud_security_posture/common/types/rules/v4.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,115 @@ | ||
/* | ||
* 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 { schema, TypeOf } from '@kbn/config-schema'; | ||
import { BenchmarksCisId } from '../latest'; | ||
|
||
export type { | ||
cspBenchmarkRuleMetadataSchema, | ||
CspBenchmarkRuleMetadata, | ||
cspBenchmarkRuleSchema, | ||
CspBenchmarkRule, | ||
FindCspBenchmarkRuleResponse, | ||
CspSettings, | ||
CspBenchmarkRulesStates, | ||
} from './v3'; | ||
|
||
const DEFAULT_BENCHMARK_RULES_PER_PAGE = 25; | ||
|
||
export const findCspBenchmarkRuleRequestSchema = schema.object({ | ||
/** | ||
* An Elasticsearch simple_query_string | ||
*/ | ||
search: schema.maybe(schema.string()), | ||
|
||
/** | ||
* The page of objects to return | ||
*/ | ||
page: schema.number({ defaultValue: 1, min: 1 }), | ||
|
||
/** | ||
* The number of objects to include in each page | ||
*/ | ||
perPage: schema.number({ defaultValue: DEFAULT_BENCHMARK_RULES_PER_PAGE, min: 0 }), | ||
|
||
/** | ||
* Fields to retrieve from CspBenchmarkRule saved object | ||
*/ | ||
fields: schema.maybe(schema.arrayOf(schema.string())), | ||
|
||
/** | ||
* The fields to perform the parsed query against. | ||
* Valid fields are fields which mapped to 'text' in cspBenchmarkRuleSavedObjectMapping | ||
*/ | ||
searchFields: schema.arrayOf( | ||
schema.oneOf([schema.literal('metadata.name.text'), schema.literal('metadata.section.text')]), | ||
{ defaultValue: ['metadata.name.text'] } | ||
), | ||
|
||
/** | ||
* Sort Field | ||
*/ | ||
sortField: schema.oneOf( | ||
[ | ||
schema.literal('metadata.name'), | ||
schema.literal('metadata.section'), | ||
schema.literal('metadata.id'), | ||
schema.literal('metadata.version'), | ||
schema.literal('metadata.benchmark.id'), | ||
schema.literal('metadata.benchmark.name'), | ||
schema.literal('metadata.benchmark.posture_type'), | ||
schema.literal('metadata.benchmark.version'), | ||
schema.literal('metadata.benchmark.rule_number'), | ||
], | ||
{ | ||
defaultValue: 'metadata.benchmark.rule_number', | ||
} | ||
), | ||
|
||
/** | ||
* The order to sort by | ||
*/ | ||
sortOrder: schema.oneOf([schema.literal('asc'), schema.literal('desc')], { | ||
defaultValue: 'asc', | ||
}), | ||
|
||
/** | ||
* benchmark id | ||
*/ | ||
benchmarkId: schema.maybe( | ||
schema.oneOf([ | ||
schema.literal('cis_k8s'), | ||
schema.literal('cis_eks'), | ||
schema.literal('cis_aws'), | ||
schema.literal('cis_azure'), | ||
schema.literal('cis_gcp'), | ||
]) | ||
), | ||
|
||
/** | ||
* benchmark version | ||
*/ | ||
benchmarkVersion: schema.maybe(schema.string()), | ||
|
||
/** | ||
* rule section | ||
*/ | ||
section: schema.maybe(schema.string()), | ||
ruleNumber: schema.maybe(schema.string()), | ||
}); | ||
|
||
export type FindCspBenchmarkRuleRequest = TypeOf<typeof findCspBenchmarkRuleRequestSchema>; | ||
|
||
export interface BenchmarkRuleSelectParams { | ||
section?: string; | ||
ruleNumber?: string; | ||
} | ||
|
||
export interface PageUrlParams { | ||
benchmarkId: BenchmarksCisId; | ||
benchmarkVersion: string; | ||
} |
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@animehart was there any breaking change to the interfaces so we needed to introduce a new version?