Skip to content

Support OIDC Token Exchange During Server Configuration #1369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 51 commits into from
Apr 6, 2025

Conversation

EyalDelarea
Copy link
Contributor

@EyalDelarea EyalDelarea commented Mar 27, 2025


✨ Add OIDC Authentication Support to jf config (Non-Interactive)

This PR introduces support for configuring a JFrog server using OIDC token exchange in non-interactive mode — a key enabler for CI/CD systems like GitHub Actions, Azure Pipelines, and others.

Highlights:

  • 🆕 Introduces OidcTokenExchangeCommand in general/token, encapsulating the OIDC token exchange flow.
  • 🛠 Adds support for --oidc-* flags in jf config when run non-interactively:
    • Exchanges the provided ID token for a JFrog access token.
    • Injects the access token into the configured server details.
  • 🧪 Adds comprehensive unit tests for:
    • Token parameter validation.
    • Application key resolution from config or env.
    • OIDC provider type parsing (case-insensitive).
  • ✅ Deprecated reliance on JFROG_CLI_USAGE_CONFIG_OIDC for usage tracking.

📣 CI-Focused, Non-Interactive-Only

OIDC support is currently only available for non-interactive CLI config, making it ideal for:

  • CI/CD environments where tokens are injected via secure variables.
  • Scripts or automation flows that cannot involve user input.

Interactive terminal flows are not yet supported to minimize risk and limit rollout scope.


🗂 CLI Utils

Added a utility to read application.key from the local ~/.jfrog/config.yml file or from the JFROG_CLI_APPLICATION_KEY environment variable.


🧾 Supported OIDC Parameters

Can be provided via flags or environment variables:
Args 🅰️ :

  • url
  • oidc-provider-name
  • oidc-provider-type (defaults to GitHub)
    Flags 🎏 :
  • --oidc-token-id
  • --oidc-audience (optional)
  • CI metadata (via env or flags):
    JFROG_CLI_APPLICATION_KEY, JFROG_CLI_PROJECT, JFROG_CLI_CI_JOB_ID, JFROG_CLI_CI_RUN_ID, JFROG_CLI_SOURCECODE_REPOSITORY

📌 Example: Configuring OIDC Auth in CI

jf config add my-server \
  --url=https://my.jfrog.io \
  --oidc-provider-name=GitHub \
  --oidc-provider-type=GitHub \
  --oidc-token-id=$ID_TOKEN \
  --interactive=false

This will exchange the $ID_TOKEN for an access token and store it in the CLI config.


📊 Updated Usage Reporting

Usage is now tracked when the OIDC token exchange command runs:

Removed legacy env var JFROG_CLI_USAGE_CONFIG_OIDC.
Added direct usage tracking via ExecAndThenReportUsage() during token exchange.

This improves visibility and consistency across all environments — not just those using GitHub Actions.


🔗 Related Work

This PR depends on [jfrog-client-go#1103](jfrog/jfrog-client-go#1103), which adds support for the OIDC token exchange endpoint.


@EyalDelarea EyalDelarea added the improvement Automatically generated release notes label Mar 27, 2025
Copy link
Contributor

github-actions bot commented Apr 6, 2025

👍 Frogbot scanned this pull request and did not find any new security issues.


@EyalDelarea EyalDelarea merged commit 7a3cb0b into jfrog:dev Apr 6, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Automatically generated release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants