From 2e11b04b6c4c731032aa83d699e2f0d9e38ce1bc Mon Sep 17 00:00:00 2001 From: Terrtia Date: Thu, 6 Apr 2023 16:18:06 +0200 Subject: [PATCH] fix: [correlation] fix UI cve, decoded tags --- bin/lib/objects/ail_objects.py | 2 +- var/www/blueprints/correlation.py | 7 ++-- .../correlation/metadata_card_cve.html | 36 +++++++++---------- .../correlation/show_correlation.html | 10 +++--- 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/bin/lib/objects/ail_objects.py b/bin/lib/objects/ail_objects.py index 8040b721..8eaf84d8 100755 --- a/bin/lib/objects/ail_objects.py +++ b/bin/lib/objects/ail_objects.py @@ -158,7 +158,7 @@ def get_object_card_meta(obj_type, subtype, id, related_btc=False): meta["vt"] = obj.get_meta_vt() meta["vt"]["status"] = obj.is_vt_enabled() # TAGS MODAL - if obj.get_type() == 'screenshot' or obj.get_type() == 'decoded': + if obj.get_type() == 'screenshot' or obj.get_type() == 'decoded' or obj.get_type() == 'cve': meta["add_tags_modal"] = Tag.get_modal_add_tags(obj.id, obj.get_type(), obj.get_subtype(r_str=True)) return meta diff --git a/var/www/blueprints/correlation.py b/var/www/blueprints/correlation.py index bde820ad..48388995 100644 --- a/var/www/blueprints/correlation.py +++ b/var/www/blueprints/correlation.py @@ -124,7 +124,8 @@ def show_correlation(): "correlation_id": obj_id, "max_nodes": max_nodes, "mode": mode, "filter": filter_types, "filter_str": ",".join(filter_types), - "metadata": ail_objects.get_object_meta(obj_type, subtype, obj_id, flask_context=True) + "metadata": ail_objects.get_object_meta(obj_type, subtype, obj_id, + options={'tags'}, flask_context=True) } if subtype: dict_object["metadata"]['type_id'] = subtype @@ -156,7 +157,9 @@ def get_description(): return Response(json.dumps({"status": "error", "reason": "404 Not Found"}, indent=2, sort_keys=True), mimetype='application/json'), 404 # object exist else: - res = ail_objects.get_object_meta(object_type, type_id, correlation_id, flask_context=True) + res = ail_objects.get_object_meta(object_type, type_id, correlation_id, options={'tags'}, flask_context=True) + if 'tags' in res: + res['tags'] = list(res['tags']) return jsonify(res) @correlation.route('/correlation/graph_node_json') diff --git a/var/www/templates/correlation/metadata_card_cve.html b/var/www/templates/correlation/metadata_card_cve.html index 1abd1a84..1e64008c 100644 --- a/var/www/templates/correlation/metadata_card_cve.html +++ b/var/www/templates/correlation/metadata_card_cve.html @@ -1,9 +1,9 @@ -{#{% with modal_add_tags=dict_object['metadata_card']['add_tags_modal']%}#} -{# {% include 'modals/add_tags.html' %}#} -{#{% endwith %}#} +{% with modal_add_tags=dict_object['metadata_card']['add_tags_modal']%} + {% include 'modals/add_tags.html' %} +{% endwith %} {% include 'modals/edit_tag.html' %} @@ -99,21 +99,21 @@ {% endif %} {% endif %} -{#
  • #} -{#
    #} -{#
    #} -{# Tags:#} -{# {% for tag in dict_object["metadata"]['tags'] %}#} -{# #} -{# {% endfor %}#} -{# #} -{#
    #} -{#
  • #} +
  • +
    +
    + Tags: + {% for tag in dict_object["metadata"]['tags'] %} + + {% endfor %} + +
    +
  • {% with obj_type='cve', obj_id=dict_object['correlation_id'], obj_subtype='' %} diff --git a/var/www/templates/correlation/show_correlation.html b/var/www/templates/correlation/show_correlation.html index 636b8848..07536556 100644 --- a/var/www/templates/correlation/show_correlation.html +++ b/var/www/templates/correlation/show_correlation.html @@ -535,16 +535,16 @@ if (d.popover) { }); desc = desc + "" - if (data["img"]) { - desc = desc + ""; - } - - if (data["tags"]) { + if (data["tags"]) { data["tags"].forEach(function(tag) { desc = desc + ""+ sanitize_text(tag) +""; }); } + if (data["img"]) { + desc = desc + ""; + } + desc = desc + "" div.html(desc) .style("left", (d3_pageX) + "px")