Skip to content

fix(types): treat offline-alert and inventory source_error codes as analyst sentences - #16

Merged
batuhanisildak-malwation merged 2 commits into
mainfrom
fix/offline-alert-sentences
Nov 13, 2026
Merged

batuhanisildak-malwation merged 2 commits into
mainfrom
fix/offline-alert-sentences

Conversation

@batuhanisildak-malwation

@batuhanisildak-malwation batuhanisildak-malwation commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What

The public API no longer sends internal codes in two groups of fields. The SDK still typed and documented both groups as codes.

  1. Offline-scan alerts. Malwation/threatzone#2335 changed submissionOnlyAlerts.scope and .source in GET /submissions/:uuid/network/summary. They used to be the documented codes submission_unattributed and pinned_offline_eve. Now each one is an analyst sentence or null:

    • scope: "These alerts are not linked to a process of the run."
    • source: "A scan of the full network capture made these alerts after the run ended."

    The SDK declared both fields as required str, so a null would make get_network_summary() fail validation.

  2. Inventory source_error. In GET /submissions/:uuid/killchain, artifactInventoryCoverage.sourceError is one sentence for every cause, or null:

    • #2335 added sidecar_dir_missing → "Not available because the file capture folder was missing".
    • Any cause without its own sentence becomes "Not available because the file capture could not be read".

    KillchainInventorySourceError still listed eight codes.

Changes

  • NetworkSubmissionOnlyAlerts.scope and .source are now str | None = None. Their docstrings call them analyst sentences, not codes.
  • KillchainInventorySourceError is now str. The exported name stays, so imports do not break. Its docstring and the source_error docstring describe free text and give the example sentence. Parsing is unchanged: any string still parses.
  • docs/TYPES.md: both entries describe sentences or None and no longer list codes.
  • CHANGELOG.md: added two Unreleased → Changed entries.
  • Tests: the network fixture uses the new sentences. Two new tests cover null or missing scope/source and a sentence in source_error.

Nothing else in src/, docs/, examples/ or the README matches on the old code values. attribution_reason, availability.reason and retention_detail were already str | None, and their docs list no codes.

Verification

All four CI gates pass locally:

  • uv run ruff check src/ tests/: clean.
  • uv run ruff format --check src/ tests/: clean.
  • uv run mypy src/threatzone: no issues.
  • uv run pytest tests/: 1407 passed.

The public API now sends NetworkSubmissionOnlyAlerts.scope and .source
as one analyst sentence each, or null, in place of the codes
submission_unattributed and pinned_offline_eve. Make both fields
optional so get_network_summary() parses a null value, and document
them as sentences that callers should not match on.
The public API sends KillchainInventoryCoverage.source_error as one
analyst sentence, or null, for every cause, for example "Not available
because the file capture folder was missing" for sidecar_dir_missing.
KillchainInventorySourceError still listed the internal codes. Make it
plain str and document the field as free text that callers should not
match on. Parsing is unchanged.
@batuhanisildak-malwation batuhanisildak-malwation changed the title fix(types): accept null sentences in offline-scan alert scope and source fix(types): treat offline-alert and inventory source_error codes as analyst sentences Nov 13, 2026
@batuhanisildak-malwation
batuhanisildak-malwation merged commit db48d6e into main Nov 13, 2026
7 checks passed
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