Skip to content

refactor: remove process-global auth cache store #2305

Description

@vmvarela

#2288 fixed the token mixing by keying shared auth caches by credential identity, but the cache store is still a package-level global. It keeps state across invocations in the same process, makes tests order-dependent (they must reset the global), and lets cached tokens outlive a command.

I would like to follow up by scoping the auth cache store to the command invocation (owned by option.Common) while keeping the credential-identity key, so clients with the same credentials within one invocation still share a cache.

Proposed changes:

  • Replace the package-global store with an invocation-scoped store.
  • Bind the from and to remotes to the same store through option.Common.
  • Keep the per-credential keying.
  • Add a regression test where cp authenticates to the destination with its own credentials (httptest returning 403 for the wrong Basic user).
  • Update the existing cache tests to use explicit stores instead of the global reset.

Related: #2276, #2288, #1923.

Activity

  1. vmvarela commented on Nov 1, 2026

    @vmvarela
    ContributorAuthor

    I want to work on this. I have a change with unit tests and a 403 httptest for cp ready to open as a PR.

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