Skip to content

Commit 0f1b7c9

Browse files
committed
Allow archive_only in file similar API
1 parent 5a50f61 commit 0f1b7c9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

assemblyline_ui/api/v4/file.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,7 @@ def find_similar_files(sha256, **kwargs):
913913
914914
Arguments:
915915
use_archive => Also find similar file in archive
916+
archive_only => Only find similar in the malware archive
916917
917918
Data Block:
918919
None
@@ -933,11 +934,14 @@ def find_similar_files(sha256, **kwargs):
933934
"""
934935
user = kwargs['user']
935936
use_archive = request.args.get('use_archive', 'false').lower() in ['true', '']
937+
archive_only = request.args.get('use_archive', 'false').lower() in ['true', '']
936938

937-
if use_archive and ROLES.archive_view not in user['roles']:
939+
if (use_archive or archive_only) and ROLES.archive_view not in user['roles']:
938940
return make_api_response({}, "User is not allowed to view the archive", 403)
939941

940-
if use_archive:
942+
if archive_only:
943+
index_type = Index.ARCHIVE
944+
elif use_archive:
941945
index_type = Index.HOT_AND_ARCHIVE
942946
else:
943947
index_type = Index.HOT

0 commit comments

Comments
 (0)