Skip to content

feat: log when registry transport is configured insecurely#587

Merged
wagoodman merged 1 commit into
anchore:mainfrom
Dashtid:fix/log-insecure-registry-transport
May 15, 2026
Merged

feat: log when registry transport is configured insecurely#587
wagoodman merged 1 commit into
anchore:mainfrom
Dashtid:fix/log-insecure-registry-transport

Conversation

@Dashtid

@Dashtid Dashtid commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Emit debug-level logs at the points where insecure registry options are actually applied
  • TLSConfig logs per-registry when InsecureSkipTLSVerify is set
  • prepareReferenceOptions (in both oci and containerd providers) logs when InsecureUseHTTP causes name.Insecure to be applied to the reference
  • Pure observability — no behavior change

This is the second half of anchore/grype#3101. The first half (a one-time CLI warning at config-load time) is in anchore/grype#3396; these debug logs complement it by surfacing the actual per-registry application of the flags during low-level tracing.

Details

Three small additions, 6 lines total:

Log style and level match existing patterns in the same files (e.g. log.Tracef("using registry credentials from config index %d", ...) and log.Debugf("pulling %s image=%q", ...)).

Test plan

  • go build ./... passes
  • go test ./pkg/image/... — all related tests pass (Test_prepareReferenceOptions, registry/TLS tests)
  • One pre-existing test failure on Windows (TestRegistryOptions_TLSConfig_rootCAs/add_root_certs_from_dir) — confirmed identical failure on clean upstream main, unrelated to this change. Likely a Windows path/glob test issue.

No new tests added: debug logs are observability-only and not typically unit-tested in this codebase (consistent with how the existing log.Tracef/log.Debugf calls at the same sites have no dedicated tests).

Emit debug-level logs at the points where the insecure registry
options are actually applied:

- TLSConfig logs once per registry when InsecureSkipTLSVerify is set
- prepareReferenceOptions (in both oci and containerd providers) logs
  when InsecureUseHTTP causes name.Insecure to be applied to the
  reference

These logs are observability only - no behavior change. They
complement a higher-level warning emitted by downstream callers
(see anchore/grype#3101) by surfacing the actual per-registry
application of the insecure flags during low-level tracing.

Signed-off-by: David Dashti <david.dashti@hermesmedical.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
@wagoodman
wagoodman force-pushed the fix/log-insecure-registry-transport branch from 7e5609b to 60c7675 Compare May 15, 2026 20:34
@wagoodman
wagoodman merged commit 573cf7a into anchore:main May 15, 2026
10 checks passed
@wagoodman wagoodman added the enhancement New feature or request label May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants