package protocol // Step-up re-authentication. A signed-in web session can read everything, but // running shell commands, typing into a shell, changing or uploading files and // opening a terminal additionally need a recent password confirmation on the // same connection. The server verifies the password against the web sign-in // password file; the elevation lasts for a bounded time (15 minutes by // default) and ends with the connection. const ( // Elevate confirms the sign-in password (Message.Password). The reply is // Elevated, or Error with Code ErrorElevationFailed or // ErrorElevationUnavailable. Elevate = "elevate" // Elevated carries Elevation: when it ends and the upload token. Elevated = "elevated" // ErrorElevationRequired types the refusal of a gated request on a // connection that is not (or no longer) elevated. Clients confirm the // password with Elevate and retry. ErrorElevationRequired = "elevation_required" // ErrorElevationFailed types a wrong password or a rate-limited attempt. ErrorElevationFailed = "elevation_failed" // ErrorElevationUnavailable types an elevate on a server without a web // sign-in password file (nothing is gated there). ErrorElevationUnavailable = "elevation_unavailable" // ElevationHeader carries Elevation.Token on POST /files. A refused upload // answers 403 with a JSON body {"code":"elevation_required","error":...}. ElevationHeader = "X-Pipelines-Elevation" ) // Elevation is the elevated reply body. type Elevation struct { // ExpiresAt is RFC 3339 UTC; Seconds is the remaining lifetime, for // clients whose clock differs from the server's. ExpiresAt string `json:"expires_at"` Seconds int `json:"seconds"` // Token authorises HTTP uploads for as long as this connection stays // elevated. It is random, held only in memory and never logged. Token string `json:"token,omitempty"` }