Blank UI after successful SAML2 SSO login for non-root-admin users (`primate__MS_ID` stored as `"undefined"`)
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 48/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- java, javascript
- Domínio
- authentication, frontend
Direção de pesquisa
Start in ui/src/permission.js at the SAML branch that commits the managementserverid cookie, then read SET_MS_ID in ui/src/store/modules/user.js and compare with the native login guard in user.js. Reproduce with a non-root SAML login and inspect primate__MS_ID and the GetInfo error. Done means the UI loads without persisting an undefined ID, while root-admin and native login behavior remains intact.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
problem
COMPONENT NAME
UI, SAML2 plugin
CLOUDSTACK VERSION
4.22.1.1 (the code paths below are verified in tag 4.22.1.1)
CONFIGURATION
- KVM, Advanced zone
- SAML2 plugin enabled, IdP: Keycloak (SP-initiated, HTTP-POST binding)
- User authorized for SAML SSO via
authorizeSamlSso; role type DomainAdmin (same username present in two domains)
SUMMARY
After a successful SAML2 SSO login, the UI never finishes loading (blank page or endless spinner) for any user who is not a Root Admin. Native login for the same user works. All APIs called with the SAML session return HTTP 200 (listCapabilities, listApis, listUsers, listZones, listAndSwitchSamlAccount), so the server-side session is valid. The failure is entirely in the UI.
versions
CLOUDSTACK VERSION
4.22.1.1 (the code paths below are verified in tag 4.22.1.1)ons of ACS, hypervisors, storage, network etc..
The steps to reproduce the bug
STEPS TO REPRODUCE
- Enable SAML2 (
saml2.enabled=true) and configure an IdP. - Authorize a Domain Admin or User for SAML SSO.
- Log in through the IdP.
- After the redirect back to
/client, the UI stays blank.
EXPECTED RESULTS
The UI loads the dashboard.
ACTUAL RESULTS
Browser console:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
get webStorage.js:20
GetInfo user.js:319
... permission.js:104
Uncaught (in promise) TypeError: can't convert undefined to object
GenerateRoutes permission.js:74
localStorage.getItem('primate__MS_ID') returns the literal string "undefined", and no managementserverid cookie is set after samlSso.
What to do about it?
ROOT CAUSE
- Server:
ApiServer.loginUser()only putsmanagementserveridinto the session for root admins:
For any other user,if (accountMgr.isRootAdmin(userAcct.getAccountId())) { ... session.setAttribute(ApiConstants.MANAGEMENT_SERVER_ID, msHost.getUuid()); }SAMLUtils.addBaseCookies()therefore sets nomanagementserveridcookie. That part is correct and intended. - UI, SAML branch (
ui/src/permission.js): the UI commits the cookie value without checking it:
The native login path instore.commit('SET_MS_ID', Cookies.get('managementserverid')) // undefined for non-root usersuser.jsdoes guard against this (if (result && result.managementserverid)). - UI store (
SET_MS_IDinui/src/store/modules/user.js) persists the value as is:$localStorage.set(MS_ID, undefined). This leavesprimate__MS_ID = "undefined"in localStorage. - On the next
GetInfo,$localStorage.get(MS_ID, false)callsJSON.parse("undefined"), which throws.GetInforejects,GenerateRoutesreceivesundefined, and no routes are generated. The UI stays blank.
Clearing localStorage does not help, because the permission.js SAML branch writes the bad value again on every page load.
WORKAROUND
Once the page is blank, run this in the browser console (any non-empty value works, because only root admins use msId):
document.cookie = 'managementserverid=<ms-uuid>; path=/client';
localStorage.setItem('primate__MS_ID', JSON.stringify({ value: '<ms-uuid>', expire: null }));
location.reload();
PROPOSED FIX
A patch is attached (saml-msid-fix.patch):
ui/src/permission.js: commit the management server ID only when the cookie exists. Also checkpath: '/client', consistent with the other SAML cookies.const msId = Cookies.get('managementserverid') || Cookies.get('managementserverid', { path: '/client' }) if (msId) { store.commit('SET_MS_ID', msId) }ui/src/store/modules/user.js: makeSET_MS_IDsafe so it never persistsundefined, which also protects any other caller:SET_MS_ID: (state, msId) => { state.msId = msId || '' if (msId) { vueProps.$localStorage.set(MS_ID, msId) } else { vueProps.$localStorage.remove(MS_ID) } },SAMLUtils.addBaseCookies()(consistency): create themanagementserveridcookie with the same domain and path as the other SAML cookies (newCookie(domain, path, ...)instead ofnew Cookie(...)). Then root admins get the cookie on the redirect target path even whensaml2.redirect.urlhas a different path from the ACS endpoint.
Fixes 1 and 2 on their own resolve the bug. Fix 3 is a hardening change.
TESTING
- SAML login as Root Admin:
managementserveridcookie set,primate__MS_IDholds the UUID, shutdown and maintenance banner checks work. - SAML login as Domain Admin or User: no cookie, no
primate__MS_IDentry, UI loads. - Native login and logout: unchanged (logout calls
SET_MS_ID(''), which now removes the key). - Users whose browser already holds a stale
primate__MS_ID = "undefined": optionally makeGetInfotolerate unparsable values. With fix 2 in place, the next SAML login removes the key, butGetInforuns before that, so a one-off cleanup inpermission.js, or atry/catcharound the storageget, would make the upgrade path seamless.
- Linguagem predominante
- Java
- Estrelas
- 3.1k
- Forks
- 1.4k
- Merge médio
- 7d 16h
- PRs com merge (30d)
- 15
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de apache/cloudstack
-
resizeVolume of a running system VM's volume is accepted but the VM never sees the new sizeTalvez já em andamento @bhouse-nexthop assumiu há 3 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
apache/cloudstack#14645 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
VR reports a load balancer change as applied when haproxy.cfg cannot be replacedTalvez já em andamento @bhouse-nexthop assumiu há 3 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/cloudstack#14633 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
restartNetwork reports a ResourceUnavailableException as an unexpected error (530), unlike restartVPC (534)Talvez já em andamento @bhouse-nexthop assumiu há 3 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/cloudstack#14631 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
apache/cloudstack#14625 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Remote access VPN users are disconnected on every LB, ACL, port forward or firewall change (xl2tpd restarted on every iptables pass)Talvez já em andamento @willbennett-devops assumiu há 12 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
apache/cloudstack#14545 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de apache/cloudstack
Issues semelhantes
-
[FEATURE] Expose external refresh, node-level translog and warmer statsTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertauntriaged
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
opensearch-project/opensearch-prometheus-exporter#680 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
Mantenedores costumam responder em até 2 dias
-
bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
-
Good First Issue
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 88/100
hiero-ledger/hiero-sdk-java#3059 ·
Mantenedores costumam responder em até 1 dia