Skip to content

fix: [export_mod/goamlexport] fix typo'd dict name in introspection() - #889

Open
elhoim wants to merge 1 commit into
MISP:mainfrom
elhoim:fix/080-goamlexport-modulesetup-typo
Open

fix: [export_mod/goamlexport] fix typo'd dict name in introspection()#889
elhoim wants to merge 1 commit into
MISP:mainfrom
elhoim:fix/080-goamlexport-modulesetup-typo

Conversation

@elhoim

@elhoim elhoim commented Aug 31, 2026

Copy link
Copy Markdown
Member

misp_modules/modules/export_mod/goamlexport.py's introspection() has a typo that writes to the wrong dict name:

try:
    inputSource
    moduleSetup["inputSource"] = inputSource
except NameError:
    pass
return modulesetup

moduleSetup (capital S) does not exist anywhere in the function — the dict actually built and returned is modulesetup. Today this is latent: the bare inputSource reference on the preceding line raises NameError first (since inputSource is never defined at module scope), so the buggy assignment is never reached. But if inputSource were ever defined at module scope, the function would crash with NameError: name 'moduleSetup' is not defined instead of returning module setup info, breaking introspection() for this export module and anything depending on its output (e.g. the misp-modules server's module listing).

Fix: changed moduleSetup to modulesetup so the assignment targets the dict that is actually built and returned, matching the pattern used by the other three try/except NameError blocks in the same function.

No behaviour change for the current codebase (the branch is unreachable as written); this only prevents a future crash if inputSource is ever added.

Verification

  • flake8 on the changed file: clean (exit 0)
  • Full module test suite: 161 passed, 4 skipped, 5 subtests passed in 27.64s

Found during a review of the repository; other findings are being submitted as separate PRs.

🤖 Generated with Claude Code

https://claude.ai/code/session_018dfYpyaSZd1nxSRLr8suj8

introspection() builds its result in a dict named modulesetup, but the
inputSource branch assigns into moduleSetup instead (wrong capitalization).
This is currently latent because the preceding `inputSource` bare-name
existence check already raises NameError and is caught, so the buggy line
never executes today; but the moment a caller defines module-level
inputSource, the function would raise NameError('moduleSetup is not
defined') instead of returning the introspection dict with inputSource
included, breaking module setup reporting for any export module relying on
that field.

Verified with flake8 (clean) and the full pytest suite against a live
misp-modules server on port 6780: 161 passed, 4 skipped, 5 subtests passed,
matching baseline.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018dfYpyaSZd1nxSRLr8suj8
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.

1 participant