about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander_Kabui <alexanderkabua@gmail.com>2026-10-05 22:38:34 +0300
committerAlexander_Kabui <alexanderkabua@gmail.com>2026-10-05 22:38:34 +0300
commit35c751572441cba3f2e40d6409d12024b4334baa (patch)
treeef229c5a2f31cf08d9fb833e22bdb0735632d55f /src
parenta82252b842a5f3381e1da4f323868eef7aac6a1f (diff)
downloadgenenetwork4-35c751572441cba3f2e40d6409d12024b4334baa.tar.gz
search: require a token; restore hermetic /search coverage
- src/routes/search.rs: AuthToken per correlation.rs pattern (+ Unauthorized).
- tests/search.rs: stub /auth/public-jwks + locally-signed token; scenarios
  run offline again (multi_thread runtime: the blocking ureq JWKS fetch
  starved the single-thread stub); add invalid-token 401 case.
- test/python/test_search.py: fetch token once, reuse.
- RELEASE_NOTES.md: /search now requires a token.
- test/data: test-only JWKS + RSA key fixtures.
Diffstat (limited to 'src')
-rw-r--r--src/routes/search.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/routes/search.rs b/src/routes/search.rs
index c8f2e1b..0a61878 100644
--- a/src/routes/search.rs
+++ b/src/routes/search.rs
@@ -13,7 +13,8 @@ use std::sync::OnceLock;
 use std::time::Duration;
 use tower_http::request_id::RequestId;
 
-use crate::error::ApiError;
+use crate::auth::AuthToken;
+use crate::error::{ApiError, Unauthorized};
 use crate::request_id_string;
 use crate::response::Envelope;
 
@@ -90,12 +91,14 @@ queries forward gn3's parser diagnostic as a 422.",
     params(SearchParams),
     responses(
         (status = 200, description = "Matching traits, gn3 shape", body = Envelope<Vec<SearchHit>>),
+        Unauthorized,
         (status = 400, description = "Missing or invalid parameter", body = ApiError),
         (status = 422, description = "Query unparsable by the search backend; carries gn3's diagnostic", body = ApiError),
         (status = 502, description = "Search backend unreachable or misbehaving", body = ApiError)
 ))]
 pub async fn search(
     Extension(request_id): Extension<RequestId>,
+    _token: AuthToken,
     Query(params): Query<SearchParams>,
 ) -> Result<Json<Envelope<Vec<SearchHit>>>, ApiError> {
     let rid = request_id_string(&request_id);