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

Enhancements to masking results of scans #1675

Merged
merged 3 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
95 changes: 88 additions & 7 deletions deepfence_frontend/apps/dashboard/api-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,62 @@
"security": [{ "bearer_token": [] }]
}
},
"/deepfence/complete/host": {
"post": {
"tags": ["Completion"],
"summary": "Get Completion for host fields",
"description": "Complete host info",
"operationId": "completeHostInfo",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CompletionCompletionNodeFieldReq"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CompletionCompletionNodeFieldRes"
}
}
}
},
"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/complete/process": {
"post": {
"tags": ["Completion"],
Expand Down Expand Up @@ -10696,7 +10752,6 @@
"description": { "type": "string" },
"doc_id": { "type": "string" },
"group": { "type": "string" },
"masked": { "type": "boolean" },
"reason": { "type": "string" },
"region": { "type": "string" },
"resource": { "type": "string" },
Expand Down Expand Up @@ -10855,7 +10910,6 @@
"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" },
Expand Down Expand Up @@ -11020,7 +11074,6 @@
"type": "object",
"properties": { "level": { "type": "string" }, "score": { "type": "number" } }
},
"masked": { "type": "boolean" },
"scan_id": { "type": "string" }
}
},
Expand Down Expand Up @@ -11256,6 +11309,7 @@
"scan_id",
"updated_at",
"created_at",
"cloud_account_id",
"benchmark_type",
"status_counts",
"compliance_percentage",
Expand All @@ -11268,6 +11322,7 @@
"items": { "type": "string" },
"nullable": true
},
"cloud_account_id": { "type": "string" },
"compliance_percentage": { "type": "number" },
"compliances": {
"type": "array",
Expand Down Expand Up @@ -11576,6 +11631,7 @@
"scan_id",
"updated_at",
"created_at",
"cloud_account_id",
"benchmark_type",
"status_counts",
"compliance_percentage",
Expand All @@ -11588,6 +11644,7 @@
"items": { "type": "string" },
"nullable": true
},
"cloud_account_id": { "type": "string" },
"compliance_percentage": { "type": "number" },
"compliances": {
"type": "array",
Expand Down Expand Up @@ -11899,6 +11956,7 @@
"local_networks",
"instance_id",
"cloud_provider",
"cloud_account_id",
"instance_type",
"public_ip",
"private_ip",
Expand Down Expand Up @@ -11929,6 +11987,7 @@
"properties": {
"agent_running": { "type": "boolean" },
"availability_zone": { "type": "string" },
"cloud_account_id": { "type": "string" },
"cloud_provider": { "type": "string" },
"cloud_region": { "type": "string" },
"compliance_latest_scan_id": { "type": "string" },
Expand Down Expand Up @@ -12170,11 +12229,13 @@
"scan_id",
"updated_at",
"created_at",
"cloud_account_id",
"malwares",
"severity_counts"
],
"type": "object",
"properties": {
"cloud_account_id": { "type": "string" },
"created_at": { "type": "integer", "format": "int64" },
"docker_container_name": { "type": "string" },
"docker_image_name": { "type": "string" },
Expand Down Expand Up @@ -12352,6 +12413,7 @@
"required": [
"node_id",
"node_name",
"short_name",
"pid",
"cmdline",
"ppid",
Expand All @@ -12374,6 +12436,7 @@
"open_files_count": { "type": "integer" },
"pid": { "type": "integer" },
"ppid": { "type": "integer" },
"short_name": { "type": "string" },
"threads": { "type": "integer" }
}
},
Expand Down Expand Up @@ -12700,10 +12763,12 @@
"node_type",
"scan_id",
"updated_at",
"created_at"
"created_at",
"cloud_account_id"
],
"type": "object",
"properties": {
"cloud_account_id": { "type": "string" },
"created_at": { "type": "integer", "format": "int64" },
"docker_container_name": { "type": "string" },
"docker_image_name": { "type": "string" },
Expand All @@ -12721,6 +12786,7 @@
"type": "object",
"properties": {
"mask_across_hosts_and_images": { "type": "boolean" },
"mask_in_this_host_or_image_tags": { "type": "boolean" },
"result_ids": {
"type": "array",
"items": { "type": "string" },
Expand Down Expand Up @@ -12840,11 +12906,13 @@
"scan_id",
"updated_at",
"created_at",
"cloud_account_id",
"secrets",
"severity_counts"
],
"type": "object",
"properties": {
"cloud_account_id": { "type": "string" },
"created_at": { "type": "integer", "format": "int64" },
"docker_container_name": { "type": "string" },
"docker_image_name": { "type": "string" },
Expand Down Expand Up @@ -12941,27 +13009,36 @@
}
},
"ModelTopologyDeltaReq": {
"required": ["timestamp", "addition", "deletion", "entity_types"],
"required": [
"addition_timestamp",
"deletion_timestamp",
"addition",
"deletion",
"entity_types"
],
"type": "object",
"properties": {
"addition": { "type": "boolean" },
"addition_timestamp": { "type": "integer", "format": "int64" },
"deletion": { "type": "boolean" },
"deletion_timestamp": { "type": "integer", "format": "int64" },
"entity_types": {
"type": "array",
"items": { "type": "string" },
"nullable": true
},
"timestamp": { "type": "integer", "format": "int64" }
}
}
},
"ModelTopologyDeltaResponse": {
"type": "object",
"properties": {
"addition_timestamp": { "type": "integer", "format": "int64" },
"additons": {
"type": "array",
"items": { "$ref": "#/components/schemas/ModelNodeIdentifier" },
"nullable": true
},
"deletion_timestamp": { "type": "integer", "format": "int64" },
"deletions": {
"type": "array",
"items": { "$ref": "#/components/schemas/ModelNodeIdentifier" },
Expand Down Expand Up @@ -13177,11 +13254,13 @@
"scan_id",
"updated_at",
"created_at",
"cloud_account_id",
"vulnerabilities",
"severity_counts"
],
"type": "object",
"properties": {
"cloud_account_id": { "type": "string" },
"created_at": { "type": "integer", "format": "int64" },
"docker_container_name": { "type": "string" },
"docker_image_name": { "type": "string" },
Expand Down Expand Up @@ -13257,6 +13336,7 @@
"properties": {
"agent_running": { "type": "boolean" },
"availability_zone": { "type": "string" },
"cloud_account_id": { "type": "string" },
"cloud_provider": { "type": "string" },
"cloud_region": { "type": "string" },
"cmdline": { "type": "string" },
Expand Down Expand Up @@ -13321,6 +13401,7 @@
"pseudo": { "type": "boolean" },
"public_ip": { "type": "array", "items": { "type": "string" } },
"resource_group": { "type": "string" },
"short_name": { "type": "string" },
"tags": { "type": "array", "items": { "type": "string" } },
"threads": { "type": "integer" },
"timestamp": { "type": "string" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ import {
CompletionCompletionNodeFieldResToJSON,
} from '../models';

export interface CompleteHostInfoRequest {
completionCompletionNodeFieldReq?: CompletionCompletionNodeFieldReq;
}

export interface CompleteProcessInfoRequest {
completionCompletionNodeFieldReq?: CompletionCompletionNodeFieldReq;
}
Expand All @@ -46,6 +50,22 @@ export interface CompleteVulnerabilityInfoRequest {
* @interface CompletionApiInterface
*/
export interface CompletionApiInterface {
/**
* Complete host info
* @summary Get Completion for host fields
* @param {CompletionCompletionNodeFieldReq} [completionCompletionNodeFieldReq]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CompletionApiInterface
*/
completeHostInfoRaw(requestParameters: CompleteHostInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CompletionCompletionNodeFieldRes>>;

/**
* Complete host info
* Get Completion for host fields
*/
completeHostInfo(requestParameters: CompleteHostInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CompletionCompletionNodeFieldRes>;

/**
* Complete process info
* @summary Get Completion for process fields
Expand Down Expand Up @@ -85,6 +105,45 @@ export interface CompletionApiInterface {
*/
export class CompletionApi extends runtime.BaseAPI implements CompletionApiInterface {

/**
* Complete host info
* Get Completion for host fields
*/
async completeHostInfoRaw(requestParameters: CompleteHostInfoRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CompletionCompletionNodeFieldRes>> {
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/complete/host`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: CompletionCompletionNodeFieldReqToJSON(requestParameters.completionCompletionNodeFieldReq),
}, initOverrides);

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

/**
* Complete host info
* Get Completion for host fields
*/
async completeHostInfo(requestParameters: CompleteHostInfoRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CompletionCompletionNodeFieldRes> {
const response = await this.completeHostInfoRaw(requestParameters, initOverrides);
return await response.value();
}

/**
* Complete process info
* Get Completion for process fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ export interface IngestersCloudCompliance {
* @memberof IngestersCloudCompliance
*/
group?: string;
/**
*
* @type {boolean}
* @memberof IngestersCloudCompliance
*/
masked?: boolean;
/**
*
* @type {string}
Expand Down Expand Up @@ -163,7 +157,6 @@ export function IngestersCloudComplianceFromJSONTyped(json: any, ignoreDiscrimin
'description': !exists(json, 'description') ? undefined : json['description'],
'doc_id': !exists(json, 'doc_id') ? undefined : json['doc_id'],
'group': !exists(json, 'group') ? undefined : json['group'],
'masked': !exists(json, 'masked') ? undefined : json['masked'],
'reason': !exists(json, 'reason') ? undefined : json['reason'],
'region': !exists(json, 'region') ? undefined : json['region'],
'resource': !exists(json, 'resource') ? undefined : json['resource'],
Expand Down Expand Up @@ -194,7 +187,6 @@ export function IngestersCloudComplianceToJSON(value?: IngestersCloudCompliance
'description': value.description,
'doc_id': value.doc_id,
'group': value.group,
'masked': value.masked,
'reason': value.reason,
'region': value.region,
'resource': value.resource,
Expand Down
Loading
Loading