Repository navigation
Conversation
Both failure paths of the McAfee MVISION Insights module called sys.exit(), which raises SystemExit inside the long-running modules server: any bad IAM credential or non-2xx /insights/v2/iocs response tears down the request handling thread instead of reporting the failure, and the analyst gets a generic "something went wrong" with no explanation. On top of that, search_ioc() fell through with no return when the API replied with an empty data set, so a hash simply unknown to MVISION reached prep_result(None) and crashed with TypeError. Both failure paths now raise a dedicated MVAPIError that the handler converts into misperrors, and the empty result set is returned explicitly as None and reported by prep_result as a plain message. Verified with flake8 on the changed file and the full test suite against a local modules server: 161 passed, 4 skipped, 5 subtests passed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018dfYpyaSZd1nxSRLr8suj8
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BLUF — An API error in
mcafee_insights_enrichno longer tears down the whole misp-modules server.expansion/mcafee_insights_enrich.pycallssys.exit()on an IAM auth failure and on a non-200 fromsearch_ioc, but modules run inside a long-running Twisted server, so theSystemExitkills the whole process and every other in-flight enrichment; separately an emptydatalist fell through and returnedNoneintoprep_result(), raisingTypeError.MVAPIErrorthathandler()converts into a normalmisperrorsresponse, the empty branch returnsNoneexplicitly, andprep_result()reports that as an error.The defect
misp_modulesruns the expansion modules inside a long-running Twisted server process. Callingsys.exit()from inside a request handler raisesSystemExit, which propagates up and kills the whole modules server, not just the one request — every other in-flight enrichment lookup on the server goes down with it. A single McAfee Insights auth failure or a non-200 response fromsearch_iocwas enough to take out the entire server process.Separately, when
search_ioc()got a 200 response with an emptydatalist it logged a message but fell through with noreturn, so it returnedNoneimplicitly. ThatNonewas then passed straight intoprep_result(ioc), which doesioc["data"][0]and raises an unhandledTypeError.Impact
An analyst enriching an attribute with the MVISION Insights module hits a transient auth error, an HTTP error from the McAfee API, or simply a hash with no results, and the misp-modules server crashes or throws an unhandled exception instead of returning a normal "no results" / error response to MISP. Every other module running on that server instance is disrupted until it's restarted.
The fix
Both
sys.exit()calls now raise a dedicatedMVAPIError, whichhandler()catches and converts into a normalmisperrorsresponse instead of tearing down the process. The empty-result branch ofsearch_ioc()now returnsNoneexplicitly, andprep_result()checks forNoneand reports it as amisperrorsmessage instead of crashing with aTypeError. No behaviour change for the success path — only the error paths now degrade gracefully instead of taking the server down.Verification
flake8 --extend-exclude=misp_modules/lib/,tests/,website/on the changed file: clean, no output.Found during a review of the repository; other findings are being submitted as separate PRs.
🤖 Generated with Claude Code