Skip to content

[GOOD FIRST ISSUE] Surface per-service compose scan failures in user-facing output #131

Description

@advaitpatel

Background

Found while manually testing --compose against examples/compose/docker-compose-insecure.yml with images not pulled locally. When a per-service image scan fails inside ComposeOrchestrator.run_full_scan (docksec/compose_scanner.py, around lines 387-432), the failure is only logged via logger.error(...), which is invisible by default in CLI mode (logger defaults to ERROR-and-up on stderr, but even then a user running without -v/DOCKSEC_LOG_LEVEL won't see it prominently — see #129 for adding -v). The scan otherwise completes and reports a security score as if every service's image had actually been scanned, which can be misleading: a user could believe the compose scan was comprehensive when some services silently only got static rule checks, not real vulnerability data.

Task

When one or more services fail to scan (image not found locally, scanner exception, etc.), surface this clearly in the CLI's user-facing output — not just the debug log. For example, add a line to the "Quick take" block (see docksec/output.py's quick_take) like:

- 2 of 3 services could not be scanned (image not found locally): web, db

Acceptance criteria

  • ComposeOrchestrator.run_full_scan tracks which services failed and why (not just a boolean all_success)
  • That information is threaded into the results dict returned to cli.py
  • The CLI's result summary (Quick take or a new line) mentions the count and names of services that couldn't be scanned, using ui.warn/ui.detail (not just the raw logger)
  • Existing tests in tests/test_compose_scanner.py still pass; add a test asserting the failed-service info is present in the returned results
  • No change to exit codes or scoring — this is purely a visibility fix so the existing scoring behavior isn't masked

Pointers

  • docksec/compose_scanner.py:387-432 — where per-service scans run and failures are caught
  • docksec/output.pyquick_take/_render_scan_summary equivalent rendering
  • docksec/cli.py — where the compose result gets rendered after the scan

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliChanges to the CLI entry pointenhancementNew feature or requestgood first issueGood for newcomers

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions