From 2b87dc1c3d64b5fdcf1bd82234ab57619f82f015 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Mon, 2 Nov 2026 02:57:31 +0100 Subject: Remove version string from what is reported over http --- ot_http.c | 1 - ot_stats.c | 6 ------ ot_workqueue.h | 1 - tests/integration/test_stats.py | 16 +++++++++++----- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/ot_http.c b/ot_http.c index 980e256..b243ff6 100644 --- a/ot_http.c +++ b/ot_http.c @@ -289,7 +289,6 @@ static ssize_t http_handle_stats(const int64_t sock, struct ot_workstruct *ws, c {"top10", TASK_STATS_TOP10}, {"renew", TASK_STATS_RENEW}, {"syncs", TASK_STATS_SYNCS}, - {"version", TASK_STATS_VERSION}, {"everything", TASK_STATS_EVERYTHING}, {"statedump", TASK_FULLSCRAPE_TRACKERSTATE}, {"woodpeckers", TASK_STATS_WOODPECKERS}, diff --git a/ot_stats.c b/ot_stats.c index 59a9f04..8771f0c 100644 --- a/ot_stats.c +++ b/ot_stats.c @@ -514,9 +514,6 @@ static void stats_return_everything(char **reply, const char *reply_end) { fmt_append(reply, reply_end, "\n"); fmt_append(reply, reply_end, "\n"); fmt_append(reply, reply_end, " %" PRIu32 "\n", g_tracker_id); - fmt_append(reply, reply_end, " \n"); - stats_return_tracker_version(reply, reply_end); - fmt_append(reply, reply_end, " \n"); fmt_append(reply, reply_end, " %llu\n", (unsigned long long)(time(NULL) - ot_start_time)); fmt_append(reply, reply_end, " \n"); fmt_append(reply, reply_end, " %zd\n", mutex_get_torrent_count()); @@ -666,9 +663,6 @@ void return_stats_for_tracker(char **reply, const char *reply_end, int mode, int case TASK_STATS_HTTPERRORS: stats_httperrors_txt(reply, reply_end); break; - case TASK_STATS_VERSION: - stats_return_tracker_version(reply, reply_end); - break; case TASK_STATS_RENEW: stats_return_renew_bucket(reply, reply_end); break; diff --git a/ot_workqueue.h b/ot_workqueue.h index 8fa80d0..4acd6fd 100644 --- a/ot_workqueue.h +++ b/ot_workqueue.h @@ -23,7 +23,6 @@ typedef enum { TASK_STATS_FULLSCRAPE = 0x0005, TASK_STATS_TPB = 0x0006, TASK_STATS_HTTPERRORS = 0x0007, - TASK_STATS_VERSION = 0x0008, TASK_STATS_RENEW = 0x000a, TASK_STATS_SYNCS = 0x000b, TASK_STATS_COMPLETED = 0x000c, diff --git a/tests/integration/test_stats.py b/tests/integration/test_stats.py index 7b778d3..74f6d47 100644 --- a/tests/integration/test_stats.py +++ b/tests/integration/test_stats.py @@ -18,7 +18,7 @@ from harness import TrackerTestCase # and belong to test_fullscrape; "woodpeckers" sits behind a # feature flag this build does not set. MRTG_MODES = ["peer", "conn", "scrp", "udp4", "tcp4", "torr", "fscr", "completed", "syncs"] -TEXT_MODES = ["herr", "s24s", "top10", "top100", "renew", "version"] +TEXT_MODES = ["herr", "s24s", "top10", "top100", "renew"] class StatsShape(TrackerTestCase): @@ -55,10 +55,16 @@ class StatsShape(TrackerTestCase): self.assertIsNotNone(root.find("torrents/count_mutex")) self.assertIsNotNone(root.find("connections/tcp/announce")) - def test_version_names_the_release(self): - # A build from a checkout appends what git describe said, a build from - # a tarball has nothing to append, so the commit is optional here. - self.assertRegex(self.tracker.stats("version"), rb"^opentracker \d+\.\d+\.\d+( \(\S+\))?\n$") + def test_the_version_mode_is_gone(self): + """Which build a tracker is and what went into it is of use to whoever + attacks it and to nobody else on the far end of a socket. It is + reported by -v, to whoever already has the binary.""" + with self.assertRaises(urllib.error.HTTPError) as caught: + self.tracker.stats("version") + self.assertEqual(caught.exception.code, 400, "an unknown mode, like any other") + + def test_everything_does_not_name_the_build(self): + self.assertNotIn(b"opentracker 1", self.tracker.stats("everything")) class StatsCount(TrackerTestCase): -- cgit v1.3