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

Add an option to group posture results by control #2163

Closed
wants to merge 8 commits into from
Closed
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
139 changes: 138 additions & 1 deletion deepfence_frontend/apps/dashboard/api-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -6870,6 +6870,118 @@
"security": [{ "bearer_token": [] }]
}
},
"/deepfence/scan/results/count/group/cloud-compliance": {
"post": {
"tags": ["Compliance"],
"summary": "Count Cloud Compliance Results by Control ID",
"description": "Count Cloud Compliance Results grouped by Control ID",
"operationId": "groupResultsCloudCompliance",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModelComplinaceScanResultsGroupReq"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModelComplinaceScanResultsGroupResp"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsBadRequestResponse" }
}
}
},
"401": { "description": "Unauthorized" },
"403": { "description": "Forbidden" },
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsFailureResponse" }
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsFailureResponse" }
}
}
}
},
"security": [{ "bearer_token": [] }]
}
},
"/deepfence/scan/results/count/group/compliance": {
"post": {
"tags": ["Compliance"],
"summary": "Count Compliance Results by Control ID",
"description": "Count Compliance Results grouped by Control ID",
"operationId": "groupResultsCompliance",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModelComplinaceScanResultsGroupReq"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModelComplinaceScanResultsGroupResp"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsBadRequestResponse" }
}
}
},
"401": { "description": "Unauthorized" },
"403": { "description": "Forbidden" },
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsFailureResponse" }
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ApiDocsFailureResponse" }
}
}
}
},
"security": [{ "bearer_token": [] }]
}
},
"/deepfence/scan/results/count/group/malware": {
"get": {
"tags": ["Malware Scan"],
Expand Down Expand Up @@ -13503,9 +13615,12 @@
"items": { "type": "string" },
"nullable": true
},
"category_hierarchy_short": { "type": "string" },
"compliance_type": { "type": "string" },
"control_id": { "type": "string" },
"description": { "type": "string" },
"enabled": { "type": "boolean" },
"node_id": { "type": "string" },
"service": { "type": "string" },
"title": { "type": "string" }
}
Expand Down Expand Up @@ -13766,6 +13881,27 @@
}
}
},
"ModelComplinaceScanResultsGroupReq": {
"required": ["scan_id", "fields_filter"],
"type": "object",
"properties": {
"fields_filter": { "$ref": "#/components/schemas/ReportersFieldsFilters" },
"scan_id": { "type": "string" }
}
},
"ModelComplinaceScanResultsGroupResp": {
"type": "object",
"properties": {
"groups": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": { "type": "integer" }
},
"nullable": true
}
}
},
"ModelConnection": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -16008,7 +16144,8 @@
"nist",
"hipaa",
"pci",
"soc_2"
"soc_2",
"aws_foundational_security"
],
"type": "array",
"items": { "type": "string" },
Expand Down
4 changes: 4 additions & 0 deletions deepfence_frontend/apps/dashboard/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ export function getComplianceApiClient() {
resultCountComplianceScan:
complianceApi.countResultsComplianceScan.bind(complianceApi),
listComplianceScan: complianceApi.listComplianceScan.bind(complianceApi),
scanResultCloudComplianceCountsByControls:
complianceApi.groupResultsCloudCompliance.bind(complianceApi),
scanResultComplianceCountsByControls:
complianceApi.groupResultsCompliance.bind(complianceApi),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ models/ModelComplianceScanInfo.ts
models/ModelComplianceScanResult.ts
models/ModelComplianceScanStatusResp.ts
models/ModelComplianceScanTriggerReq.ts
models/ModelComplinaceScanResultsGroupReq.ts
models/ModelComplinaceScanResultsGroupResp.ts
models/ModelConnection.ts
models/ModelContainer.ts
models/ModelContainerImage.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import type {
IngestersComplianceScanStatus,
ModelComplianceScanResult,
ModelComplianceScanTriggerReq,
ModelComplinaceScanResultsGroupReq,
ModelComplinaceScanResultsGroupResp,
ModelScanListReq,
ModelScanListResp,
ModelScanResultsReq,
Expand All @@ -43,6 +45,10 @@ import {
ModelComplianceScanResultToJSON,
ModelComplianceScanTriggerReqFromJSON,
ModelComplianceScanTriggerReqToJSON,
ModelComplinaceScanResultsGroupReqFromJSON,
ModelComplinaceScanResultsGroupReqToJSON,
ModelComplinaceScanResultsGroupRespFromJSON,
ModelComplinaceScanResultsGroupRespToJSON,
ModelScanListReqFromJSON,
ModelScanListReqToJSON,
ModelScanListRespFromJSON,
Expand All @@ -65,6 +71,14 @@ export interface CountResultsComplianceScanRequest {
modelScanResultsReq?: ModelScanResultsReq;
}

export interface GroupResultsCloudComplianceRequest {
modelComplinaceScanResultsGroupReq?: ModelComplinaceScanResultsGroupReq;
}

export interface GroupResultsComplianceRequest {
modelComplinaceScanResultsGroupReq?: ModelComplinaceScanResultsGroupReq;
}

export interface IngestComplianceScanStatusRequest {
ingestersComplianceScanStatus?: Array<IngestersComplianceScanStatus> | null;
}
Expand Down Expand Up @@ -116,6 +130,38 @@ export interface ComplianceApiInterface {
*/
countResultsComplianceScan(requestParameters: CountResultsComplianceScanRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SearchSearchCountResp>;

/**
* Count Cloud Compliance Results grouped by Control ID
* @summary Count Cloud Compliance Results by Control ID
* @param {ModelComplinaceScanResultsGroupReq} [modelComplinaceScanResultsGroupReq]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ComplianceApiInterface
*/
groupResultsCloudComplianceRaw(requestParameters: GroupResultsCloudComplianceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelComplinaceScanResultsGroupResp>>;

/**
* Count Cloud Compliance Results grouped by Control ID
* Count Cloud Compliance Results by Control ID
*/
groupResultsCloudCompliance(requestParameters: GroupResultsCloudComplianceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelComplinaceScanResultsGroupResp>;

/**
* Count Compliance Results grouped by Control ID
* @summary Count Compliance Results by Control ID
* @param {ModelComplinaceScanResultsGroupReq} [modelComplinaceScanResultsGroupReq]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ComplianceApiInterface
*/
groupResultsComplianceRaw(requestParameters: GroupResultsComplianceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelComplinaceScanResultsGroupResp>>;

/**
* Count Compliance Results grouped by Control ID
* Count Compliance Results by Control ID
*/
groupResultsCompliance(requestParameters: GroupResultsComplianceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelComplinaceScanResultsGroupResp>;

/**
* Ingest compliance issues found while scanning the agent
* @summary Ingest Compliance Scan Status
Expand Down Expand Up @@ -274,6 +320,84 @@ export class ComplianceApi extends runtime.BaseAPI implements ComplianceApiInter
return await response.value();
}

/**
* Count Cloud Compliance Results grouped by Control ID
* Count Cloud Compliance Results by Control ID
*/
async groupResultsCloudComplianceRaw(requestParameters: GroupResultsCloudComplianceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelComplinaceScanResultsGroupResp>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("bearer_token", []);

if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/deepfence/scan/results/count/group/cloud-compliance`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ModelComplinaceScanResultsGroupReqToJSON(requestParameters.modelComplinaceScanResultsGroupReq),
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => ModelComplinaceScanResultsGroupRespFromJSON(jsonValue));
}

/**
* Count Cloud Compliance Results grouped by Control ID
* Count Cloud Compliance Results by Control ID
*/
async groupResultsCloudCompliance(requestParameters: GroupResultsCloudComplianceRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelComplinaceScanResultsGroupResp> {
const response = await this.groupResultsCloudComplianceRaw(requestParameters, initOverrides);
return await response.value();
}

/**
* Count Compliance Results grouped by Control ID
* Count Compliance Results by Control ID
*/
async groupResultsComplianceRaw(requestParameters: GroupResultsComplianceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ModelComplinaceScanResultsGroupResp>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("bearer_token", []);

if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/deepfence/scan/results/count/group/compliance`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ModelComplinaceScanResultsGroupReqToJSON(requestParameters.modelComplinaceScanResultsGroupReq),
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => ModelComplinaceScanResultsGroupRespFromJSON(jsonValue));
}

/**
* Count Compliance Results grouped by Control ID
* Count Compliance Results by Control ID
*/
async groupResultsCompliance(requestParameters: GroupResultsComplianceRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ModelComplinaceScanResultsGroupResp> {
const response = await this.groupResultsComplianceRaw(requestParameters, initOverrides);
return await response.value();
}

/**
* Ingest compliance issues found while scanning the agent
* Ingest Compliance Scan Status
Expand Down
Loading