Keep step-up elevation for the signed-in session and stop gating terminals
The proxy forwards an HMAC-derived session id (X-Pipelines-Session) on /connect and POST /files; the server trusts it only on token-authenticated requests and keys elevation by it, so reconnects stay elevated up to a 24 h cap. Terminals rely on their su -l login. The app no longer forgets the elevation on disconnect and asks again only on a fresh refusal.
This commit is contained in:
@@ -214,6 +214,21 @@ export class AuthStore {
|
||||
return { id, expires: Number(expires), issued: Number(issued) };
|
||||
}
|
||||
|
||||
/**
|
||||
* The opaque id the Pipelines server keys step-up elevation by, for a valid
|
||||
* token, else "". It is an HMAC (under the cookie secret) of the token's
|
||||
* generation and id, never the cookie: a new sign-in, a password change or
|
||||
* a revoke-all yields a new id, so the old elevation is never named again.
|
||||
*/
|
||||
sessionId(token) {
|
||||
const session = this.check(token);
|
||||
if (!session) return "";
|
||||
const { generation } = this.load();
|
||||
return createHmac("sha256", this.load().secret)
|
||||
.update(`pipelines-elevation-session.v1.${generation}.${this.notBefore}.${session.id}`)
|
||||
.digest("base64url");
|
||||
}
|
||||
|
||||
/** Signs one token out (server-side logout). */
|
||||
revoke(token) {
|
||||
const session = this.check(token);
|
||||
|
||||
Reference in New Issue
Block a user