Skip to content

feat(distribution/rkforge): migrate rkforge login to browser OAuth an…#554

Merged
genedna merged 3 commits intork8s-dev:mainfrom
Lingbou:feat/distribution
Mar 22, 2026
Merged

feat(distribution/rkforge): migrate rkforge login to browser OAuth an…#554
genedna merged 3 commits intork8s-dev:mainfrom
Lingbou:feat/distribution

Conversation

@Lingbou
Copy link
Contributor

@Lingbou Lingbou commented Mar 21, 2026

rkforge:

  • Rewrite login flow to browser-based OAuth via Web App
  • Add local HTTP callback server (axum, 127.0.0.1:random port)
  • Add browser auto-open with fallback URL printing and one-time user_code display
  • Exchange one-time auth_code for JWT via /api/cli/exchange
  • Use positional [SERVER] auth endpoint (default: https://libra.tools)
  • Apply --skip-tls-verify to exchange requests
  • Persist token by registry_url returned from exchange response (with fallback resolution)

distribution:

  • Remove /api/v1/auth/{provider}/callback and /client_id routes
  • Remove oauth_callback/client_id service logic and GitHub API helper code
  • Replace local claims extraction with Web App internal verify API
  • Add OCI_REGISTRY_AUTH_API_URL and INTERNAL_VERIFY_TOKEN config/env
  • Send X-Registry-Internal-Token on verify requests
  • Enforce pull/push action permission checks from verify response

…d delegate registry auth to Web App

rkforge:
- Rewrite login flow to browser-based OAuth via Web App
- Add local HTTP callback server (axum, 127.0.0.1:random port)
- Add browser auto-open with fallback URL printing and one-time user_code display
- Exchange one-time auth_code for JWT via /api/cli/exchange
- Use positional [SERVER] auth endpoint (default: https://libra.tools)
- Apply --skip-tls-verify to exchange requests
- Persist token by registry_url returned from exchange response (with fallback resolution)

distribution:
- Remove /api/v1/auth/{provider}/callback and /client_id routes
- Remove oauth_callback/client_id service logic and GitHub API helper code
- Replace local claims extraction with Web App internal verify API
- Add OCI_REGISTRY_AUTH_API_URL and INTERNAL_VERIFY_TOKEN config/env
- Send X-Registry-Internal-Token on verify requests
- Enforce pull/push action permission checks from verify response

Signed-off-by: Xingqiu Xu <hilbertanjou83@gmail.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 885136f568

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

…exchange

Signed-off-by: Xingqiu Xu <hilbertanjou83@gmail.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd85dec345

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

…scheme detection

Signed-off-by: Xingqiu Xu <hilbertanjou83@gmail.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b95b97909

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +186 to +187
let claims = if let Some(t) = token {
Some(verify_with_web_app(&state, t, None, None, None).await)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip redundant verify call in OCI auth middleware

populate_oci_claims calls verify_with_web_app(...) before branching on HTTP method, but authorize_repository_access then calls verify_with_web_app(...) again for repository-scoped pull/push checks on the same request. On push/pull paths this doubles network round-trips to the auth service (especially costly for chunked blob uploads with many PATCH/PUT calls), increasing latency and making registry operations fail more often under verify-service load even though one verification is sufficient.

Useful? React with 👍 / 👎.

return Ok(s.trim_end_matches('/').to_string());
}
// Extract host part (before port) for IP range check
let host_part = s.split(':').next().unwrap_or(s);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Parse IPv6 host correctly when inferring auth-server scheme

parse_server_url derives host_part via s.split(':').next(), which breaks bracketed IPv6 inputs like [::1]:7001 (the extracted host becomes "["). That makes is_private_ip return false and defaults the URL to https://[::1]:7001, so local IPv6 auth servers running over HTTP fail TLS handshake unless users manually add http://.

Useful? React with 👍 / 👎.

@genedna genedna added this pull request to the merge queue Mar 22, 2026
Merged via the queue into rk8s-dev:main with commit 6a77f4d Mar 22, 2026
6 checks passed
@Lingbou
Copy link
Contributor Author

Lingbou commented Mar 23, 2026

#522

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants