Skip to content

Misp restsearch error handling#3338

Merged
mlodic merged 7 commits into
intelowlproject:developfrom
lvb05:misp-restsearch-error-handling
Feb 22, 2026
Merged

Misp restsearch error handling#3338
mlodic merged 7 commits into
intelowlproject:developfrom
lvb05:misp-restsearch-error-handling

Conversation

@lvb05

@lvb05 lvb05 commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes incorrect success reporting in the MISP analyzer when the underlying misp_instance.search() (restSearch) request fails due to HTTP method mismatches (GET vs POST) or related API errors.
As discussed in #2480, PyMISP may raise HTTPError or return a MISPErrorResponse when the restSearch endpoint fails internally (e.g. server expecting POST but receiving GET).

Currently in IntelOwl:

  • These failures are caught generically
  • The analyzer proceeds by returning an empty result ({})
  • The analysis is incorrectly marked as SUCCESS

This leads to misleading UI output where a failed MISP query appears as "No results found" instead of indicating that the query itself failed.
Fixes #2480

This PR improves error handling around the misp_instance.search() call in:

api_app/analyzers_manager/observable_analyzers/misp.py

by:

  • Explicitly catching HTTPError and MISP API error responses
  • Surfacing meaningful execution errors to the analyzer layer
  • Preventing silent fallback to empty responses
  • Ensuring failed restSearch calls correctly propagate the failure state

This preserves existing logic while improving analyzer correctness and debugging visibility without introducing breaking changes.

Unit tests have been updated accordingly to validate improved failure reporting behaviour.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue).

Checklist

  • I have read and understood the rules about how to Contribute to this project
  • The pull request is for the branch develop
  • Please avoid adding new libraries as requirements whenever it is possible.
  • Linters (Ruff) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.
  • I have added tests for the feature/bug I solved (see tests folder). All the tests (new and old ones) gave 0 errors.
  • After you had submitted the PR, if DeepSource, Django Doctors or other third-party linters have triggered any alerts during the CI checks, I have solved those alerts.

Copilot AI review requested due to automatic review settings February 20, 2026 10:25
@lvb05 lvb05 changed the base branch from master to develop February 20, 2026 10:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request aims to fix MISP analyzer error handling for HTTP method mismatches, but contains extensive additional changes including a new MachoInfo analyzer, system update checker, YETI API updates, URLScan domain support, InQuest improvements, frontend modifications, and test infrastructure enhancements.

Changes:

  • Fixed MISP analyzer to properly raise exceptions for GET/POST mismatch errors instead of silently failing
  • Added MachoInfo analyzer for parsing Mach-O binaries (macOS/iOS executables)
  • Implemented system update checker with weekly scheduled checks and admin notifications
  • Updated YETI analyzer/connector to use v2 API endpoints with breaking changes
  • Enhanced URLScan to support domain observables by prepending https://
  • Improved InQuest generic observable type detection with comprehensive regex patterns
  • Added TLPTag frontend component improvements and test coverage
  • Enhanced test infrastructure with better mocking and async task handling

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
api_app/analyzers_manager/observable_analyzers/misp.py Added specific error handling for GET/POST mismatch with helpful debug info
tests/api_app/analyzers_manager/unit_tests/observable_analyzers/test_misp.py Added test for restsearch GET/POST error
api_app/analyzers_manager/file_analyzers/macho_info.py New analyzer for Mach-O binary analysis
api_app/core/update_checker.py New module for checking IntelOwl version updates
api_app/core/tasks.py New Celery task for scheduled update checks
api_app/models.py Added UpdateCheckStatus model for tracking version state
api_app/serializers/system.py New serializer for system update status API
api_app/views.py Added endpoint for system update check
api_app/urls.py Registered system update check endpoint
frontend/src/components/common/SystemUpdatePanel.jsx New component for displaying update notifications
frontend/src/components/common/TLPTag.jsx Enhanced with unique IDs and proper text colors
api_app/analyzers_manager/observable_analyzers/yeti.py Updated to YETI v2 API with breaking changes
api_app/connectors_manager/connectors/yeti.py Added timeout to YETI connector
api_app/analyzers_manager/observable_analyzers/urlscan.py Added domain support by prepending https://
api_app/analyzers_manager/observable_analyzers/inquest.py Improved generic type detection with comprehensive regex
api_app/analyzers_manager/file_analyzers/blint_scan.py Added patch to avoid RecursionError on Mach-O files
api_app/visualizers_manager/visualizers/crawl_results.py New visualizer for URLScan crawl results
requirements/project-requirements.txt Added machofile==2026.2.4 dependency
docker/scripts/watchman_install.sh Updated Watchman to v2026.02.02.00
docker/Dockerfile Changed WATCHMAN from ARG to ENV
intel_owl/settings/_util.py Added fallback for environments without www-data user
tests/* Multiple test files enhanced with better mocking and coverage

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread api_app/analyzers_manager/observable_analyzers/misp.py Outdated
Comment thread tests/api_app/analyzers_manager/unit_tests/observable_analyzers/test_misp.py Outdated
Copilot AI review requested due to automatic review settings February 21, 2026 06:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings February 22, 2026 07:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread api_app/analyzers_manager/observable_analyzers/misp.py
Copilot AI review requested due to automatic review settings February 22, 2026 09:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread api_app/analyzers_manager/observable_analyzers/misp.py
@lvb05

lvb05 commented Feb 22, 2026

Copy link
Copy Markdown
Contributor Author

Hi @mlodic @fgibertoni
The MISP restSearch GET/POST mismatch handling has been updated with improved error messaging and optional debug details. Unit tests have been added (normal + debug mode), and all checks pass locally.
Kindly let me know if anything else should be adjusted.

  • image
  • Screenshot 2026-02-22 115635

@mlodic mlodic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, thanks for adding this and restructuring the code

@mlodic mlodic merged commit 43485dd into intelowlproject:develop Feb 22, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MISP - integration - invalid GET instead of POST request is being sent

3 participants