Skip to content

Thread API networking config through OIDC auto-discovery flow#268

Merged
cloudsmith-iduffy merged 3 commits intoiduffy/automatic-oidcfrom
copilot/sub-pr-267
Feb 28, 2026
Merged

Thread API networking config through OIDC auto-discovery flow#268
cloudsmith-iduffy merged 3 commits intoiduffy/automatic-oidcfrom
copilot/sub-pr-267

Conversation

Copy link

Copilot AI commented Feb 28, 2026

OIDC auto-discovery was ignoring the CLI's configured proxy, SSL verification, and custom headers, causing authentication failures in restricted network environments.

Changes

Extended credential context

  • Added proxy, ssl_verify, user_agent, headers fields to CredentialContext
  • Propagated from API config in _try_oidc_credential() → detectors → exchange

Refactored HTTP calls to use configured sessions

  • exchange_oidc_token() now creates requests.Session with networking config
  • EnvironmentDetector base class provides _create_session() helper
  • GitHub Actions and Azure DevOps detectors use configured sessions for token fetching

Updated test mocking strategy

  • Changed from mocking requests.get/post directly to mocking requests.Session
  • Ensures tests exercise the session configuration code path

Impact

Users with CLOUDSMITH_API_PROXY, CLOUDSMITH_WITHOUT_API_SSL_VERIFY, or custom headers now have OIDC flows respect these settings.

Before:

# OIDC exchange ignored proxy config, failed in restricted networks
exchange_oidc_token(...) → requests.post(...) # used defaults

After:

# OIDC exchange uses CLI's networking config
session = create_exchange_session(proxy=ctx.proxy, ssl_verify=ctx.ssl_verify, ...)
session.post(...)  # respects proxy, SSL, headers

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 28, 2026 14:08
- Extend CredentialContext with proxy, SSL verify, user-agent, headers
- Update _try_oidc_credential() to pass networking config from API config
- Modify exchange_oidc_token() to create session with networking settings
- Update OIDC detectors (GitHub Actions, Azure DevOps) to use configured session
- Update tests to mock requests.Session instead of requests.get/post directly

Co-authored-by: cloudsmith-iduffy <178375997+cloudsmith-iduffy@users.noreply.github.com>
Co-authored-by: cloudsmith-iduffy <178375997+cloudsmith-iduffy@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 28, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.cloudsmith.io
    • Triggering command: /usr/bin/python python -m pytest cloudsmith_cli/core/tests/test_credentials.py -v --tb=short (dns block)
  • oidc.example.com
    • Triggering command: /usr/bin/python python -m pytest cloudsmith_cli/core/tests/test_credentials.py -v --tb=short (dns block)
  • token.example.com
    • Triggering command: /usr/bin/python python -m pytest cloudsmith_cli/core/tests/test_credentials.py -v --tb=short (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add OIDC authentication with automatic CI/CD platform detection Thread API networking config through OIDC auto-discovery flow Feb 28, 2026
@cloudsmith-iduffy cloudsmith-iduffy marked this pull request as ready for review February 28, 2026 15:58
@cloudsmith-iduffy cloudsmith-iduffy requested a review from a team as a code owner February 28, 2026 15:58
@cloudsmith-iduffy cloudsmith-iduffy merged commit 8a5af03 into iduffy/automatic-oidc Feb 28, 2026
@cloudsmith-iduffy cloudsmith-iduffy deleted the copilot/sub-pr-267 branch February 28, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants