Repository navigation
fix: [ismalicious] count threat listings only, read categories per listing, add docs - #910
Merged
Merged
Conversation
…sting, add docs The /check response has no top-level `categories` for IPs, domains and URLs: each listing in `sources` carries its own `category`/`categories`, so the summary always fell back to `classification.primary`. Categories are now collected from the listings. Listings also carry a `threatClass`. Only `threat` (the default when absent) says an indicator was seen doing something malicious; `infrastructure` (cloud and CDN ranges, Tor exits, DoH resolvers), `policy` and `allowlist` listings describe what it is. They no longer feed the categories or the source count, so a cloud egress IP is not reported as "sources=1". Also: - do not follow redirects (requests would resend X-API-KEY to the new location) and say so when api_url answers with one; - explicit messages for 401 (rejected key) and 429 (rate limit/quota); - User-Agent `ismalicious-misp/<version>`; - module listed in README.md and the generated documentation, with logo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-up to #798 (the isMalicious expansion/hover module). Disclosure: I maintain isMalicious.
What was wrong
/checkresponse has no top-levelcategoriesfor IPs, domains and URLs; each listing insourcescarries its owncategory/categories(API reference). The summary therefore always fell back toclassification.primary. Categories are now collected from the listings, with the same fallback.threatClass:threat(the default when absent),infrastructure(cloud and CDN ranges, Tor exits, DoH resolvers),policy(ads, tracking) orallowlist. Onlythreatlistings mean the indicator was seen doing something malicious. A cloud egress IP listed only in a provider's published ranges used to come back assources=1; it now readssources=0, and those listings no longer contribute categories.Also in this PR
allow_redirects=False):requestswould otherwise resend theX-API-KEYheader to the new location. A 3xx (e.g.api_urlset tohttp://) returns an explicit error.User-Agent: ismalicious-misp/<version>instead of the genericmisp-modules, so the API can tell this module's calls apart. Module version 1.0 → 1.1.README.mdand the generated docs. Added the entry toREADME.md,documentation/mkdocs/index.md, and the blocks todocumentation/README.md/documentation/mkdocs/expansion.md(produced withdocumentation/generate.py's own_generate_doc/_generate_index_docfor this module only, so the rest of the generated files is untouched), plusdocumentation/logos/ismalicious.png.requirementsmetadata now says which value to paste: theX-API-KEYvalue (Base64 ofapiKey:apiSecret) shown on the account page.No new dependency. Input types, config keys (
api_key,api_url) and output format (misp_standard, one text attribute) are unchanged.Verification
pytest tests/test_ismalicious.py: 12 passed (HTTP mocked; new cases for per-listing categories, threat-only counting, the classification fallback, 401/429, redirect refusal, transport failure, User-Agent).flake8 misp_modules/modules/expansion/ismalicious.py: clean.black --checkandisort --check-onlyon both files: unchanged.🤖 Generated with Claude Code