@ -366,9 +366,9 @@ fn extract_admin_code(headers: &HeaderMap) -> Option<String> {
/// Verify that the supplied admin code matches the one stored in the repository.
///
/// Fetches the current admin code via [`QuoteRepository::get_admin_auth_code`]
/// and performs a constant-time-equivalent string comparison. Returns `true`
/// if the codes match, `false` if the code is wrong, missing, or the database
/// query fails.
/// and compares it with the supplied code using standard string equality.
/// Returns `true` if the codes match, `false` if the code is wrong, missing,
/// or the database query fails.
async fn verify_admin_code ( repo : & Repo , code : & str ) -> bool {
match repo . get_admin_auth_code ( ) . await {
Ok ( Some ( stored ) ) = > stored = = code ,
@ -430,7 +430,7 @@ async fn delete_handler(
///
/// Returns `403 Forbidden` if the header is missing or the code is incorrect.
#[ cfg_attr(target_arch = " wasm32 " , worker::send) ]
pub async fn lock_submissions ( State ( repo ) : State < Repo > , headers : HeaderMap ) -> Response {
async fn lock_submissions ( State ( repo ) : State < Repo > , headers : HeaderMap ) -> Response {
let Some ( code ) = extract_admin_code ( & headers ) else {
return error_response ( StatusCode ::FORBIDDEN , "X-Admin-Code header is required" ) ;
} ;
@ -454,7 +454,7 @@ pub async fn lock_submissions(State(repo): State<Repo>, headers: HeaderMap) -> R
///
/// Returns `403 Forbidden` if the header is missing or the code is incorrect.
#[ cfg_attr(target_arch = " wasm32 " , worker::send) ]
pub async fn unlock_submissions ( State ( repo ) : State < Repo > , headers : HeaderMap ) -> Response {
async fn unlock_submissions ( State ( repo ) : State < Repo > , headers : HeaderMap ) -> Response {
let Some ( code ) = extract_admin_code ( & headers ) else {
return error_response ( StatusCode ::FORBIDDEN , "X-Admin-Code header is required" ) ;
} ;