Skip to content

[Draft] feat(backup,restore)!: remove global registry flags #2380

Backlog

Description

@TerryHowe

Note

Draft: this is part of the multi-repository backup/restore work in #2358 and #730. The details may change before #2358 is agreed.

What

Remove the flags from oras backup and oras restore that hold a single, global setting for the registry. Once these commands work across several registries (#730, #2358, #2364), one global setting is either ambiguous or unsafe:

With a global flag it is unclear which registry --plain-http or --ca-file is meant for. Credentials, client certificates and headers would also be sent to every registry the command talks to.

Today registryCredentialTransport (cmd/oras/internal/option/remote.go) already keeps client certificates and custom headers from following redirects to other hosts. But every registry client in one command is built from the same option.Remote, so each one gets the same credentials, headers and certificate.

Both commands are [Experimental], and #2364 already brings a breaking change, so all of these flags go in that same release instead of being deprecated one at a time.

Today both commands embed option.Remote and call opts.EnableDistributionSpecFlag() (cmd/oras/root/backup.go, cmd/oras/root/restore.go), so they get every flag below.

Flags to remove

Flag Why it does not fit multiple registries
-u, --username One set of credentials for every registry
-p, --password Same
--identity-token Same
--password-stdin Same
--identity-token-stdin Same
-H, --header Custom headers, possibly Authorization, go to every registry
--cert-file One mTLS client identity for every registry
--key-file Same
--ca-file Unclear which registry it is meant for; per-host trust belongs in certs.d
--insecure Turns off TLS verification for every registry
--plain-http Unclear which registry it is meant for; downgrades every registry to HTTP
--distribution-spec Registries differ in referrers API support (v1.1-referrers-api / v1.1-referrers-tag)

Flags to keep

Flag Why it is fine
--registry-config The auth file is keyed by host
--resolve Each entry names its host:port

Where per-registry settings come from instead

Removed flag(s) Replacement Available today?
-u, -p, --identity-token, --*-stdin oras login / credential store, --registry-config Yes
--ca-file, --cert-file, --key-file certs.d Only with ORAS_EXPERIMENTAL_CONTAINERS_CONFIG=1
--insecure registries.conf insecure = true Only with ORAS_EXPERIMENTAL_CONTAINERS_CONFIG=1
--distribution-spec Auto-detection per registry, or registries.conf referrers-api Auto-detection yes; referrers-api only with the env var
--plain-http None for hosts other than localhost No
-H, --header None. Out of scope for now No

Prerequisites

  • Per-host plain HTTP. Remote.isPlainHTTP (remote.go) only looks at the --plain-http flag and the localhost auto-detect. registries.conf insecure maps to Transport.Insecure (skip TLS verification), not to plain HTTP. Without a per-host way to choose plain HTTP, users of an HTTP registry on a host other than localhost (e.g. registry.lan:5000) can no longer use backup/restore. Options: map registries.conf insecure to plain HTTP the way podman does, or add a separate per-host setting.
  • The containers config gate. The per-host TLS settings (certs.d, registries.conf) are only read when ORAS_EXPERIMENTAL_CONTAINERS_CONFIG is set (containers_config.go). Decide whether backup/restore always read them, or whether the removal waits until containers config is no longer experimental. Otherwise users of private CAs and mTLS have no way forward.
  • Update docs: record full references and support multiple registries in backup proposal #2358. Done: docs: record full references and support multiple registries in backup proposal #2358 now drops these flags, with a Removed Flags table, the replacements and these prerequisites under Authentication Handling.

Scope

  • Stop registering the flags above on backup and restore. Remote.ApplyFlagsWithPrefix registers all of them at once, so this needs a mode on option.Remote or a separate option type that registers only --registry-config and --resolve and skips applyStdinFlags.
  • Make Remote.Parse work when the credential, cert and header flags are not registered, so it doesn't read stdin or prompt for a password.
  • Remove opts.EnableDistributionSpecFlag() from both commands.
  • Give a clear error for the removed flags, pointing to oras login, --registry-config and registries.conf/certs.d, instead of cobra's generic "unknown flag".
  • Update the help text and examples for both commands: drop the --insecure and --plain-http examples, and add an oras login example.
  • Update the docs to list the removed flags and what to use instead. (The proposal in docs: record full references and support multiple registries in backup proposal #2358 is already updated.)
  • Mark it as a breaking change in the release notes.
  • Update the e2e tests:
    • Most need no changes. The suite logs in during setup (test/e2e/internal/utils/init.go) and uses localhost registries, which are auto-detected as plain HTTP.
    • The two --distribution-spec tests in test/e2e/suite/command/backup.go (v1.1-referrers-api / v1.1-referrers-tag) need another way to force each mode (e.g. registries.conf referrers-api) or should be removed.
    • Add a test that the removed flags are rejected.
  • Unit tests set PlainHTTP on the repository directly (cmd/oras/root/backup_test.go), so they should not need changes.

Not in scope

  • Per-host flag syntax (e.g. --header host=Name:Value). This can be added later if there is demand.
  • Changing these flags on any other command.

Open questions

  • Per-host plain HTTP: should registries.conf insecure also allow plain HTTP, or should there be a separate setting?
  • Should backup/restore read containers config without ORAS_EXPERIMENTAL_CONTAINERS_CONFIG, or should this change wait until that support is no longer experimental?

Activity

  1. added
    enhancement
    breaking change
    experimental
    triage
    on Nov 26, 2026
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

    breaking changeenhancementexperimentaltriage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions