diff options
| author | tv <tv@krebsco.de> | 2026-10-26 05:26:30 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-26 05:26:30 +0100 |
| commit | ca5fbf8736aef1c754f5048cc21bacb2f91360e2 (patch) | |
| tree | 544c5786a42285f6f2079a8f09a666c669083658 /src | |
| parent | 982cf915cca3598a7dcceedc46d5c75dd79efe80 (diff) | |
remove /debug/blacklist endpint
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/debug.rs | 25 | ||||
| -rw-r--r-- | src/api/mod.rs | 12 |
2 files changed, 7 insertions, 30 deletions
diff --git a/src/api/debug.rs b/src/api/debug.rs index 6a56a9c..01b7bc0 100644 --- a/src/api/debug.rs +++ b/src/api/debug.rs @@ -1,9 +1,7 @@ //! /debug/* handlers (only routed with --debug-api). -use std::collections::HashSet; - -use axum::{Json, body::Bytes, extract::State, http::StatusCode}; -use tracing::{info, warn}; +use axum::{Json, extract::State, http::StatusCode}; +use tracing::info; use crate::state::AppState; use crate::transport::firewall::FirewallRules; @@ -20,22 +18,3 @@ pub(crate) async fn put_debug_firewall( state.firewall.set_rules(rules); StatusCode::NO_CONTENT } - -/// Compatibility for the existing harness: block a set of peers in both directions. -/// Parses the body without requiring a Content-Type header, as before. -pub(crate) async fn put_debug_blacklist(State(state): State<AppState>, body: Bytes) -> StatusCode { - match serde_json::from_slice::<HashSet<String>>(&body) { - Ok(peers) => { - info!(peers = ?peers, "Blacklist replaced (both directions)"); - state.firewall.set_rules(FirewallRules { - inbound: peers.clone(), - outbound: peers, - }); - StatusCode::NO_CONTENT - } - Err(error) => { - warn!(error = %error, "Invalid blacklist body"); - StatusCode::BAD_REQUEST - } - } -} diff --git a/src/api/mod.rs b/src/api/mod.rs index b92f421..8f271f4 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -18,7 +18,7 @@ use axum::{ }, middleware::{self, Next}, response::{IntoResponse, Response}, - routing::{delete, get, put}, + routing::{delete, get}, }; use serde_json::{Value as JsonValue, json}; use sha2::{Digest, Sha256}; @@ -55,12 +55,10 @@ pub(crate) fn router(state: AppState, auth_state: AuthState, debug_api: bool) -> if debug_api { warn!("Debug API enabled"); - api = api - .route( - "/debug/firewall", - get(debug::get_debug_firewall).put(debug::put_debug_firewall), - ) - .route("/debug/blacklist", put(debug::put_debug_blacklist)); + api = api.route( + "/debug/firewall", + get(debug::get_debug_firewall).put(debug::put_debug_firewall), + ); } api.layer(middleware::from_fn_with_state(auth_state, basic_auth)) |
