Repository navigation
Description
Summary
https://grafana.docs.plus/metrics answers 200 to anyone, with no sign-in. It returns Grafana's internal Prometheus metrics, including alert rule group names and request counts by route. This issue changes one Traefik router label, so the public router no longer serves any path under /metrics. Grafana's sign-in pages and API keep working. It also turns Grafana's metrics off at the source, so a later router change cannot make them public again.
Benchmark
| Field | Value |
|---|---|
| Metric | (1) Probed public paths that return Grafana metrics, count out of 6. (2) Bytes on GET https://grafana.docs.plus/metrics with no sign-in. |
| Before | Laptop curl with no credentials, 2026-11-11 12:08Z: (1) 4 of 6 (/metrics, //metrics, /./metrics, /%6detrics). (2) 905,142 B, 5,895 samples. |
| After | Not measured yet. |
| Condition | Public internet, production Traefik, within 15 minutes of the observability deploy. Responses are deterministic, so n = 1 per path. |
| How to run | The Verify loop, with %{size_download} in the -w format. Inside the Grafana container: docker exec docsplus-grafana wget -qO- http://localhost:3000/metrics. |
| Pass rule | (1) 0 of 6, with 0 grafana_build_info lines on every path. (2) Traefik's 404 body, under 100 B. Inside the container, wget fails with 404. Stop rule: if /login stops answering 200, or more alert rules are in Error than before, revert the commit. |
| Guard | Grafana /login answers 200. /api/health shows "database": "ok". The count of alert rules in Error is the same or fewer than before the deploy. The observability deploy ends success. |
| Owner | Agent in the repo: steps 1-2, 4 and the Verify loop. Maintainer: step 3, the alert-rule count and the in-container read. |
| Claim | "Grafana's internal metrics are no longer public: 905,142 B readable by anyone → 0." |
Rows
| Metric | Before (2026-11-11 12:08Z) | After |
|---|---|---|
| Probed public paths that return Grafana metrics | 4 of 6 | Not measured yet |
Bytes on GET https://grafana.docs.plus/metrics, no sign-in |
905,142 B, 5,895 samples | Not measured yet |
/metrics from inside the Grafana container |
Served | Not measured yet |
Grafana /login |
200 |
Not measured yet |
/api/health database field |
"database": "ok" |
Not measured yet |
Alert rules in Error |
Not counted; it can no longer be taken (review, 2026-11-16) | Covered by the #753 check: 66 provisioned, all healthy |
| Observability deploy | — | Not measured yet |
Evidence
-
curlfrom a laptop, 2026-11-11 12:08Z, no credentials.GET https://grafana.docs.plus/metricsreturned200, 905,142 bytes and 5,895 samples. It holds 50grafana_http_request_duration_seconds_countseries and onegrafana_alerting_rule_group_rulesseries per rule group, each with the group name. -
Same read.
//metrics,/./metricsand/%6detricsalso return the metrics./metrics/,/METRICSand/%2Fmetricsreturn a302to the sign-in page. -
Read from code at
0b302b222.docker-compose.observability.yml:134is the router rule:- 'traefik.http.routers.grafana.rule=Host(`grafana.docs.plus`)'The rule sends every path on that host to Grafana. Grafana serves
/metricswithout auth by default. The service at:112-148sets noGF_METRICS_*variable. -
Read from code. No Prometheus job scrapes Grafana (
scripts/observability/prometheus/), so nothing in our stack reads this endpoint. -
Local probe, 2026-11-11. A router with the rule in step 1, in front of a backend that answers
200on every path. On Traefik3.6.25(production today) and on3.7.18:/and/api/health→200;/metrics,/metrics/,//metrics,/./metrics,/x/../metrics,/%6detricsand/metrics%2F→404from Traefik;/METRICSand/%2Fmetricsstill reach the backend. Grafana answers both with a302today, as above.
Risk
The endpoint shows a stranger our alert rule group names, alerting activity, request counts by route and Go runtime details. That maps our monitoring for anyone who wants to avoid it. It costs nothing to close. (/api/health also prints the version; that stays, because it holds nothing else.)
Steps
Deploy: one observability deploy. It recreates the Grafana container, so Grafana is down for a few seconds. Traefik does not restart. If #743 step 4 ran since the last observability deploy, this deploy recreates Loki, Prometheus, Grafana, Alloy and blackbox (#743 step 4g). Do not take another issue's observability before read that day.
-
Owner: agent in the repo. Turn metrics off in Grafana, and keep the router rule as a second layer.
- Add
GF_METRICS_ENABLED: 'false'to the Grafanaenvironmentindocker-compose.observability.yml. No Prometheus job scrapes Grafana (scripts/observability/prometheus/prometheus.yml), so nothing loses data. - Edit
docker-compose.observability.yml:134to:
- 'traefik.http.routers.grafana.rule=Host(`grafana.docs.plus`) && !PathPrefix(`/metrics`)'Add one comment line above it:
# Grafana serves /metrics without auth; nothing outside the stack reads it.The
!PathPrefixrule needs no Grafana setting.GF_METRICS_ENABLEDneeds no path matching. Each one covers a mistake in the other. - Add
-
Owner: agent in the repo.
docker compose -f docker-compose.observability.yml config -q 2>/dev/null; echo rc=$?printsrc=0. On a laptop, warnings about unset variables are expected; the redirect hides them. Then a review checkpoint. -
Owner: maintainer. Depends on: Fail the observability deploy when Grafana or its provisioned rules do not load #753 live. Before the deploy, record the number of alert rules in
Error(Grafana → Alerting → Alert rules). Commit through thecommit-reviewskill with a(build): observabilitysubject, and push tomain. Or, after the commit lands, dispatch the deploy:gh workflow run observability.docs.plus.yml --repo docs-plus/docs.plus --ref main -f action=update. -
Owner: agent in the repo, from a laptop. Run Verify within 15 minutes of the deploy.
Verify
Owner: agent in the repo, from a laptop.
for p in /metrics //metrics /./metrics /%6detrics /METRICS /%2Fmetrics; do
r=$(curl -s --path-as-is -o /tmp/gm.out -w '%{http_code} %{size_download}' "https://grafana.docs.plus$p")
printf '%s %s %s\n' "$r" "$(grep -c '^grafana_build_info' /tmp/gm.out)" "$p"
done
curl -s -o /dev/null -w '%{http_code} login\n' https://grafana.docs.plus/login
curl -s https://grafana.docs.plus/api/health | grep -o '"database": *"ok"'| Line | Before (2026-11-11) | After |
|---|---|---|
/metrics |
200 905142 1 |
404 <bytes under 100> 0 |
//metrics, /./metrics, /%6detrics |
200 <bytes> 1 |
404 <bytes under 100> 0 |
/METRICS, /%2Fmetrics |
302 <bytes> 0 |
302 <bytes> 0 |
login |
200 |
200 |
/api/health |
"database": "ok" |
"database": "ok" |
The columns are the status, the body bytes and the count of grafana_build_info lines. The count must be 0 on every path after the fix.
Owner: maintainer, SSH. Optional (review, 2026-11-16). Inside the container, run the healthcheck's wget against /metrics instead of /api/health: docker exec docsplus-grafana wget -qO- http://localhost:3000/metrics >/dev/null; echo rc=$?. Pass: wget fails with a 404, so rc is not 0.
Rollback
Revert the commit and deploy with (build): observability. The endpoint is public again.
Acceptance criteria
- Every Verify line matches the After column.
-
/metricsinside the Grafana container answers 404. Optional (review, 2026-11-16): the public probes andGF_METRICS_ENABLED: 'false'already cover it. - Grafana sign-in works, and its alert rules still evaluate. Grafana → Alerting → Alert rules lists no more rules in
Errorthan before the deploy. - The observability deploy ends
success. - The Benchmark After values are posted here.
Related
- Future observability work may scrape Grafana inside the stack. A Prometheus job reaches the container on the Docker network, not through this router. Such work must first set
GF_METRICS_ENABLEDback totrue, behind basic auth (GF_METRICS_BASIC_AUTH_*).
Activity
fix(observability): stop serving Grafana /metrics publicly
docs(observability): say why the Grafana router still refuses /metrics
HMarzban commentedon Nov 12, 2026
Measured, 2026-11-12: production after the observability deploy. Run 43224277563 (
(build): observability,f61647754). Steps 1 to 8 passed, including "Deploy stack" at 13:08:16Z. A newer push cancelled the last step, Verify, during its wait, so its checks were read by hand, read-only, at about 13:12Z.GET https://grafana.docs.plus/metricsGrafana runs with
GF_METRICS_ENABLED=false, and the router refuses/metricsas a second layer.HMarzban commentedon Nov 14, 2026
Moved to v2.3.7 at the v2.3.6 release audit. The after shows only /metrics 404. The other 5 paths, bytes, in-container read and alert-rule count are not posted.
HMarzban commentedon Nov 16, 2026
Measured, 2026-11-16
Steps 1 and 2 were already live (
d272c50f3,0a4de0890, deployed in run 43224277563 on 2026-11-12). This pass changed no file. It re-checked the compose config and read the public paths from a laptop. The read ran 4 days after the deploy, not within 15 minutes of it, so it shows the steady state, not the first minutes.What changed
GF_METRICS_ENABLED: 'false'is set, and the router rule isHost(`grafana.docs.plus`) && !PathPrefix(`/metrics`).docker compose -f docker-compose.observability.yml config -q 2>/dev/null; echo rc=$?printsrc=0.Before and after
curl, no credentials, production Traefik, 4 days after the deployGET /metrics, no sign-in200404, 0grafana_build_infolines//metrics,/./metrics,/%6detrics200, metrics404 19 0each/METRICS,/%2Fmetrics302302 51 0,302 56 0/login200200/api/health"database": "ok""database": "ok"/metricsinside the Grafana containerErrorThe read printed only status codes and byte counts. The bodies were deleted.
Verify loop (run within 15 minutes of the next observability deploy)
Inside the container (maintainer, SSH):
Pass: every metrics path shows
404 <under 100> 0./METRICSand/%2Fmetricsshow302 <bytes> 0.loginshows200./api/healthshows"database": "ok". The in-containerrcis not0.Gates
docker compose -f docker-compose.observability.yml config -q: pass (rc=0).bunx prettier --check docker-compose.observability.yml: pass.Left
Errorbefore the next observability deploy, then after it.wgetread over SSH.HMarzban commentedon Nov 16, 2026
Measured, 2026-11-16: Verify loop after the observability deploy
Run from one laptop at 2026-11-16 13:47:54Z, 4 minutes after the
(build): observabilitydeploy (288d4d260, run 43878530215, started 13:43:32Z). That deploy recreated Grafana.Pass: every metrics path shows
404 <under 100> 0,/METRICSand/%2Fmetricsshow302 <bytes> 0, login is200, and/api/healthshows"database": "ok". The read printed only status codes and byte counts.GET /metrics, no sign-in200404(99 % fewer)Alert rules after the deploy: 66 provisioned, all healthy (the #753 check printed
got = want = 66).Left: the in-container
wgetread (maintainer, SSH).HMarzban commentedon Nov 16, 2026
Review, 2026-11-16 (maintainer approved).
Closed: the fix is live and the Verify loop passed. The 2026-11-16 13:47Z Measured comment ran 4 minutes after deploy
288d4d260(run 43878530215). Public paths that serve Grafana metrics went from 4 of 6 to 0 of 6.GET /metricswent from 905,142 B with 200 to 19 B with 404. Login answers 200, and/api/healthshows"database": "ok". Alert rules: 66 provisioned, all healthy (#753 check,got = want = 66). That covers theErrorguard, whose before count can no longer be taken. The repo holds both layers:GF_METRICS_ENABLED: 'false'and the!PathPrefixrule indocker-compose.observability.yml. The body now marks the in-containerwgetoptional, so it does not hold the issue.