From a6cc42065a80d0b845f53ee8246d37ac2da42704 Mon Sep 17 00:00:00 2001 From: Pavlo Ratushnyi Date: Thu, 1 Oct 2026 20:47:21 +0200 Subject: [PATCH] The admin-token comment said the same thing twice, and its numbers were stale The reasoning paragraph in AdminEndpoints was pasted twice by an earlier patch, and the measurement it quoted ("0 token lines at the shipped level, 2 at Information") came from a single request without saying so. Re-measured against the image built from this tree (openwaf:ci, 261 MB): one query-string request leaves 0 lines containing the token at the shipped level and 2 at Information - "Request starting" and "Request finished" - so two such requests leave 4, and a header request leaves 0 at either level. Teeth counted on this tree, not on the earlier one: guarding the warning behind an env var that is never set makes exactly 1 integration test fail - A_token_in_the_query_string_is_served_but_named_in_the_log_without_the_secret - and leaves 33 passing. The sibling test cannot catch that removal: it asserts the absence of a warning, so it passes either way. The pair is one trap, not two. Gates on the committed tree: build 0 warnings / 0 errors, unit 59/59, integration 34/34. --- dotnet/OpenWaf.Edge/Admin/AdminEndpoints.cs | 22 ++++++--------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/dotnet/OpenWaf.Edge/Admin/AdminEndpoints.cs b/dotnet/OpenWaf.Edge/Admin/AdminEndpoints.cs index 847d5af..af7917a 100644 --- a/dotnet/OpenWaf.Edge/Admin/AdminEndpoints.cs +++ b/dotnet/OpenWaf.Edge/Admin/AdminEndpoints.cs @@ -48,22 +48,12 @@ internal static class AdminEndpoints // history keeps, and at the shipped log level the edge does not log // URLs - but raising Microsoft.AspNetCore to Information, which is // the ordinary next move when something is misbehaving, makes - // Kestrel log the full URL including this token (measured: 0 token - // lines at the shipped level, 2 at Information). So the request is - // served and the moment it happens is named, without ever repeating - // the secret. - // The query string is accepted for one reason: an operator typing - // curl at a keyboard does it without thinking, and refusing them is - // how an operator ends up disabling the auth instead of learning the - // header. What is NOT acceptable is doing it silently. A URL is the - // one part of a request that every access log, proxy log and browser - // history keeps, and at the shipped log level the edge does not log - // URLs - but raising Microsoft.AspNetCore to Information, which is - // the ordinary next move when something is misbehaving, makes - // Kestrel log the full URL including this token (measured: 0 token - // lines at the shipped level, 2 at Information). So the request is - // served and the moment it happens is named, without ever repeating - // the secret. + // Kestrel log the full URL including this token. Measured on the + // shipped image: one query-string request leaves 0 lines containing + // the token at the shipped level and 2 at Information ("Request + // starting" and "Request finished"), and a header request leaves 0 + // at either. So the request is served and the moment it happens is + // named, without ever repeating the secret. if (viaQuery) { filterCtx.HttpContext.RequestServices