From 47f07261edec7f911c4a0e2885d141ccfb908ded Mon Sep 17 00:00:00 2001 From: yenicelik Date: Wed, 24 May 2023 13:34:50 +0200 Subject: [PATCH] detailed request must come with a bearer token --- web3_proxy/src/stats/influxdb_queries.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web3_proxy/src/stats/influxdb_queries.rs b/web3_proxy/src/stats/influxdb_queries.rs index 69d1110c..6246ac54 100644 --- a/web3_proxy/src/stats/influxdb_queries.rs +++ b/web3_proxy/src/stats/influxdb_queries.rs @@ -41,6 +41,13 @@ pub async fn query_user_stats<'a>( None => 0, }; + // Return an error if the bearer is set, but the StatType is Detailed + if stat_response_type == StatType::Detailed && user_id == 0 { + return Err(Web3ProxyError::BadRequest( + "Detailed Stats Response requires you to authorize with a bearer token".to_owned(), + )); + } + let db_replica = app .db_replica() .context("query_user_stats needs a db replica")?;