Skip to content

Admin-only version endpoint, no metrics on the API port - #9

Closed
CorentinFelten wants to merge 2 commits into
masterfrom
feat/admin-version
Closed

CorentinFelten wants to merge 2 commits into
masterfrom
feat/admin-version

Conversation

@CorentinFelten

Copy link
Copy Markdown
Owner

Two commits:

  • GET /admin/version returns the running version ({"version": "0.7.3"}), for Zync's compatibility check. Admin tokens only: no token, a wrong key, an unsigned or expired token get 401, player tokens 403, never with the version. /health is unchanged.
  • The API port no longer serves /metrics, which skipped authentication and exposed challenge names and team IDs. Metrics stay on the metrics server (port 5001, basic auth when metrics.password is set), which the provided Prometheus configuration already scrapes; nothing else used the API port's route.

Zync needs Galvanize's version to check that the two are compatible.
The project is open source, so a version also tells anyone which known
issues a deployment has: it is reported to admins only.

GET /admin/version returns {"version": "..."}, the version set at
startup (ServerOpts.Version, from the binary's Version). Like every
route but /health and /metrics, it requires a valid HS256 token signed
with the JWT secret, and the handler refuses any role but admin, so
requests without a valid token get 401 and player tokens 403, without
the version. /health is unchanged.

The JWT middleware setup moves to jwtMiddleware, so tests send real
requests through it: no token, a wrong key, an unsigned (alg none)
token, an expired admin token, player and role-less tokens.
The API served /metrics on its own port, skipped by the JWT
middleware, so anyone who could reach the API read every metric:
challenge names, team IDs, deployment counts. The route predates the
metrics server on :5001 (basic auth when metrics.password is set),
added later with the Prometheus and Grafana stack, which scrapes
instancer:5001 as the README documents.

Nothing else uses the API port's route: not the monitoring stack, the
load test, Zync, nor ctfd-management, whose Traefik router already
excludes /metrics. It is removed, along with its JWT exemption: the API
port now answers /metrics with 401, or 404 with a token. Request
metrics are still gathered and served on :5001, unchanged.
@CorentinFelten

Copy link
Copy Markdown
Owner Author

Superseded by #10, which combines all current changes into one PR.

@CorentinFelten
CorentinFelten deleted the feat/admin-version branch October 2, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant