[Bug]: [API Portal] A disabled key manager still issues tokens through an application's client mapping
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 70/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- docker-compose, javascript, sqlite
- 領域
- api, authentication
調査の方向性
Start in portals/api-portal/src/controllers/apiPortalController.js at generateOAuthKeys (around line 315), which loads the key manager and calls generateToken without checking kmRecord.enabled. Compare with the refusal in portals/api-portal/src/services/keyManagerRegistry.js around line 189. Done when the generate-token endpoint returns a 4xx with no token for a disabled key manager, which you can confirm by running the six reproduction steps in the issue.
索引モデルが issue の本文から書いたものです。
説明
Please select the area the issue is related to
Developer Portal
Please select the aspect the issue is related to
Aspect/API (API backends, definitions, contracts, interfaces, OpenAPI)
Description
POST /api-portal/api/v0.9/applications/{applicationId}/oauth-keys/{keyMappingId}/generate-token doesn't check whether the key manager is enabled. After an administrator disables a key manager, this endpoint still requests and returns tokens from it.
Disabling a key manager is how an administrator takes an identity provider out of service, so this path bypasses that control. The /oauth2-keys path refuses a disabled key manager, so the two token paths behave differently.
Expected: after the key manager is disabled, the request fails with a 4xx error and returns no token.
Actual: the request returns 200 with a new access token.
| Step | Result |
|---|---|
| Issue a token while the key manager is enabled | 200, token returned |
| Call a gateway API that trusts this key manager's issuer with that token | 200 |
Disable the key manager (PUT /key-managers/{id}, {"enabled":false}) |
200, "enabled":false |
| Issue a token while the key manager is disabled | 200, new token returned (4xx expected) |
| Call the same API with the new token | 200 |
The result is the same whether the application belongs to an administrator or a developer.
The gateway in this check was configured separately and isn't connected to the portal. The API calls show that the token issued after disabling is usable; they don't show how a gateway should treat tokens from a disabled key manager.
Cause
generateOAuthKeysloads the key manager and callsgenerateTokenwithout checkingkmRecord.enabled(portals/api-portal/src/controllers/apiPortalController.js:315).- The
/oauth2-keyspath goes throughkeyManagerRegistry, which refuses a disabled key manager (portals/api-portal/src/services/keyManagerRegistry.js:189). generateKeyshas no enabled check either, so from the code it can also create new client mappings to a disabled key manager (portals/api-portal/src/controllers/apiPortalController.js:275). This wasn't exercised separately.
Steps to Reproduce
Set BASE to the portal's REST API, for example https://localhost:9543/api-portal/api/v0.9, and get an administrator bearer token. Use any OAuth2 token endpoint that supports the client credentials grant, and a client registered with it.
-
Create a key manager. It returns
201.curl -sk -w '\nHTTP %{http_code}\n' -X POST "$BASE/key-managers" \ -H "Authorization: Bearer $ADMIN_TOKEN" -H 'Content-Type: application/json' \ -d '{"id":"manual-km","displayName":"Manual Key Manager","tokenEndpoint":"<token endpoint>"}' -
Create an application. It returns
201.curl -sk -w '\nHTTP %{http_code}\n' -X POST "$BASE/applications" \ -H "Authorization: Bearer $ADMIN_TOKEN" -H 'Content-Type: application/json' \ -d '{"id":"manual-app","displayName":"Manual Application","description":"Uses a key manager"}' -
Map the client to the application, and note
keyMappingIdfrom the response.curl -sk -w '\nHTTP %{http_code}\n' -X POST "$BASE/applications/manual-app/generate-keys" \ -H "Authorization: Bearer $ADMIN_TOKEN" -H 'Content-Type: application/json' \ -d '{"keyManager":"manual-km","type":"PRODUCTION","consumerKey":"<client id>"}' -
Issue a token. It returns
200with anaccessToken.curl -sk -w '\nHTTP %{http_code}\n' -X POST "$BASE/applications/manual-app/oauth-keys/<keyMappingId>/generate-token" \ -H "Authorization: Bearer $ADMIN_TOKEN" -H 'Content-Type: application/json' \ -d '{"consumerSecret":"<client secret>"}' -
Disable the key manager. It returns
200with"enabled":false.curl -sk -w '\nHTTP %{http_code}\n' -X PUT "$BASE/key-managers/manual-km" \ -H "Authorization: Bearer $ADMIN_TOKEN" -H 'Content-Type: application/json' \ -d '{"enabled":false}' -
Repeat step 4. It returns
200with a newaccessToken; a 4xx error and no token are expected.
Severity Level of the Issue
Severity/Major (Important functionality is broken. Should be prioritized. Doesn't need immediate attention)
Environment Details (with versions)
- API Portal
1.1.0-m6-SNAPSHOT, built locally from source - Platform API
0.17.0-SNAPSHOT, for sign-in - Gateway
2026.09.24for the API calls - SQLite, running with Docker Compose on macOS
- A mock OAuth2 token endpoint as the key manager
- 主要言語
- Go
- スター
- 85
- フォーク
- 137
- 平均マージ
- 1日 12時間
- マージ済み PR(30日)
- 247
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
wso2/api-platform のほかの issue
-
Area/DeveloperPortal Aspect/UI Severity/Minor Type/Bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
wso2/api-platform#4369 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: host-rewrite policy documentation lists fewer allowed host characters than the policy acceptsオープンArea/Policies Aspect/Other Severity/Trivial Type/Bug
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
wso2/api-platform#4355 ·
メンテナーはふだん 1 日以内に返信
-
Area/Gateway Aspect/API Severity/Minor Type/Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
wso2/api-platform#4348 ·
メンテナーはふだん 1 日以内に返信
-
Aspect/AI Aspect/API. Severity/Major
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
wso2/api-platform#4343 ·
メンテナーはふだん 1 日以内に返信
-
Area/Policies Aspect/Configuration Severity/Minor Type/Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
wso2/api-platform#4330 ·
メンテナーはふだん 1 日以内に返信
wso2/api-platform の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
needs discussion
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
openfga/openfga.dev#1436 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
digital-go-jp/abr-geocoder#457 ·
メンテナーはふだん 3 日以内に返信
-
benchmark
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
mozilla-ai/cq#601 ·
メンテナーはふだん 1 日以内に返信