Skip to content

feat: log when registry transport is configured insecurely#587

Open
Dashtid wants to merge 1 commit intoanchore:mainfrom
Dashtid:fix/log-insecure-registry-transport
Open

feat: log when registry transport is configured insecurely#587
Dashtid wants to merge 1 commit intoanchore:mainfrom
Dashtid:fix/log-insecure-registry-transport

Conversation

@Dashtid
Copy link
Copy Markdown

@Dashtid Dashtid commented Apr 25, 2026

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant