Repository navigation
feat(authz): step-up freshness for remote-mode admin-tier routes (wiki-v2 issue 713) - #71
Merged
Merged
Conversation
…i-v2 docmost#713) The platform's browser mint (/api/service/session) now passes the human's token-bound auth_time and freshUntil. The service bridge validates both (both or neither, safe ints, authTime <= now+60, window <= 24h) and stores them on the new user_sessions row's metadata. Freshness is per row, never per user. RemoteStepUpInterceptor (remote mode only, registered before RemotePurgeInterceptor) refuses with 403 step_up_required, never 401, unless the request's own session row is inside its window. Gated: - permanent purge (PageController.delete, conditionalDelete) - the five page-restriction writes - spaces/update Reads (export) and share writes are recorded as not stepped up. remote-step-up.fitness.spec.ts pins the table both ways. The client redirects an /api 403 step_up_required to /console/confirm?return=<path>. safeRedirectPath also rejects a dot-segment path that normalizes to //host (an open redirect via /login?redirect=). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…3.0 (wiki-v2 docmost#713 review) MintSessionRequest now declares authTime and freshUntil, plus the window ceiling and clock skew as x- values. The provider test pins the schema key set to MintSessionDto's own keys and the x- values to the constants mintFreshness enforces, so a rename on either side fails a test instead of the whitelist pipe silently stripping the platform's freshness. Co-Authored-By: Claude Opus 5.5 <[email protected]>
PMQ9
added a commit
that referenced
this pull request
Nov 6, 2026
Resolves the service-bridge contract version: docmost#704 took 1.12.0 and docmost#713 took 1.13.0, so the docmost#716 additions (actorIdentityId, RateLimitedOrConversionBudget, ConversionBudgetExhaustedError) move to 1.14.0, with a 1.14.0 sentence in info.description and the README paragraph renumbered to match. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
TL;DR
In remote mode, permanent purge, the five page-restriction writes and
spaces/updatenow need a recent sign-in. The check reads the platform's step-up window stored on the request's own wiki session row. A stale session gets 403step_up_required(never 401), and the wiki sends the user to the console's confirm page.This is the fork half of cccvu/wiki-v2 issue 713 (ADR 0034), paired with the super PR on branch
fix/713-653-638-336-sessions-devstack.What changed
Mint (
service-bridge/)POST /api/service/sessionaccepts optionalauthTimeandfreshUntil(epoch seconds). Either both are sent or neither.authTime <= now+60;freshUntil > authTime;user_sessions.metadatarow, scoped by id + user, not revoked. If stamping fails, the session is revoked and the call returns 500.SessionServiceis unchanged.service-bridge.openapi.jsondeclares the pair onMintSessionRequest, with the window ceiling and clock skew asx-values. The provider test pins the schema toMintSessionDto's own keys and those values tomintFreshness's constants; the platform's consumer test pins its mint body to the same schema (review fix).Gate (
authz/step-up/)RemoteStepUpInterceptor+remote-step-up.table.ts, remote mode only. The gated routes:PageController.deleteandConditionalPageOpsController.conditionalDelete, whenpermanentlyDeleteis anything but absent,nullorfalse;PageRestrictionControllerwrites;SpaceController.updateSpace.findActiveById(req.raw.sessionId)), so freshness is per row and never per user. It fails closed on missing or garbled metadata, a futureauthTime, a window over 24h, ornow >= freshUntil.app.module.ts(seam 4) afterRemoteNativeRefusalInterceptorand beforeRemotePurgeInterceptor. The purge interceptor never calls the handler, so a later step-up check would be skipped. The ordering is pinned by AST.Client
lib/api-client.ts(seam 7) →features/request-errors/step-up.ts. An/api403step_up_requiredtriggerslocation.assign('/console/confirm?return=…'). It never fires on share or public routes. The error still rejects, and the 401 self-heal is untouched.lib/app-route.ts(seam 8):safeRedirectPathnow rejects dot-segment paths that normalize to//host. This was an older open redirect via/login?redirect=/..//evil.com, found in review.Tests
safeRedirectPath.session-freshness.pg.spec.tsruns in thedocmost-authz-pglane; it self-skipped locally.check-upstream-boundary.shpasses. Only seams 4, 7, 8 and 162 are touched, andUPSTREAM_MODIFICATIONS.md(super repo) is updated.Merge order: this PR first (merge commit), then re-pin the super gitlink to the merge SHA, then the super PR.
🤖 Generated with Claude Code