Skip to content

fix(policy): gate MalwareBazaar test-module by default - #19

Merged
omercnet merged 1 commit into
mainfrom
fix/default-test-module-gating
Nov 10, 2026
Merged

omercnet merged 1 commit into
mainfrom
fix/default-test-module-gating

Conversation

@omercnet

@omercnet omercnet commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Closes #18.

With an Auth-Key set, MalwareBazaar's test-module posts a public comment ("test comment") on a sample. dbot's default read list includes test-module, so any MalwareBazaar instance without its own override let an analyst trigger that write without approval.

Decision

Q2 on the progress dashboard, option A: dbot ships built-in per-integration defaults. Rejected alternatives:

  • Gate every test-module unless on a safe list: routine health checks would all need approval.
  • A startup warning only: relies on someone reading it.

Changes

  • dbot/control/config.py: INTEGRATION_DESTRUCTIVE = {"MalwareBazaar": ["test-module"]}, keyed by the catalog integration name.
  • dbot/control/policy.py: new precedence step 3. The order is instance read, instance destructive, built-in per-integration destructive, execution: true, global destructive, global read, else destructive. Global policy can't lift a built-in entry; an instance policy.read can, if the operator accepts the write.
  • deploy/dbot.yaml.example: the malwarebazaar instance no longer needs policy: {destructive: [test-module]}. The certified test (test_module_risk="destructive") now verifies the built-in rule instead of the example override.
  • docs/configuration.md: precedence list and a note on the built-in list.
  • Tests: gated with default policy, case-insensitive, global read: ["*"] can't lift it, other integrations and other MalwareBazaar commands unaffected, instance read lifts it.

Verification

  • Locally, the non-Docker suite passes (286), and ruff is clean. mypy shows only the pre-existing tests/control/test_approvals.py:32 error.
  • I couldn't run the Docker-backed certified suite locally: sandbox containers on this host can't reach the docker bridge (it fails on clean main too). CI runs it.

Summary by CodeRabbit

  • New Features

    • MalwareBazaar’s test-module command is classified as destructive by default, even when global rules allow read-only commands. Matching is case-insensitive, and an instance-level read policy can override this classification.
  • Documentation

    • Clarified how built-in destructive-command rules interact with instance, integration, and global policies.

With an Auth-Key set, MalwareBazaar's test-module posts a public comment on a
sample. The global read list let any analyst run it without approval unless the
config overrode it per instance.

dbot now ships INTEGRATION_DESTRUCTIVE, a built-in per-integration list applied
after the instance overrides and before the execution flag and global globs.
Only an instance's policy.read can lift an entry. The example config no longer
needs its own override.

Closes #18
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The policy classifier now treats MalwareBazaar’s test-module command as destructive by default. An instance-level policy.read can override that classification. The example configuration, policy documentation, and tests reflect the behavior.

Changes: Integration Policy

Layer / File(s) Summary
Define and apply built-in classification
dbot/control/config.py, dbot/control/policy.py, tests/control/test_config_secrets_policy.py
A built-in rule marks MalwareBazaar’s test-module command as destructive after instance policy checks. Tests cover global read rules, other commands and integrations, calls without an instance, and an instance-level read override.
Document default policy behavior
deploy/dbot.yaml.example, docs/configuration.md, tests/certified/specs.py
The example removes its explicit destructive rule. The documentation and spec comment describe the built-in default and its policy precedence.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

  • omercnet/dbot#17: Adds MalwareBazaar certified coverage for test-module and sets the shipped instance policy for that command.
Merge Risk: Minimal · up to 5c7ed

MalwareBazaar’s test-module is gated by default, with an explicit instance override available. No merge-blocking issue was established.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly states the main change: DBot gates MalwareBazaar’s test-module command by default.
Linked Issues check Passed Issue #18 requires MalwareBazaar test-module to require approval by default, including without an instance override. INTEGRATION_DESTRUCTIVE adds the command for MalwareBazaar, and risk() appl…
Out of Scope Changes check Passed All changes support issue #18: the policy entry and precedence implement the default gate, the tests verify its scope and overrides, and the example configuration, certified-test note, and documentati…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

Issue #18 requires MalwareBazaar test-module to require approval by default, including without an instance override. INTEGRATION_DESTRUCTIVE adds the command for MalwareBazaar, and risk() applies it after instance policy checks but before global policy. The tests cover default and case-insensitive matching, global read rules, other integrations and commands, calls without an instance, and the instance policy.read override. The example config and documentation reflect this behavior.

Full details: Out of Scope Changes check

Explanation

All changes support issue #18: the policy entry and precedence implement the default gate, the tests verify its scope and overrides, and the example configuration, certified-test note, and documentation describe the change. No unrelated changes are present in the reviewed diff.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 4 files. (1 skipped: 1 unsupported.)

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 1e7e77da-218e-4c04-8942-638499911ac7
Commits

Reviewing files that changed from the base of the PR and between f265cc7 and 5c7edd4.

Files selected for processing: 6

  • dbot/control/config.py
  • dbot/control/policy.py
  • deploy/dbot.yaml.example
  • docs/configuration.md
  • tests/certified/specs.py
  • tests/control/test_config_secrets_policy.py
Files with no reviewable changes: 1

  • deploy/dbot.yaml.example

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@omercnet
omercnet merged commit 8e963df into main Nov 10, 2026
7 checks passed
@omercnet
omercnet deleted the fix/default-test-module-gating branch November 10, 2026 15:48
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.

Gate MalwareBazaar test-module by default (it posts a public comment)

1 participant