KeycloakClient strips realm path when realm URL lacks trailing slash
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 88/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- go
調査の方向性
pkg/connectors/keycloak_client.go、特に NewKeycloakClientWithContextから始め、その後pkg/connectors/keycloak_client_test.goを確認してください。connectorのテストを実行し、末尾にスラッシュのないrealm URLでも、tokenおよびOIDCの設定リクエストでrealmのパスが保持されることを確認してください。この入力に対する回帰テストが成功すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
When initializing a KeycloakClient using connectors.NewKeycloakClient or connectors.NewKeycloakClientWithContext, if the provided realmURL does not include a trailing slash (e.g., http://keycloak.example.com/realms/microcks), subsequent requests to obtain tokens or fetch OIDC configuration fail with HTTP 404.
This happens because relative endpoints (protocol/openid-connect/token and .well-known/openid-configuration) are resolved against kc.BaseURL using c.BaseURL.ResolveReference(rel).
Under RFC 3986 relative URL resolution rules, resolving a relative path against a base URL without a trailing slash strips the final path segment (microcks).
As a result, the request resolves to:
http://keycloak.example.com/realms/protocol/openid-connect/token
instead of:
http://keycloak.example.com/realms/microcks/protocol/openid-connect/token
In comparison, MicrocksClient in pkg/connectors/microcks_client.go defensively normalizes its incoming base URL, but KeycloakClient does not.
Expected behavior
NewKeycloakClient and NewKeycloakClientWithContext should ensure that kc.BaseURL.Path ends with a trailing /, so relative endpoints always resolve under the specified realm.
For example:
http://keycloak.example.com/realms/microcks/protocol/openid-connect/token
This should work regardless of whether the input URL includes a trailing slash.
Actual behavior
The realm name is stripped from the URL path.
- Configured URL:
http://keycloak.example.com/realms/microcks - Resolved Token URL:
http://keycloak.example.com/realms/protocol/openid-connect/token(HTTP 404)
How to Reproduce?
-
Initialize a
KeycloakClientwith a realm URL that omits the trailing slash:kc, err := connectors.NewKeycloakClientWithContext( context.Background(), "http://keycloak.example.com/realms/microcks", "client-id", "client-secret", ) -
Call
kc.ConnectAndGetToken()orkc.GetOIDCConfig(). -
Inspect the resolved request URL. The realm segment
/microckswill be stripped from the path.
Microcks version or git rev
master
Install method (docker-compose, helm chart, operator, docker-desktop extension,...)
No response
Additional information
This can be addressed in pkg/connectors/keycloak_client.go, inside NewKeycloakClientWithContext, by ensuring that the URL path always ends with a trailing slash:
if !strings.HasSuffix(u.Path, "/") {
u.Path += "/"
}
Along with a unit test in pkg/connectors/keycloak_client_test.go covering a realm URL with a subpath.
- 主要言語
- Go
- スター
- 59
- フォーク
- 74
- 平均マージ
- 4日 8時間
- マージ済み PR(30日)
- 23
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microcks/microcks-cli のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
microcks/microcks-cli#608 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
microcks/microcks-cli#601 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
microcks/microcks-cli#598 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug: microcks login ignores the --config flag and always modifies default config対応中かも @aryarathoree が 3 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
microcks/microcks-cli#594 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
Wrong link to test results対応中かも @SajanBisht が 3 日前に担当しました。 オープンcomponent/cli keep-open kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
microcks/microcks-cli#589 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
microcks/microcks-cli の issue をすべて見る
似ている issue
-
docs(prompts): IF BLOCKED workflow-scope branch says to comment on the issue on jira/local trackersオープンagent-butler-finding bug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
jordansmall/spindrift#6238 ·
メンテナーはふだん 1 日以内に返信
-
bug from-studio
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
esengine/DeepSeek-Reasonix#14868 ·
メンテナーはふだん 1 日以内に返信
-
Install notes print "Camunda REST API: https://" without a host when global.host is set対応中かも @irisfield が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
camunda/camunda-platform-helm#7790 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
wso2/agent-manager#2220 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: zot exits with code 0 when it can't start対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
project-zot/zot#4636 ·
メンテナーはふだん 1 日以内に返信