From 1eba5d45ea88e36bc46e0d234aed8c9b75d5aa46 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Thu, 24 Nov 2022 16:02:14 +0100 Subject: [PATCH] Check if the master key is missing before returning an error --- meilisearch-http/src/extractors/authentication/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meilisearch-http/src/extractors/authentication/mod.rs b/meilisearch-http/src/extractors/authentication/mod.rs index cd7a43114..8944b60d3 100644 --- a/meilisearch-http/src/extractors/authentication/mod.rs +++ b/meilisearch-http/src/extractors/authentication/mod.rs @@ -31,11 +31,14 @@ impl GuardedData { where P: Policy + 'static, { + let missing_master_key = auth.get_master_key().is_none(); + match Self::authenticate(auth, token, index).await? { Some(filters) => match data { Some(data) => Ok(Self { data, filters, _marker: PhantomData }), None => Err(AuthenticationError::IrretrievableState.into()), }, + None if missing_master_key => Err(AuthenticationError::MissingMasterKey.into()), None => Err(AuthenticationError::InvalidToken.into()), } }