Skip to content

scan <Dockerfile> fails with "unsupported target type" (scan router has no Dockerfile case) #400

Open

Description

@ctfjake

Summary

Static scan of a Dockerfile on disk (deputy scan <Dockerfile>) fails for any Dockerfile with unsupported target type, even though a Dockerfile provider is registered.

Environment

  • deputy 0.0.0-dev, commit 1c97f17 (current main HEAD); go1.26.6, linux/amd64

Steps to reproduce

printf 'FROM alpine:3.18\nRUN echo hi\n' > /tmp/Dockerfile
deputy scan /tmp/Dockerfile

Actual: Scan dockerfile: internal: scan failed: unsupported target type for "/tmp/Dockerfile". (exit 1). Reproduces on any Dockerfile; scanning a built image works, so it is specific to the on-disk Dockerfile target.
Expected: Deputy statically analyzes the Dockerfile, or returns a clear "not supported yet" if intentional.

Root cause (confirmed path)

The dockerfile provider IS registered (internal/targets/providers/dockerfile.go:14) and resolves the Dockerfile. But the CLI scan path is runScanDockerfile (cli/cmd/scan.go) -> c.Vulns.Scan -> server routeScan (internal/server/scan_handler.go), and routeScan has no KindDockerfile case, so it falls through to the generic repository scan -> inventory.resolveRepositoryTarget -> unsupported target type at internal/inventory/collector.go:976. The inventory CollectDockerfile path (collector.go ~175) handles Dockerfiles correctly but is not reachable from deputy scan.

History: regression

Dockerfile scanning worked before via a dedicated Service.ScanDockerfile (commit ce233cb, 2026-01-07). The proto-first rewrite (2d60800, #7, 2026-01-12) replaced it with the Vulns.Scan/routeScan path, which shipped without a KindDockerfile case. Broken since, roughly 8.5 months.

Suggested direction

Add a KindDockerfile case to routeScan that dispatches to the existing Dockerfile analysis (the provider and CollectDockerfile logic already exist).

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions