milestone 13 discrepancies: redact credentials from urls in logs, metrics and cli output

This commit is contained in:
2026-08-07 00:45:17 +02:00
parent 1ff727feb8
commit 8c3328562e
39 changed files with 5734 additions and 510 deletions
+25 -1
View File
@@ -9,6 +9,10 @@
//! refresh downloads and compiles before the response is written: 202 is
//! "accepted and done as far as this connection is concerned", and the status
//! table in the body is what tells the operator which sources actually landed.
//!
//! `DELETE /api/blocklists/{id}` removes the row, reloads, and then sweeps the
//! compiled files that row named, so `<data_dir>/blocklists/` follows the table
//! the operator is looking at rather than the scheduler's next pass.
const std = @import("std");
const Allocator = std.mem.Allocator;
@@ -130,7 +134,27 @@ pub fn applyDelete(state: *server.WebState, io: std.Io, id: i64) ?Failure {
state.config_lock.unlock(io);
written catch |err| return mutations.dbFailure(err, url_conflict);
return mutations.reload(state, io);
const failure = mutations.reload(state, io);
pruneFiles(state, io);
return failure;
}
/// Removes the compiled files the deleted row leaves behind.
///
/// This is the moment an orphan is made during normal operation, and the only
/// other sweep is the scheduler's — up to `blocklist_update.interval_hours`
/// away. Without this call a deleted list keeps its megabytes on disk for a day.
///
/// After the reload and never part of the response: the row is gone and the
/// snapshot has stopped enforcing the list, so bytes still on disk are not a
/// failed delete. `Manager.pruneOrphans` takes the manager's writer lock, which
/// the reload above has already taken and released — nothing here holds it, and
/// `state.config_lock` was released before either.
fn pruneFiles(state: *server.WebState, io: std.Io) void {
const manager = state.manager orelse return;
manager.pruneOrphans(io) catch |err| {
log.warn("pruning the deleted blocklist's files failed: {s}", .{@errorName(err)});
};
}
/// Refreshes every enabled source, then applies the result (ruling 12).