Skip to content

Try unauthenticated OCI registry interactions if expired/invalid credentials are set #212

Open
@myoung3

Description

@myoung3

Version of Singularity
3.8.1

Describe the bug
If I associated a username/token pair for an oras repository with singularity using singularity remote login, then cancel that token (ie via github), I can't pull from public repositories.

To Reproduce

  • step 0:
    • verify anonymous pulls are possible through oras/github. in a singularity installation that doesn't have any ghcr.io tokens stored, try singularity pull oras://ghcr.io/singularityhub/github-ci:latest
    • now clear your image cache singularity cache clean
  • step 2: generate github PAT https://github.com/settings/tokens
  • step 3: echo <PAT> | singularity remote login --username <gh username> --password-stdin oras://ghcr.io
  • step 4:
    • test that you can pull with a valid key: singularity pull oras://ghcr.io/singularityhub/github-ci:latest
    • clear your cache singularity cache clean
  • step 5 cancel your PAT here https://github.com/settings/tokens
  • step 6 try to pull again singularity pull oras://ghcr.io/singularityhub/github-ci:latest
ingularity shell oras://ghcr.io/singularityhub/github-ci:latest
INFO[0000] trying next host                              error="failed to authorize: failed to fetch oauth token: unexpected status: 403 Forbidden" host=ghcr.io
FATAL:   Unable to handle oras://ghcr.io/singularityhub/github-ci:latest uri: failed to get checksum for oras://ghcr.io/singularityhub/github-ci:latest: while resolving reference: failed to authorize: failed to fetch oauth token: unexpected status: 403 Forbidden

Expected behavior
print a warning that authentication failed, retry anonymously.

OS / Linux Distribution
Which Linux distribution are you using?

ingularity shell oras://ghcr.io/singularityhub/github-ci:latest
INFO[0000] trying next host                              error="failed to authorize: failed to fetch oauth token: unexpected status: 403 Forbidden" host=ghcr.io
FATAL:   Unable to handle oras://ghcr.io/singularityhub/github-ci:latest uri: failed to get checksum for oras://ghcr.io/singularityhub/github-ci:latest: while resolving reference: failed to authorize: failed to fetch oauth token: unexpected status: 403 Forbidden

Installation Method
source

Additional context
it would also be good if there was a way to remove authenticated logins

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmaybeFeatures / changes that maybe implemented in future, depending on need & resources

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions