Skip to content

fix: render both listings when --list-supported-types and --list-active-modules are combined - #32

Open
elhoim wants to merge 1 commit into
MISP:mainfrom
elhoim:fix/40-both-list-flags
Open

fix: render both listings when --list-supported-types and --list-active-modules are combined#32
elhoim wants to merge 1 commit into
MISP:mainfrom
elhoim:fix/40-both-list-flags

Conversation

@elhoim

@elhoim elhoim commented Aug 31, 2026

Copy link
Copy Markdown
Member

Finding 40 (Low) — bin/cli.py:859-865

Problem

--list-supported-types is checked and returns before --list-active-modules is evaluated, so passing both silently produces only the first listing and exits 0 as if both ran.

Fix

Finding #40 (both-list-flags, low severity): in bin/cli.py's main(), the --list-supported-types branch returned 0 unconditionally before --list-active-modules was checked, so passing both flags together silently rendered only the supported-types listing and exited 0 as though both had run. Fixed by making the early return conditional on --list-active-modules not also being set, so when both flags are given, both listings render in sequence (supported types, then active modules) before returning 0; when only one flag is given, behavior is unchanged.

Verification

Reproduced against the unmodified code at 9b8c605, then re-checked after the change.

Before
Monkeypatched fetch_modules/fetch_describe_types and list_supported_types/list_active_modules to record calls, then ran with sys.argv = ["cli.py", "--list-supported-types", "--list-active-modules"]:
rc: 0
calls: ['supported_types']
(list_active_modules was never invoked despite being requested)
After
Same repro after the fix:
rc: 0
calls: ['supported_types', 'active_modules']
(both listings now render)

python bin/cli.py --help exits 0 and the module still imports cleanly. Verification was performed offline against the pure functions — no running misp-modules instance is required.

Branched from 9b8c605. This PR addresses only this finding; the other findings from the same review are in separate PRs, so they will need rebasing against each other as they merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DYX4TKA5inzByJ4qGWKjqh

…ve-modules are combined

Previously --list-supported-types returned before --list-active-modules was evaluated, so passing both flags silently produced only the first listing while still exiting 0 as if both had run. Now both listings render in sequence when both flags are given.
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