apache / apache/cloudstack

UI: a role denied one non-essential bootstrap API (e.g. listLdapConfigurations) fails to load the entire console

未關閉 適合新手
#13,912 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
component:UI
主要語言
Java
星號
3.1k
分支
1.4k
平均合併
7 天 14 小時
30 天內合併 PR
31

描述

### problem

The web console fails to load entirely for any role denied one non-essential bootstrap read. [`GetInfo`](https://github.com/apache/cloudstack/blob/main/ui/src/store/modules/user.js#L326) runs several independent calls under a single shared `Promise` and wires several to the same `reject`, including [`listLdapConfigurations`](https://github.com/apache/cloudstack/blob/main/ui/src/store/modules/user.js#L493-L497), which only sets a flag. When a role denies it the 432 rejects the shared promise before [`listApis`](https://github.com/apache/cloudstack/blob/main/ui/src/store/modules/user.js#L415) can resolve it (a race the small query usually wins), so `GetInfo` rejects and the [router guard](https://github.com/apache/cloudstack/blob/main/ui/src/permission.js#L150-L167) logs the user out instead of building routes. The tolerant pattern sits right beside it: [`listNetworkServiceProviders`](https://github.com/apache/cloudstack/blob/main/ui/src/store/modules/user.js#L485) swallows its own error and the console still loads (`listGuiThemes` likewise).

**Expected:** a denied non-essential read degrades like `listNetworkServiceProviders`/`listGuiThemes`. **Actual:** blank console, redirect to `/user/login`.

### versions

4.22 and current `main`. Client-side UI only; hypervisor/storage/network irrelevant.

### The steps to reproduce the bug

1. Create a custom role (e.g. from the DomainAdmin base type) that denies `listLdapConfigurations`.
2. Assign an account to it.
3. Log in to the web UI — the console never renders and you are redirected to login.

### What to do about it?

Give `listLdapConfigurations` (and any non-essential bootstrap read) its own `.catch` that defaults the flag, as [`listNetworkServiceProviders`](https://github.com/apache/cloudstack/blob/main/ui/src/store/modules/user.js#L485) already does. The underlying hazard is the shared `resolve`/`reject` across independent calls in `GetInfo`; reserve `reject` for genuinely essential calls such as `listApis`.

貢獻指南

開啟貢獻指南

研究方向

從 ui/src/store/modules/user.js 中的 GetInfo 開始,重點查看 listLdapConfigurations 以及容錯的 listNetworkServiceProviders/listGuiThemes 處理器。檢查 ui/src/permission.js 以了解路由守衛的失敗路徑。完成的標準是:被拒絕的非必要 bootstrap 讀取將其旗標設定為預設值,而不會拒絕 GetInfo,從而載入主控台,而不是重新導向至 /user/login。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
javascript
領域
frontend
Issue 類型
缺陷
難度
2/5
預估耗時
1-3 小時
活躍度
活躍
描述清晰度
描述清楚
新手友好度
85/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。