security: add 1MB body size limit to admin API

This commit is contained in:
whit3rabbit
2026-03-27 15:52:05 -05:00
parent 2b915c0149
commit e441d2aaff
+6 -2
View File
@@ -4,7 +4,7 @@ use crate::admin::auth::validate_admin_token;
use crate::admin::state::SharedState;
use crate::admin::ws::ws_handler;
use axum::{
extract::{ConnectInfo, Path, Query, State},
extract::{ConnectInfo, DefaultBodyLimit, Path, Query, State},
http::StatusCode,
middleware,
response::IntoResponse,
@@ -199,7 +199,11 @@ pub fn admin_router(shared: SharedState, token: Arc<String>) -> Router {
.route("/admin", get(serve_spa));
// Merge all routes.
public.merge(protected).merge(ws_route).merge(spa_route)
public
.merge(protected)
.merge(ws_route)
.merge(spa_route)
.layer(DefaultBodyLimit::max(1_048_576))
}
async fn health() -> Json<serde_json::Value> {