Support least-privilege RBAC for apiops publish — avoid requiring Resource Group Reader in preflight
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 72/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- azure, typescript
研究方向
Start in src/clients/apim-client.ts at validatePreFlight() and trace the two sequential resource checks used by apiops publish. Confirm the chosen behavior preserves the APIM service existence check while allowing identities without resource-group read access; done means service-scoped publishing passes preflight without requiring Resource Group Reader.
由索引模型根據 Issue 內容生成。
描述
Problem or use case
apiops publish fails preflight validation unless the executing identity has
Reader (or broader) at the Resource Group scope, even though publishing
itself only ever touches the target APIM service/workspace.
validatePreFlight() (src/clients/apim-client.ts) performs two sequential
existence checks before publishing:
GET {armEndpoint}/subscriptions/{sub}/resourceGroups/{rg}— requires
Microsoft.Resources/subscriptions/resourceGroups/read, granted only by
Reader(or higher) at resource group or subscription scope.GET {baseUrl}(the APIM service resource itself) — satisfied by
Reader/Service Readerat APIM service scope.
Step 1 fails with a 403 for any identity scoped only to the APIM service,
before step 2 (the actually-relevant check) even runs:
AuthorizationFailed: The client does not have authorization to perform action
'Microsoft.Resources/subscriptions/resourceGroups/read' over scope
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}'
Use case: organizations running a shared-APIM, multi-team model (one
resource group, several teams' service principals) currently must choose
between granting every team broad RG-scoped read access to every other
resource in the RG (other APIM instances, storage, App Insights, etc.), or
funneling all publishes through a single centrally-scoped identity — both
work against per-team least privilege. This also breaks parity with extract,
where workspace-scoped Reader + Service Reader (no RG scope) is already
sufficient.
Proposed solution
Scope the preflight check down to only what publish actually needs: read
access to the target APIM service. Step 2 above already GETs the APIM
service resource directly and will itself return 404 if the resource group
or instance doesn't exist, so the RG-level check in step 1 is purely
diagnostic (a slightly clearer "resource group not found" message) and isn't
load-bearing for correctness. Two options, in order of preference:
- Drop the RG-level check entirely and rely on the APIM-service GET
(step 2) for existence validation. Slightly less specific error message
on a missing RG vs. missing APIM instance, but removes the RGReader
requirement entirely. - Make the RG check non-fatal: if it returns 403 specifically, log a
warning and continue to step 2, only hard-failing on a genuine 404.
Preserves the diagnostic for identities that do have RG-level access,
without hard-blocking least-privilege ones.
Affected command
apiops publish
- 主要語言
- TypeScript
- 星號
- 44
- 分支
- 14
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
Azure/apiops-cli 的其他 Issue
-
type:bug
難度 2/5 1-3 小時 新手友好度 71/100
Azure/apiops-cli#350 ·
-
stale
難度 1/5 1-3 小時 新手友好度 84/100
Azure/apiops-cli#333 · 1 則留言 ·
-
extract fails when a policy uses set-backend-service backend-id="{{namedValue}}"可能已有人在做 @dannyward630 於 37 天前認領。 未關閉stale type:bug
難度 2/5 1-3 小時 新手友好度 78/100
Azure/apiops-cli#331 · 1 則留言 ·
-
Docs example says products are auto-included transitively, but they aren't extracted with `products: []`可能已有人在做 @cdayne 於 27 天前認領。 未關閉stale type:question
難度 2/5 1-3 小時 新手友好度 76/100
Azure/apiops-cli#277 · 1 則留言 ·
-
Extractor mistakes set-body json response as transitive dependency which causes pipeline failure未關閉type:bug
難度 3/5 1-2 天 新手友好度 56/100
Azure/apiops-cli#349 ·
相似的 Issue
-
area:api bug good first issue priority:high
難度 2/5 1-3 小時 新手友好度 78/100
Doezer/Questarr#1486 · 1 則留言 ·
維護者通常 1 天內回覆
-
area:import difficulty:good-first good first issue help wanted priority:P1 roadmap size:S type:test
難度 2/5 1-3 小時 新手友好度 88/100
Sergey-Bar/Penny#245 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
Approve the Cloudflare agent plugin for harness sessions可能已有人在做 @joshtsch 今天認領。 未關閉enhancement ready-for-agent
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆