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:
@@ -71,7 +71,7 @@ type Options struct {
|
||||
AccessToken string
|
||||
// WebAuthFile is the web sign-in password file step-up re-authentication
|
||||
// verifies against (see elevation.go); empty disables the gate.
|
||||
// ElevationTTL is how long one confirmation lasts (default 15 minutes).
|
||||
// ElevationTTL caps how long one confirmation lasts (default 24 hours).
|
||||
WebAuthFile string
|
||||
ElevationTTL time.Duration
|
||||
}
|
||||
@@ -233,7 +233,10 @@ func HandlerWithOptions(ctx context.Context, options Options, stores ...*pipelin
|
||||
// clientID is this connection's identity for chat session claims: a
|
||||
// second client is refused a session another connection holds.
|
||||
clientID := chatClientToken()
|
||||
defer elevation.forget(clientID)
|
||||
// Elevation belongs to the web session the proxy reported, so a
|
||||
// reconnect stays elevated; without one, to this connection alone.
|
||||
elevationKey := elevationKeyFor(trustedSession(r), clientID)
|
||||
defer elevation.closed(elevationKey)
|
||||
// Drop every run subscription this connection holds when the read loop
|
||||
// returns, so no subscriber, goroutine or timer outlives the connection.
|
||||
defer events.unsubscribeClient(clientID)
|
||||
@@ -284,7 +287,7 @@ func HandlerWithOptions(ctx context.Context, options Options, stores ...*pipelin
|
||||
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: "pipeline authoring is disabled on this execution server; ask the operator to publish through an explicitly enabled authoring server"})
|
||||
continue
|
||||
}
|
||||
if elevation.handle(request, clientID, write) || elevation.refuse(request, clientID, write) {
|
||||
if elevation.handle(request, elevationKey, write) || elevation.refuse(request, elevationKey, write) {
|
||||
continue
|
||||
}
|
||||
if isChatSearch(request) {
|
||||
|
||||
Reference in New Issue
Block a user