From 53d45dafc2fd58e1cb1cebde856dbab6bd23f77f Mon Sep 17 00:00:00 2001 From: Erb3 <49862976+Erb3@users.noreply.github.com> Date: Sun, 24 Nov 2024 06:03:12 +0100 Subject: [PATCH] fix(backend): validate PAT name (#2906) Uses the macros provided by validator to validate the name. The name already had a macro, but .validate was not called. Resolves #1549 --- apps/labrinth/src/routes/internal/pats.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/labrinth/src/routes/internal/pats.rs b/apps/labrinth/src/routes/internal/pats.rs index 8539f2596..818d1ca85 100644 --- a/apps/labrinth/src/routes/internal/pats.rs +++ b/apps/labrinth/src/routes/internal/pats.rs @@ -165,6 +165,10 @@ pub async fn edit_pat( redis: Data, session_queue: Data, ) -> Result { + info.0.validate().map_err(|err| { + ApiError::InvalidInput(validation_errors_to_string(err, None)) + })?; + let user = get_user_from_headers( &req, &**pool,