Support least-privilege RBAC for apiops publish — avoid requiring Resource Group Reader in preflight
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 72/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- azure, typescript
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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
- Vorherrschende Sprache
- TypeScript
- Sterne
- 44
- Forks
- 14
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus Azure/apiops-cli
-
type:bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 71/100
Azure/apiops-cli#350 ·
-
stale
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 84/100
Azure/apiops-cli#333 · 1 Kommentar ·
-
extract fails when a policy uses set-backend-service backend-id="{{namedValue}}"Evtl. vergeben @dannyward630 hat das vor 37 Tagen übernommen. Offenstale type:bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Azure/apiops-cli#331 · 1 Kommentar ·
-
Docs example says products are auto-included transitively, but they aren't extracted with `products: []`Evtl. vergeben @cdayne hat das vor 27 Tagen übernommen. Offenstale type:question
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Azure/apiops-cli#277 · 1 Kommentar ·
-
Extractor mistakes set-body json response as transitive dependency which causes pipeline failureOffentype:bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 56/100
Azure/apiops-cli#349 ·
Alle Issues in Azure/apiops-cli
Ähnliche Issues
-
area:api bug good first issue priority:high
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Doezer/Questarr#1486 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
area:import difficulty:good-first good first issue help wanted priority:P1 roadmap size:S type:test
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
Sergey-Bar/Penny#245 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
mihazs/lazysh#3377 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Approve the Cloudflare agent plugin for harness sessionsEvtl. vergeben @joshtsch hat das heute übernommen. Offenenhancement ready-for-agent
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag