Skip to content

fix(security): bandit covers src and tests at medium severity through one config the gate and the code-scanning upload share, and the test findings are fixed #1542

Closed

Description

@dan-petty

Requested by the owner, 2026-10-10: "have we run a full bandit scan against the codebase and noted all issues?" and "I'm just wondering because the scan failures just started and I want to make sure the codebase is actually covered".

Problem

Checked at release/v0.2.33 (5c5df79), the cut of v0.2.33, whose release pull request #1537 failed its bandit code-scanning check.

Owner decisions

  • Bandit covers src/ and tests/ at Medium severity and above, through one shared config used by both the gate and the code-scanning upload (2026-10-10).
  • It lands in v0.2.33, and every current Medium and High finding is fixed (2026-10-10).

Acceptance criteria

  • The gate and devops scan report --sarif read the same Bandit config and report the same findings on this repository. A test fails if they diverge.
  • Bandit at Medium and above over src/ and tests/ reports zero findings. Each finding is fixed in code (tmp_path instead of literal /tmp, 127.0.0.1 where a socket really binds). A # nosec <rule> with a reason is used only where the literal is what the test checks.
  • Review scans of other trees still read no config of the reviewed tree and still report # nosec lines.
  • The gate stays within its 5-minute budget, with the wall time measured.
  • changelog.d/<issue>.md.

Feasibility

Fits one pull request: one config table, two command builders, the test fixes and their tests.

Related: #419, #1537, #1538.

Activity

  1. added this to the v0.2.33 milestone on Oct 10, 2026
  2. added
    type/bug
    scope/security
    scope/ci
    on Oct 10, 2026
  3. dan-petty-bot commented on Oct 10, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item kept in v0.2.33: a person placed it in v0.2.33, and that placement stands.

    • Priority: P2-Medium. Owner-requested for the v0.2.33 release and the gate is currently passing, but the findings are in test fixtures rather than production code, so it is important but not a production vulnerability.
    • Value: Medium. Ensures consistent security scanning across the codebase and prevents future divergence between the gate and code-scanning upload, but the actual risk is limited to test-fixture literals.
    • Effort: Medium. Requires one shared config table, two command-builder updates, fixing 69 test findings across four rules, and a divergence test, all fitting in one pull request.
  4. dan-petty-bot commented on Oct 10, 2026

    @dan-petty-bot
    Collaborator

    What changed

    #1546, merged into release/v0.2.33 as a4bc008.

    Summary

    Closes #1542

    49 file(s) changed.

    How it was verified

    Check runs at 6413c78:

    • Prune PR DevContainer Images: pass
    • devops-cli: pass
    • bandit: pass
    • CodeQL: pass
    • Dependency Freshness: skipping
    • Analyze (actions): pass
    • Static Analysis: pass
    • Analyze (python): pass
    • Tests & Coverage: pass
    • Changed-Test Independence: pass
    • DevContainer Image: skipping
    • Service Image: skipping

    Acceptance Criteria of docs/agent/tasks/task-1542-bandit-covers-src-and-tests.md:

    • The gate's command and the SARIF scan's command name the same .bandit, threshold and -r, and neither ignores # nosec (tests/test_security_bandit.py).
    • A review scan reads no config of the reviewed tree and still reports # nosec lines (tests/test_security_bandit.py).
    • A tree whose .bandit names no targets, or names targets without recursive, still reports its findings (tests/test_security_bandit.py, checked with real bandit 1.9.4 on scratch trees).
    • uv run bandit --ini .bandit -r --severity-level medium reports 0 findings over src/ and tests/, and uv run devops ci security passes; a probe file with a /tmp path under tests/ makes it fail.
    • Bandit's wall time in the gate is about 37 s locally under load, up from about 21 s; the static job stays within the 5-minute budget.
    • changelog.d/1542.md holds the entry under ### Changed, and changelog.d/419.md is in house style under ### Added.
    • uv run devops ci is the pull request's gate.
    • Pending a person: on release pull request feat(release): v0.2.33 #1537, the bandit code-scanning check passes after this merges.

    Related: #419, #1537, #1538 (the Low findings in src/).

  5. added a commit that references this issue on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope/ciscope/securitytype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions