From 10c5972629e276601d73d7ba2bd114ff8a63c850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Stucke?= Date: Tue, 19 Aug 2025 13:25:17 +0200 Subject: [PATCH] feat: added UID support to quick search directly leads to the analysis page --- src/test/unit/web_interface/test_quick_search.py | 5 +++++ src/web_interface/components/database_routes.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/test/unit/web_interface/test_quick_search.py b/src/test/unit/web_interface/test_quick_search.py index f0d702f3c..b0f662ccf 100644 --- a/src/test/unit/web_interface/test_quick_search.py +++ b/src/test/unit/web_interface/test_quick_search.py @@ -55,6 +55,11 @@ def test_quick_search_vendor(self, test_client): def test_quick_search_sha256(self, test_client): assert TEST_FW_2.uid in _start_quick_search(test_client, TEST_FW_2.sha256) + def test_quick_search_uid(self, test_client): + response = _start_quick_search(test_client, TEST_FW_2.uid) + assert TEST_FW_2.uid in response + assert 'Analysis Results' in response # this should lead directly to the analysis page + def test_quick_search_tags(self, test_client): assert TEST_FW_2.uid in _start_quick_search(test_client, list(TEST_FW_2.tags)[0]) diff --git a/src/web_interface/components/database_routes.py b/src/web_interface/components/database_routes.py index bb4d00901..c70c76caf 100644 --- a/src/web_interface/components/database_routes.py +++ b/src/web_interface/components/database_routes.py @@ -346,6 +346,8 @@ def start_quick_search(self): search_term = filter_out_illegal_characters(request.args.get('search_term')) if search_term is None: return render_template('error.html', message='Search string not found') + if is_uid(search_term) and self.db.frontend.exists(search_term): + return redirect(url_for('show_analysis', uid=search_term)) query = { '$or': { 'device_name': {'$like': search_term},