Skip to content

Block events from a failed docker build never reach SafeDep Cloud #396

Description

@Sahilb315

Summary

A package blocked during docker build is the most security-relevant event PMG produces, and it currently never reaches SafeDep Cloud under any configuration. The system install docs note the symptom ("a failed build uploads nothing"); this issue is about closing the gap.

Follow-up from #363.

Why no configuration can deliver it today

Verified on main:

  1. The ephemeral flow (what the shims invoke in a RUN step) only buffers events to the local WAL (internal/flows/proxy_flow.goaudit.LogSessionComplete). There is no synchronous delivery in this path; the periodic sync + shutdown flush exist only in the long-running proxy daemon (internal/proxyserver/server.go), which is not what runs here.
  2. Delivery for ephemeral runs is a detached fire-and-forget pmg cloud sync-background child spawned post-run (main.goaudit.MaybeSpawnBackgroundSync, internal/audit/background_sync.go). On a block, the parent exits non-zero, the RUN step fails, BuildKit tears down the build container, and the detached child dies before it can resolve credentials or complete a round trip.
  3. The WAL lives in the build container's filesystem, which is discarded with the failed build, so the event cannot be recovered afterwards either.

Consequences:

  • The documented pattern (credentials mounted only on a final pmg cloud sync step) cannot report blocks: that step never runs in a failed build.
  • Mounting BuildKit secrets on the install RUN steps does not help either, because of (2).

Net effect: Package Guard sees a build's successful installs, but never the one event that matters most — a malicious package caught in CI.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions