Fix --show-guesses being silently skipped when --type is given - #34
Open
elhoim wants to merge 1 commit into
Open
Fix --show-guesses being silently skipped when --type is given#34elhoim wants to merge 1 commit into
elhoim wants to merge 1 commit into
Conversation
Finding MISP#11 (show-guesses-noop): the --show-guesses display block was nested inside the else: branch of 'if args.attr_type:', so passing --type together with --show-guesses produced no output and no explanation that guessing was bypassed. Add an explicit log() message in the args.attr_type branch so users get feedback that --show-guesses was skipped because --type was explicitly provided, instead of silent no-op behaviour.
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.
Finding 11 (High) —
bin/cli.py:910Problem
The --show-guesses block is nested inside the else: of 'if args.attr_type:' (:905), so '--type ip-src --value 1.2.3.4 --show-guesses' prints nothing and gives no explanation.
Fix
Fixed finding #11 (show-guesses-noop, high severity). In bin/cli.py's main(), the --show-guesses display block (guess listing/logging) was nested entirely inside the
else:branch ofif args.attr_type:. This meant running the CLI with both --type and --show-guesses (e.g.--type ip-src --value 1.2.3.4 --show-guesses) silently skipped the guess block with zero output or explanation — a confusing no-op for users who expect --show-guesses to always report something. The fix hoists a minimal log() call into theif args.attr_type:branch so users are told "--show-guesses skipped: --type was explicitly provided, so no guessing was performed." No other behavior was changed; guessing logic and the existing else-branch guess-display code are untouched.Verification
Reproduced against the unmodified code at
9b8c605, then re-checked after the change.Before
After
python bin/cli.py --helpexits 0 and the module still imports cleanly. Verification was performed offline against the pure functions — no runningmisp-modulesinstance 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