make the old GET endpoint return an upgrade message (#859)

This commit is contained in:
Michael Quigley 2025-02-10 13:11:18 -05:00
parent 7d6feba2e9
commit e8691803b2
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
6 changed files with 10 additions and 7 deletions

View File

@ -18,6 +18,8 @@ CHANGE: Refactored API implementation. Cleanup, lint removal, additional data el
CHANGE: Deprecated the `passwords` configuration stanza. The zrok controller and API console now use a hard-coded set of (what we believe to be) reasonable assumptions about password quality (https://github.com/openziti/zrok/issues/834)
CHANGE: The protocol for determining valid client versions has been changed. Previously a zrok client would do a `GET` against the `/api/v1/version` endpoint and do a local version string comparison (as a normal precondition to any API call) to see if the controller version matched. The protocol has been amended so that any out-of-date client using the old protocol will receive a version string indicating that they need to uprade their client. New clients will do a `POST` against the `/api/v1/version` endpoint, posting their client version, and the server will check for compatibility. Does not change the security posture in any significant way, but gives more flexibility on the server side for managing client compatibility (https://github.com/openziti/zrok/issues/859)
## v0.4.48
FIX: the Python SDK erroneously assumed the enabled zrok environment contained a config.json file, and was changed to only load it if the file was present (https://github.com/openziti/zrok/pull/853/).

View File

@ -2,11 +2,12 @@ package controller
import (
"github.com/go-openapi/runtime/middleware"
"github.com/openziti/zrok/build"
"github.com/openziti/zrok/rest_model_zrok"
"github.com/openziti/zrok/rest_server_zrok/operations/metadata"
)
func versionHandler(_ metadata.VersionParams) middleware.Responder {
return metadata.NewVersionOK().WithPayload(rest_model_zrok.Version(build.String()))
outOfDate := "your local zrok installation is out of date and needs to be upgraded! " +
"please visit 'https://github.com/openziti/zrok/releases' for the latest build!"
return metadata.NewVersionOK().WithPayload(rest_model_zrok.Version(outOfDate))
}

View File

@ -42,7 +42,7 @@ func NewVersionOK() *VersionOK {
/*
VersionOK describes a response with status code 200, with default header values.
current server version
legacy upgrade required
*/
type VersionOK struct {
Payload rest_model_zrok.Version

View File

@ -1903,7 +1903,7 @@ func init() {
"operationId": "version",
"responses": {
"200": {
"description": "current server version",
"description": "legacy upgrade required",
"schema": {
"$ref": "#/definitions/version"
}
@ -4108,7 +4108,7 @@ func init() {
"operationId": "version",
"responses": {
"200": {
"description": "current server version",
"description": "legacy upgrade required",
"schema": {
"$ref": "#/definitions/version"
}

View File

@ -17,7 +17,7 @@ import (
const VersionOKCode int = 200
/*
VersionOK current server version
VersionOK legacy upgrade required
swagger:response versionOK
*/

View File

@ -988,7 +988,7 @@ paths:
operationId: version
responses:
200:
description: current server version
description: legacy upgrade required
schema:
$ref: "#/definitions/version"