Repository navigation
Conversation
QueryModule.run_request wraps the call to a module's dict_handler in a bare except AttributeError, intending to catch modules that don't define dict_handler and fall back to the legacy handler(q=...) path. But that except clause also swallows any AttributeError raised from inside a working dict_handler implementation (e.g. a bug accessing a missing attribute on a response object), silently re-dispatching the request to handler(q=...) instead of surfacing the real error. The caller sees a confusing fallback response, or a second unrelated failure, instead of the actual exception and traceback. Replaced the try/except with an explicit hasattr check before calling dict_handler, so only modules that genuinely lack the method fall back to handler(q=...); a real AttributeError from within dict_handler now propagates normally. Verified with flake8 (clean) and the full pytest suite against a local modules server: 161 passed, 4 skipped, 5 subtests passed, matching the baseline. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018dfYpyaSZd1nxSRLr8suj8
Resolve the conflict in QueryModule.run_request: keep upstream's module_context wrapper and dispatch on hasattr(dict_handler) inside it, so an AttributeError raised inside a module's dict_handler is no longer masked. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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 — A bare
except AttributeErrorinrun_requestmasks real bugs inside a module'sdict_handler.QueryModule.run_requestinmisp_modules/__main__.pywraps thedict_handler()call in a bareexcept AttributeErrorto detect modules that lack one, which also swallows anyAttributeErrorraised inside a workingdict_handlerand silently re-dispatches to the legacyhandler(q=...)path.hasattr()check so only genuinely missing implementations fall back.dict_handlernow surface as errors rather than returning quietly different results through the fallback path.QueryModule.run_requestinmisp_modules/__main__.pyused a bareexcept AttributeErrorto detect modules that lack adict_handlerimplementation:The problem is that this
exceptcatches anyAttributeError, including one raised from inside a workingdict_handlerimplementation (e.g. aNone.somethingaccess on malformed input, or a missing attribute on an internal object). Such an error gets silently swallowed and the request is silently re-dispatched to the legacyhandler(q=...)path instead of failing loudly.Impact on a MISP user/analyst: a genuine bug in a module's
dict_handleris masked. The request appears to succeed via the fallback path (possibly with different/incomplete behavior or stale results) instead of surfacing an error, making the underlying defect much harder to detect and diagnose.Fix: replace the broad
except AttributeErrorwith an explicithasattr(MODULES_HANDLERS[module_name], "dict_handler")check before calling it. Only modules that genuinely lackdict_handlernow fall back tohandler(q=...); anyAttributeErrorraised from inside a realdict_handlerimplementation now propagates instead of being masked.This does not change behavior for any currently-working module (every module either has
dict_handleror doesn't); it only stops masking errors raised insidedict_handlerimplementations that do exist.Verification
flake8on the changed file: clean (no output)161 passed, 4 skipped, 5 subtests passed in 26.38sFound during a review of the repository; other findings are being submitted as separate PRs.
🤖 Generated with Claude Code