Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Commit 2b97f71

Browse files
authored
Merge pull request #54 from intelowlproject/develop
fix runtime_configuration bug for file scan
2 parents 388a27e + 546244b commit 2b97f71

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

‎src/app/@core/services/scan.service.ts‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,17 @@ export class ScanService extends HttpService<any> {
7777
private: data.private,
7878
disable_external_analyzers: data.disable_external_analyzers,
7979
tags_id: data.tags_id || [],
80-
runtime_configuration: data.runtime_configuration,
8180
};
8281
if (type === 'observable') {
8382
obj.is_sample = false;
8483
obj.observable_name = data.observable_name;
8584
obj.observable_classification = data.classification;
85+
obj.runtime_configuration = data.runtime_configuration;
8686
await this._createObservableScan(obj);
8787
} else {
8888
obj.is_sample = true;
8989
obj.file_name = data.file_name;
90-
await this._createFileScan(obj, data.file);
90+
await this._createFileScan(obj, data.file, data.runtime_configuration);
9191
}
9292
}
9393

@@ -102,7 +102,11 @@ export class ScanService extends HttpService<any> {
102102
}
103103

104104
// should never be called without context
105-
private async _createFileScan(obj: any, file: File): Promise<void> {
105+
private async _createFileScan(
106+
obj: any,
107+
file: File,
108+
runtimeCfg: any
109+
): Promise<void> {
106110
const postFormData: FormData = new FormData();
107111
for (const key in obj) {
108112
if (obj.hasOwnProperty(key)) {
@@ -113,6 +117,9 @@ export class ScanService extends HttpService<any> {
113117
}
114118
}
115119
}
120+
if (runtimeCfg != null && Object.keys(runtimeCfg).length) {
121+
postFormData.append('runtime_configuration', JSON.stringify(runtimeCfg));
122+
}
116123
postFormData.append('file', file, obj.file_name);
117124
const res = await this.create(postFormData, {}, 'send_analysis_request');
118125
if (res['status'] === 'accepted' || res['status'] === 'running') {

‎src/app/pages/scans/scans-management/scan-file/scan-file.component.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class ScanFileComponent {
1919
private: false,
2020
run_all_available_analyzers: false,
2121
tags_id: [],
22+
runtime_configuration: {},
2223
} as IScanForm;
2324
}
2425

‎src/app/pages/scans/scans-management/scan-observable/scan-observable.component.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class ScanObservableComponent {
2020
private: false,
2121
run_all_available_analyzers: false,
2222
tags_id: [],
23+
runtime_configuration: {},
2324
} as IScanForm;
2425
}
2526

0 commit comments

Comments
 (0)