mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 07:33:12 +09:00
Require a token to scrape /metrics
The metrics endpoint fans out a gather to every connected host, so anyone who could reach the controller could read cluster statistics and put load on all hosts at will. Scraping now needs a user token holding the new core.controller.metrics permission. The token is accepted via Authorization: Bearer as well as X-Access-Token because Prometheus can only send the former. Concurrent scrapes share one gather so hosts see at most one metrics request at a time. The three connection gauges in controller.ts now no-op before the controller exists, like the other gauges there, so the endpoint can be tested against the mock controller. Closes #1009 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
2b981a5734
commit
87aa7b3b4c
6 files changed
+151
-10
No files matched your search
@@ -165,6 +165,7 @@ export class MockController {
|
||||
["controller.public_url", "test"],
|
||||
["controller.auth_secret", "TestSecretDoNotUse"],
|
||||
["controller.proxy_stream_timeout", 1],
|
||||
["controller.metrics_timeout", 1],
|
||||
]);
|
||||
this.config = {
|
||||
get: (name) => {
|
||||
@@ -199,6 +200,7 @@ export class MockController {
|
||||
this.handles = new Map();
|
||||
this.hooks = new ControllerHooks(new MockLogger());
|
||||
this.loadedPlugins = new Set();
|
||||
this.wsServer = { hostConnections: new Map() };
|
||||
}
|
||||
|
||||
get authSecret() {
|
||||
|
||||
Reference in new issue
Block a user