Repository navigation
Fixes #32361: Align App endpoint permission checks with the platform RBAC model - #32427
Conversation
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
✅ Playwright Results — workflow succeededValidated commit ✅ 765 passed · ❌ 0 failed · 🟡 1 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 52m 25s ⏱️ Max setup 4m 42s · max shard execution 18m 57s · max shard-job elapsed before upload 23m 25s · reporting 7s 🌐 236.85 requests/attempt · 2.51 app boots/UI scenario · 10.82% common-shard skew Optimization targets still in progress:
🟡 1 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
Code Review ✅ Approved 1 resolved / 1 findingsAligns App endpoint permission checks with the platform RBAC model by introducing a shared authorization helper, gating run data and logs on ViewAll (matching IngestionPipelineResource convention), and authorizing mutating operations before side effects. PATCH now authorizes after entity lookup, preventing unintended state changes on denied requests. Comprehensive unit and integration tests confirm no regressions for admin and DataConsumer roles, and proper denial of unauthorized access. No issues found. ✅ 1 resolved✅ Security: PATCH authorizes after entity lookup and system check
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|



Describe your changes:
Fixes #32361
I worked on aligning AppResource's permission checks with the platform RBAC model because the class had accumulated three different styles as endpoints were added: action endpoints each repeated the same authorization boilerplate, the run-data read endpoints had no check at all, and several mutating endpoints ran their side effects before the authoritative check.
Callers holding ViewAll — which the default DataConsumer role grants on resource all — see no change in behavior.
Type of change:
High-level design:
Three coordinated changes to one resource class, no schema, migration, or API contract change.
Shared helper. Two
authorizeAppOperation(securityContext,name|id,operation) overloads replace the repeated OperationContext + authorizer.authorize(...) pairs. The five action endpoints (schedule, configure, trigger, stop, deploy) now call it with the operation they already used, so their behavior is unchanged.Two-tier reads. /status, /runs/latest, /logs, /extension and /live-indexing-queue gate on ViewAll; /installed gates on ViewBasic at collection level. This is the convention already used by
IngestionPipelineResourceandAIAutomationResource, where the same run/log data is gated this way: the entity is readable at basic view, run history and logs require ViewAll.Authorization ahead of side effects and lookups. POST, PUT, both PATCH variants and both DELETE variants authorize before touching AppScheduler or ApplicationHandler. On PATCH and DELETE the check also precedes the entity lookup and the SystemApp guard, so a caller without permission gets 403 rather than a 404 disclosing whether the app exists or a 400 disclosing that it is a system app. Authorized callers are unaffected: the resource context resolves the entity itself and treats a missing one as absent, so an admin still receives 404 or 400 as before. Each boundary check evaluates the same operation against the same resource as the base EntityResource method that follows it:
The stored app is therefore read more than once on PUT, PATCH and DELETE — the boundary check, the handler's own lookup, and the base check. On PATCH and PUT those reads bypass the repository cache by design (ResourceContext.useRepositoryCache() excludes both), so the extra work is real. That is the cost of gating the side effect rather than leaving it ahead of authorization, and it is noted in the code.
Alternative rejected: an EditAll fallback on the scoped action operations (as IngestionPipelineResource carries) was not added. App action endpoints have been scoped-only since #26590 , so there is no legacy grant population to preserve and adding one would loosen shipped behavior.
Tests:
Use cases covered
Unit tests
Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
Captured a behavior baseline on a running server before the change, then re-ran the same probes after, on a server rebuilt from this branch (47 probes total):
UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes 32361: Align App endpoint permission checks with the platform RBAC modelFixes #32361above.