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

fix:alignment, block check result for never scan, warnings #959

Merged
merged 2 commits into from
Mar 24, 2023
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
127 changes: 87 additions & 40 deletions deepfence_frontend/apps/dashboard/api-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,13 @@
"summary": "Get Threat Graph",
"description": "Retrieve the full threat graph associated with the account",
"operationId": "getThreatGraph",
"requestBody": {
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/GraphThreatFilters" }
}
}
},
"responses": {
"200": {
"description": "OK",
Expand Down Expand Up @@ -7104,6 +7111,7 @@
"properties": {
"adjacency": { "$ref": "#/components/schemas/ReportIDList" },
"id": { "type": "string" },
"ids": { "type": "array", "items": { "type": "string" } },
"image": { "type": "string" },
"immediate_parent_id": { "type": "string" },
"label": { "type": "string" },
Expand Down Expand Up @@ -7204,6 +7212,17 @@
}
},
"FormDataMultipartFile": { "type": "string", "format": "binary", "nullable": true },
"GraphCloudProviderFilter": {
"required": ["account_ids"],
"type": "object",
"properties": {
"account_ids": {
"type": "array",
"items": { "type": "string" },
"nullable": true
}
}
},
"GraphNodeInfo": {
"required": [
"node_id",
Expand Down Expand Up @@ -7254,6 +7273,33 @@
"vulnerability_count": { "type": "integer" }
}
},
"GraphThreatFilters": {
"required": [
"aws_filter",
"gcp_filter",
"azure_filter",
"type",
"cloud_resource_only"
],
"type": "object",
"properties": {
"aws_filter": { "$ref": "#/components/schemas/GraphCloudProviderFilter" },
"azure_filter": { "$ref": "#/components/schemas/GraphCloudProviderFilter" },
"cloud_resource_only": { "type": "boolean" },
"gcp_filter": { "$ref": "#/components/schemas/GraphCloudProviderFilter" },
"type": {
"enum": [
"all",
"vulnerability",
"secret",
"malware",
"compliance",
"cloud_compliance"
],
"type": "string"
}
}
},
"GraphThreatGraph": {
"type": "object",
"additionalProperties": {
Expand Down Expand Up @@ -7456,47 +7502,48 @@
"IngestersMalware": {
"type": "object",
"properties": {
"@timestamp": { "type": "string", "format": "date-time" },
"Class": { "type": "string" },
"CompleteFilename": { "type": "string" },
"FileSevScore": { "type": "integer" },
"FileSeverity": { "type": "string" },
"ImageLayerId": { "type": "string" },
"Meta": { "type": "array", "items": { "type": "string" }, "nullable": true },
"MetaRules": { "$ref": "#/components/schemas/IngestersMalwareRule" },
"RuleName": { "type": "string" },
"SeverityScore": { "type": "integer" },
"StringsToMatch": {
"class": { "type": "string" },
"complete_filename": { "type": "string" },
"file_sev_score": { "type": "number" },
"file_severity": { "type": "string" },
"image_layer_id": { "type": "string" },
"masked": { "type": "boolean" },
"meta": { "type": "array", "items": { "type": "string" }, "nullable": true },
"meta_rules": { "$ref": "#/components/schemas/IngestersMetaRules" },
"rule_name": { "type": "string" },
"scan_id": { "type": "string" },
"severity_score": { "type": "integer" },
"strings_to_match": {
"type": "array",
"items": { "type": "string" },
"nullable": true
},
"Summary": { "type": "string" },
"masked": { "type": "boolean" },
"scan_id": { "type": "string" }
"summary": { "type": "string" },
"timestamp": { "type": "string", "format": "date-time" }
}
},
"IngestersMalwareRule": {
"IngestersMalwareScanStatus": {
"type": "object",
"properties": {
"@timestamp": { "type": "string", "format": "date-time" },
"scan_id": { "type": "string" },
"scan_status": { "type": "string" }
}
},
"IngestersMetaRules": {
"type": "object",
"properties": {
"author": { "type": "string" },
"date": { "type": "string" },
"description": { "type": "string" },
"filetype": { "type": "string" },
"info": { "type": "string" },
"reference": { "type": "string" },
"rule_id": { "type": "string" },
"rule_name": { "type": "string" },
"version": { "type": "string" }
}
},
"IngestersMalwareScanStatus": {
"type": "object",
"properties": {
"@timestamp": { "type": "string", "format": "date-time" },
"scan_id": { "type": "string" },
"scan_status": { "type": "string" }
}
},
"IngestersReportIngestionData": {
"required": [
"process_batch",
Expand Down Expand Up @@ -8342,39 +8389,39 @@
},
"ModelMalware": {
"required": [
"Class",
"CompleteFilename",
"FileSevScore",
"FileSeverity",
"ImageLayerId",
"class",
"complete_filename",
"file_sev_score",
"file_severity",
"image_layer_id",
"node_id",
"rule_id",
"rule_name",
"masked"
],
"type": "object",
"properties": {
"Class": { "type": "string" },
"CompleteFilename": { "type": "string" },
"FileSevScore": { "type": "integer" },
"FileSeverity": { "type": "string" },
"ImageLayerId": { "type": "string" },
"SeverityScore": { "type": "integer" },
"StringsToMatch": {
"type": "array",
"items": { "type": "string" },
"nullable": true
},
"Summary": { "type": "string" },
"author": { "type": "string" },
"class": { "type": "string" },
"complete_filename": { "type": "string" },
"date": { "type": "string" },
"description": { "type": "string" },
"file_sev_score": { "type": "integer" },
"file_severity": { "type": "string" },
"filetype": { "type": "string" },
"image_layer_id": { "type": "string" },
"info": { "type": "string" },
"masked": { "type": "boolean" },
"node_id": { "type": "string" },
"rule_id": { "type": "string" },
"rule_name": { "type": "string" },
"severity_score": { "type": "integer" },
"strings_to_match": {
"type": "array",
"items": { "type": "string" },
"nullable": true
},
"summary": { "type": "string" },
"version": { "type": "string" }
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,18 @@ models/DiagnosisGenerateAgentDiagnosticLogsRequest.ts
models/DiagnosisGenerateConsoleDiagnosticLogsRequest.ts
models/DiagnosisGetDiagnosticLogsResponse.ts
models/DiagnosisNodeIdentifier.ts
models/GraphCloudProviderFilter.ts
models/GraphNodeInfo.ts
models/GraphProviderThreatGraph.ts
models/GraphThreatFilters.ts
models/GraphThreatNodeInfo.ts
models/GraphTopologyFilters.ts
models/IngestersCloudCompliance.ts
models/IngestersCloudResource.ts
models/IngestersCompliance.ts
models/IngestersMalware.ts
models/IngestersMalwareRule.ts
models/IngestersMalwareScanStatus.ts
models/IngestersMetaRules.ts
models/IngestersReportIngestionData.ts
models/IngestersSecret.ts
models/IngestersSecretMatch.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
ApiDocsBadRequestResponse,
ApiDocsFailureResponse,
GraphProviderThreatGraph,
GraphThreatFilters,
} from '../models';
import {
ApiDocsBadRequestResponseFromJSON,
Expand All @@ -26,8 +27,14 @@ import {
ApiDocsFailureResponseToJSON,
GraphProviderThreatGraphFromJSON,
GraphProviderThreatGraphToJSON,
GraphThreatFiltersFromJSON,
GraphThreatFiltersToJSON,
} from '../models';

export interface GetThreatGraphRequest {
graphThreatFilters?: GraphThreatFilters;
}

/**
* ThreatApi - interface
*
Expand All @@ -38,17 +45,18 @@ export interface ThreatApiInterface {
/**
* Retrieve the full threat graph associated with the account
* @summary Get Threat Graph
* @param {GraphThreatFilters} [graphThreatFilters]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ThreatApiInterface
*/
getThreatGraphRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{ [key: string]: GraphProviderThreatGraph; }>>;
getThreatGraphRaw(requestParameters: GetThreatGraphRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{ [key: string]: GraphProviderThreatGraph; }>>;

/**
* Retrieve the full threat graph associated with the account
* Get Threat Graph
*/
getThreatGraph(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: GraphProviderThreatGraph; }>;
getThreatGraph(requestParameters: GetThreatGraphRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: GraphProviderThreatGraph; }>;

}

Expand All @@ -61,11 +69,13 @@ export class ThreatApi extends runtime.BaseAPI implements ThreatApiInterface {
* Retrieve the full threat graph associated with the account
* Get Threat Graph
*/
async getThreatGraphRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{ [key: string]: GraphProviderThreatGraph; }>> {
async getThreatGraphRaw(requestParameters: GetThreatGraphRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{ [key: string]: GraphProviderThreatGraph; }>> {
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", []);
Expand All @@ -79,6 +89,7 @@ export class ThreatApi extends runtime.BaseAPI implements ThreatApiInterface {
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: GraphThreatFiltersToJSON(requestParameters.graphThreatFilters),
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => runtime.mapValues(jsonValue, GraphProviderThreatGraphFromJSON));
Expand All @@ -88,8 +99,8 @@ export class ThreatApi extends runtime.BaseAPI implements ThreatApiInterface {
* Retrieve the full threat graph associated with the account
* Get Threat Graph
*/
async getThreatGraph(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: GraphProviderThreatGraph; }> {
const response = await this.getThreatGraphRaw(initOverrides);
async getThreatGraph(requestParameters: GetThreatGraphRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: GraphProviderThreatGraph; }> {
const response = await this.getThreatGraphRaw(requestParameters, initOverrides);
return await response.value();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ export interface DetailedNodeSummary {
* @memberof DetailedNodeSummary
*/
id?: string;
/**
*
* @type {Array<string>}
* @memberof DetailedNodeSummary
*/
ids?: Array<string>;
/**
*
* @type {string}
Expand Down Expand Up @@ -133,6 +139,7 @@ export function DetailedNodeSummaryFromJSONTyped(json: any, ignoreDiscriminator:

'adjacency': !exists(json, 'adjacency') ? undefined : json['adjacency'],
'id': !exists(json, 'id') ? undefined : json['id'],
'ids': !exists(json, 'ids') ? undefined : json['ids'],
'image': !exists(json, 'image') ? undefined : json['image'],
'immediate_parent_id': !exists(json, 'immediate_parent_id') ? undefined : json['immediate_parent_id'],
'label': !exists(json, 'label') ? undefined : json['label'],
Expand All @@ -159,6 +166,7 @@ export function DetailedNodeSummaryToJSON(value?: DetailedNodeSummary | null): a

'adjacency': value.adjacency,
'id': value.id,
'ids': value.ids,
'image': value.image,
'immediate_parent_id': value.immediate_parent_id,
'label': value.label,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/* tslint:disable */
/* eslint-disable */
/**
* Deepfence ThreatMapper
* Deepfence Runtime API provides programmatic control over Deepfence microservice securing your container, kubernetes and cloud deployments. The API abstracts away underlying infrastructure details like cloud provider, container distros, container orchestrator and type of deployment. This is one uniform API to manage and control security alerts, policies and response to alerts for microservices running anywhere i.e. managed pure greenfield container deployments or a mix of containers, VMs and serverless paradigms like AWS Fargate.
*
* The version of the OpenAPI document: 2.0.0
* Contact: community@deepfence.io
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface GraphCloudProviderFilter
*/
export interface GraphCloudProviderFilter {
/**
*
* @type {Array<string>}
* @memberof GraphCloudProviderFilter
*/
account_ids: Array<string> | null;
}

/**
* Check if a given object implements the GraphCloudProviderFilter interface.
*/
export function instanceOfGraphCloudProviderFilter(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "account_ids" in value;

return isInstance;
}

export function GraphCloudProviderFilterFromJSON(json: any): GraphCloudProviderFilter {
return GraphCloudProviderFilterFromJSONTyped(json, false);
}

export function GraphCloudProviderFilterFromJSONTyped(json: any, ignoreDiscriminator: boolean): GraphCloudProviderFilter {
if ((json === undefined) || (json === null)) {
return json;
}
return {

'account_ids': json['account_ids'],
};
}

export function GraphCloudProviderFilterToJSON(value?: GraphCloudProviderFilter | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {

'account_ids': value.account_ids,
};
}

Loading