Repository navigation
Conversation
GetInfo runs a dozen independent bootstrap calls inside a single Promise and wires several of them to the same reject. listLdapConfigurations is one of those, and all it does with the answer is record whether LDAP is configured. When a role denies that API the 432 rejects the shared promise, and it wins the race against listApis resolving it because it is a far smaller query. GetInfo then rejects, and the router guard in permission.js treats that as a failed session and logs the user out, so the console never renders at all. Default the flag and let the console finish loading instead, matching listNetworkServiceProviders and cloudianIsEnabled either side of it, which already swallow their own errors. Fixes apache#13912
…denied-blocks-console
|
A heads-up on CI for this one, in case it saves someone a lookup: none of the workflow runs on the earlier head were ever approved, so they expired after 30 days (all 8 were created on Sep 11 and all failed with no jobs at the same minute today). So this change has never actually been tested. I've synced the branch with 4.22 (no conflicts, and the diff against 4.22 is still just the 4 lines in |
|
Thanks for you patience @stag7824 , I started them now |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14152 +/- ##
============================================
- Coverage 18.02% 18.01% -0.01%
+ Complexity 16248 16244 -4
============================================
Files 5936 5936
Lines 535866 535866
Branches 65614 65614
============================================
- Hits 96574 96540 -34
- Misses 428291 428334 +43
+ Partials 11001 10992 -9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
Fixes #13912
A role that denies
listLdapConfigurationscannot use the web console at all: the UI neverrenders and the user is redirected back to
/user/login.GetInfoinui/src/store/modules/user.jsruns about a dozen independent bootstrap callsinside a single
new Promise, and several of them are wired to that one sharedreject.listLdapConfigurationsis one of them, and all it does with the answer is record a flag:When the role denies it, the 432 rejects the shared promise. That is a race against
listApisresolving it, and the tiny denied query almost always settles first, soGetInforejects. The router guard in
ui/src/permission.jstreats a rejectedGetInfoas a failedsession and logs the user out instead of building routes — so one denied flag read takes down
the whole console.
The tolerant pattern is already in the same function, a few lines away.
listNetworkServiceProvidersandcloudianIsEnabledboth swallow their own error and theconsole loads fine without them. This change gives
listLdapConfigurationsthe sametreatment, defaulting the flag rather than rejecting:
Defaulting to
falsematches what the flag already means elsewhere —Logoutresets it, anda denied read is not evidence that LDAP is configured.
Scope
I have deliberately changed only the call named in the issue.
listCapabilities,listZonesand the second
listUsersare wired to the same sharedrejectand carry the same hazard,but unlike this one they are not pure flag reads, so whether each is "essential" is a call for
you rather than for me. Happy to widen this PR if you'd like them handled together, or to
leave that to a follow-up.
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
I could not add a unit test for this proportionately:
user.jsimports@/router,@/storeand
@/vue-app, there are no existing tests for any store module to build on, and standingthat scaffolding up for a three-line change seemed like more maintenance burden than it is
worth. Happy to add one if you disagree.
What I did instead was reduce
GetInfo's promise structure to a runnable model — a latelistApisthat resolves, a tolerant denied call, and the deniedlistLdapConfigurations—and run it both ways:
which reproduces the reported behaviour and the race described in the issue: the small denied
query settles before
listApiscan resolve the shared promise.I also ran what CI runs, on Node 16 to match
.github/workflows/ui.yml:vue-cli-service lintautofixes by default, so I checked separately that it left the fileuntouched rather than quietly reformatting the change into shape.
I do not have a deployment with custom roles to confirm the console rendering end to end, so
that part is unverified by me. The change itself is the same shape as the two tolerant calls
either side of it.
The same construction is present on 4.20 (it uses
api(rather thangetAPI(there). I havetargeted 4.22 since that is what the issue names, but happy to retarget.