Skip to content

Commit 1e74e36

Browse files
committed
Fix classification propagation and display
1 parent 369ee29 commit 1e74e36

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

assemblyline_ui/api/v4/file.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,9 @@ def get_file_results(sha256, **kwargs):
434434
return make_api_response({}, "This file does not exists", 404)
435435

436436
if user and Classification.is_accessible(user['classification'], file_obj['classification']):
437+
max_c12n = file_obj['classification']
437438
output = {
438-
"file_info": {},
439+
"file_info": file_obj,
439440
"results": [],
440441
"tags": {},
441442
"attack_matrix": {},
@@ -455,13 +456,13 @@ def get_file_results(sha256, **kwargs):
455456
output['childrens'] = res_children.result()
456457
output['metadata'] = res_meta.result()
457458

458-
output['file_info'] = file_obj
459459
output['results'] = []
460460
output['alternates'] = {}
461461
res = STORAGE.result.multiget(active_keys, as_dictionary=False, as_obj=False)
462462
for r in res:
463463
res = format_result(user['classification'], r, file_obj['classification'], build_hierarchy=True)
464464
if res:
465+
max_c12n = Classification.max_classification(max_c12n, res['classification'])
465466
output['results'].append(res)
466467

467468
for i in alternates:
@@ -526,6 +527,7 @@ def get_file_results(sha256, **kwargs):
526527

527528
output['signatures'] = list(output['signatures'])
528529

530+
output['file_info']['classification'] = max_c12n
529531
return make_api_response(output)
530532
else:
531533
return make_api_response({}, "You are not allowed to view this file", 403)

assemblyline_ui/api/v4/submission.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,15 @@ def get_file_submission_results(sid, sha256, **kwargs):
119119
if not Classification.is_accessible(user['classification'], temp_file['classification']):
120120
return make_api_response("", "You are not allowed to view the data of this file", 403)
121121
output['file_info'] = temp_file
122+
max_c12n = output['file_info']['classification']
122123

123124
temp_results = list(STORAGE.get_multiple_results([x for x in res_keys if x.startswith(sha256)],
124125
cl_engine=Classification, as_obj=False).values())
125126
results = []
126127
for r in temp_results:
127128
r = format_result(user['classification'], r, temp_file['classification'], build_hierarchy=True)
128129
if r:
130+
max_c12n = Classification.max_classification(max_c12n, r['classification'])
129131
results.append(r)
130132
output['results'] = results
131133

@@ -186,6 +188,7 @@ def get_file_submission_results(sid, sha256, **kwargs):
186188

187189
output['signatures'] = list(output['signatures'])
188190

191+
output['file_info']['classification'] = max_c12n
189192
return make_api_response(output)
190193
else:
191194
return make_api_response("", "You are not allowed to view the data of this submission", 403)

assemblyline_ui/static/ng-template/file_detail.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ <h5 ng-show="current_file.name" class="text-muted">{{current_file.name | split}}
220220
<li class="small" ng-repeat="a in current_file.alternates[res.response.service_name]" ng-class="{disabled: a.created==res.created}"><a ng-click="select_alternate(a.response.service_name, a.created);$event.stopPropagation();">{{a.response.service_name}} :: {{a.response.service_version}} :: [{{a.result.score}}] @ {{a.created | date:"yyyy-MM-dd HH:mm:ss"}}</a></li>
221221
</ul>
222222
</div>
223-
<strong><span ng-if="res.result.classification" class="{{res.result.classification | class_text_color }}" >({{res.result.classification | class_sm}})&nbsp;</span>{{res.response.service_name}}</strong>&nbsp;[<span class="{{res.result.score | score_color}}"><strong>{{res.result.score}}</strong></span>]&nbsp;<span class="text-muted">:: {{res.response.service_version}}<span ng-show="res.response.service_context"> ({{res.response.service_context}})</span></span>
223+
<strong><span ng-if="res.classification" class="{{res.classification | class_text_color }}" >({{res.classification | class_sm}})&nbsp;</span>{{res.response.service_name}}</strong>&nbsp;[<span class="{{res.result.score | score_color}}"><strong>{{res.result.score}}</strong></span>]&nbsp;<span class="text-muted">:: {{res.response.service_version}}<span ng-show="res.response.service_context"> ({{res.response.service_context}})</span></span>
224224
</div>
225225
<div id="{{res.response.service_name}}_content" class="content collapse" ng-class="{'in': res.result.score >= settings.expand_min_score || res.response.service_name == switch_service }">
226226
<div ng-if="res.result.sections.length == 0" >
@@ -286,7 +286,7 @@ <h5 ng-show="current_file.name" class="text-muted">{{current_file.name | split}}
286286
<li class="small" ng-repeat="a in current_file.alternates[res.response.service_name]" ng-class="{disabled: a.created==res.created}"><a ng-click="select_alternate(a.response.service_name, a.created);$event.stopPropagation();">{{a.response.service_name}} :: {{a.response.service_version}} <span ng-show="a.response.service_context"> ({{a.response.service_context}}) </span>:: [{{a.result.score}}] @ {{a.created | date:"yyyy-MM-dd HH:mm:ss"}}</a></li>
287287
</ul>
288288
</div>
289-
<strong><span ng-if="res.result.classification" class="{{res.result.classification | class_text_color }}" >({{res.result.classification | class_sm}})&nbsp;</span>{{res.response.service_name}}</strong>&nbsp;[<span class="{{res.result.score | score_color}}"><strong>{{res.result.score}}</strong></span>]&nbsp;<span class="text-muted">:: {{res.response.service_version}}<span ng-show="res.response.service_context"> ({{res.response.service_context}})</span></span>
289+
<strong><span ng-if="res.classification" class="{{res.classification | class_text_color }}" >({{res.classification | class_sm}})&nbsp;</span>{{res.response.service_name}}</strong>&nbsp;[<span class="{{res.result.score | score_color}}"><strong>{{res.result.score}}</strong></span>]&nbsp;<span class="text-muted">:: {{res.response.service_version}}<span ng-show="res.response.service_context"> ({{res.response.service_context}})</span></span>
290290
</div>
291291
<div id="{{res.response.service_name}}_content" class="content collapse" ng-class="{'in': res.result.score >= settings.expand_min_score || res.response.service_name == switch_service }">
292292
<div ng-if="res.result.sections.length == 0" >

0 commit comments

Comments
 (0)