Skip to content

[low] Warn when --verbose-types is passed without a --list-* flag - #52

Open
elhoim wants to merge 1 commit into
MISP:mainfrom
elhoim:fix/45-verbose-types-inert
Open

[low] Warn when --verbose-types is passed without a --list-* flag#52
elhoim wants to merge 1 commit into
MISP:mainfrom
elhoim:fix/45-verbose-types-inert

Conversation

@elhoim

@elhoim elhoim commented Aug 31, 2026

Copy link
Copy Markdown
Member

BLUF — --verbose-types is silently inert outside the --list-* modes of bin/cli.py.

  • Problem--verbose-types is accepted by argparse in every mode of bin/cli.py but is only consumed by list_supported_types and list_active_modules; on the normal query path it changes nothing except forcing the describeTypes fetch, and the user gets no hint that the flag was inert.
  • Fix — Add a check right after argument parsing in main() that writes [!] --verbose-types has no effect without --list-supported-types or --list-active-modules to stderr in that case.
  • Effect — Users who mistype the invocation now see why the extra output never appeared; no other behaviour changes.

Finding 45 (Low) — bin/cli.py:792-796

Problem

--verbose-types is accepted in every mode but only consumed by list_supported_types/list_active_modules; in the normal query path it changes nothing except forcing the describeTypes fetch condition true, with no warning.

Fix

Finding #45 (verbose-types-inert, low severity): --verbose-types was accepted by argparse in every mode but only consumed by list_supported_types/list_active_modules. In the normal (non-list) query path, passing it had no effect other than forcing the describeTypes fetch condition true, with no indication to the user that the flag did nothing. Fix: added a check right after arg parsing in main() that emits a stderr warning ("[!] --verbose-types has no effect without --list-supported-types or --list-active-modules") when --verbose-types is passed without either --list-supported-types or --list-active-modules. Minimal 6-line addition, no other behavior changed.

Verification

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

Before
$ python3 bin/cli.py --verbose-types --url http://localhost:9999
STDOUT: (empty)
STDERR: [!] Unable to fetch module introspection from http://localhost:9999/modules: ...Connection refused...
(No indication that --verbose-types was ignored/inert in this mode.)
After
$ python3 bin/cli.py --verbose-types --url http://localhost:9999
STDOUT: (empty)
STDERR: [!] --verbose-types has no effect without --list-supported-types or --list-active-modules
[!] Unable to fetch module introspection from http://localhost:9999/modules: ...Connection refused...
(Warning now printed before the module-fetch attempt.)

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

Finding MISP#45 (verbose-types-inert): --verbose-types is accepted in every mode but only consumed by list_supported_types/list_active_modules. In the normal query path it silently forces the describeTypes fetch condition true with no effect and no warning, misleading users into thinking it changed behavior.

Fix: emit a stderr warning when --verbose-types is passed without --list-supported-types or --list-active-modules, so the inert flag is no longer silent.
@elhoim elhoim changed the title Warn when --verbose-types is passed without a --list-* flag [low] Warn when --verbose-types is passed without a --list-* flag Sep 3, 2026
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