Repository navigation
fix(ui): derive a session's tenant from its claim as the REST extractor does - #3371
Open
angela-helios wants to merge 2 commits into
Open
angela-helios wants to merge 2 commits into
angela-helios wants to merge 2 commits into
Conversation
…or does The UI bound a session to its token's tenant claim as issued. An empty claim became the empty tenant, and a reserved or malformed claim was used as is, while the API treats the first as claimless and refuses the others. TenantId::from_claim now holds the rule and both the REST extractor and the UI use it. An empty claim falls back to the default tenant. A refused claim leaves the session with no tenant: the pages that read tenant state from the process answer 403 and no tenant is selectable. Closes #2934
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2934
Behaviour change to review
__system__) is bound to no tenant. Home and the subscription inventory answer403with a new notice (auth-tenant-claim-refused, en/es/de), the tenant selector does not offer the claim, andPOST /ui/tenantanswers403for every choice. This also applies to a session with asystem/*.rscope: the scope no longer lets it pick a registered tenant, since the API refuses that token for every tenant.Summary
The web UI took a session's tenant claim as issued, while
TenantExtractor::resolvetreats an empty claim as no claim and refuses an unparseable or reserved one. The two now share one rule.TenantId::from_claim(helios-persistence) returns no tenant for an absent or empty claim, the tenant for a claimTenantId::parseaccepts, and an error otherwise.parsealready refuses reserved ids.TenantExtractor::resolveuses it in place of its own empty filter and parse. Status and message are the same as before.claimed_tenantandtenant_allowedderive the session's tenant through it. A refused claim gives the session no tenant.refuse_unverified_tenant_readsandRequestTenant::live_countscover it. A second marker selects a notice that names the tenant claim rather than token verification.Not in this change: the claimed tenant is still not checked against the tenant registry, and the administrative pages'
system/*gate is unchanged.Tests
helios-persistence: unit tests and a doctest forTenantId::from_claim(absent, empty, valid, reserved, malformed).helios-rest: existingextractors::tenanttests, as the extractor now goes through the shared function.helios-uilogin_http.rs: new cases for an empty claim (default tenant, no empty option), a reserved claim, an unparseable claim, and a reserved claim with asystem/*.rscope.helios-uilocale key parity for the new key.Results:
cargo test -p helios-persistence --libwith all backend features, filtered to the modules the pending fixes touch (among themerror::,tenant::id,backends::sqlite::backend): 1081 passed.cargo test -p helios-rest --lib: 1131 passed.cargo test -p helios-ui --lib: 396 passed.--test login_http: 26 passed.--test i18n_http: 10 passed.These ran on a branch that also carried other pending fixes, so the suites were verified in combination, not on this branch alone.