Skip to content

sync: avoid value-based redaction for locally constructed errors in sync planning #572

Open

Description

@eitsupi

Follow-up to a non-blocking review comment on #569.

Problem

In cmd/dbc/sync_plan.go, some errors are built locally rather than returned by a registry request:

  • GetPackage / GetWithConstraint errors (e.g. "no package for version ...")
  • newLockedArtifact / lockArtifacts errors (e.g. "cannot record artifact location: invalid hash ...")

These errors still go through redactRegistryError, which redacts based on values from the registry URL. When the registry URL has a query string, the whole message gets replaced. For example, with a registry like https://r.example/?v=1, both of these:

  • driver mysql: no package for version 1.4.0 on linux_amd64
  • driver mysql: cannot record artifact location: invalid hash "sha256:01ab"

become registry request failed; details are hidden…, even though they carry no credentials.

Proposed fix

  • Keep redactRegistryError only for the index fetch and artifact downloads, where the error may come from the remote side.
  • For locally constructed errors, stripping the registry URL is enough.
  • Add tests showing that these messages stay readable when the registry URL has a query string.

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