From 492247625efa5ef64b2eed57a7353125acdcd9c6 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar Date: Wed, 23 Sep 2026 22:03:42 +0000 Subject: [PATCH] fix(dashboard): keep the dashboard out of search indexes (#361) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB --- compliance-dashboard/Cargo.toml | 2 +- compliance-dashboard/src/infrastructure/server.rs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/compliance-dashboard/Cargo.toml b/compliance-dashboard/Cargo.toml index 5af274a..d4de885 100644 --- a/compliance-dashboard/Cargo.toml +++ b/compliance-dashboard/Cargo.toml @@ -62,7 +62,7 @@ gloo-timers = { version = "0.3", features = ["futures"], optional = true } # Server-only axum = { version = "0.8", optional = true } mongodb = { workspace = true, optional = true } -tower-http = { version = "0.6", features = ["cors", "trace"], optional = true } +tower-http = { version = "0.6", features = ["cors", "trace", "set-header"], optional = true } secrecy = { workspace = true, optional = true } dotenvy = { version = "0.15", optional = true } tokio = { workspace = true, optional = true } diff --git a/compliance-dashboard/src/infrastructure/server.rs b/compliance-dashboard/src/infrastructure/server.rs index f3135a0..c3fb46f 100644 --- a/compliance-dashboard/src/infrastructure/server.rs +++ b/compliance-dashboard/src/infrastructure/server.rs @@ -2,6 +2,7 @@ use axum::routing::get; use axum::{middleware, Extension}; use dioxus::prelude::*; use time::Duration; +use tower_http::set_header::SetResponseHeaderLayer; use tower_sessions::SessionManagerLayer; use compliance_core::config::AppEnv; @@ -90,6 +91,12 @@ pub fn server_start(app: fn() -> Element) -> Result<(), DashboardError> { // Liveness for the container healthcheck; outside `/api/`, so // it needs no session. .route("/health", get(|| async { "ok" })) + // A signed-in application: nothing here belongs in a search + // index (the orca agent adds no headers of its own). + .route( + "/robots.txt", + get(|| async { "User-agent: *\nDisallow: /\n" }), + ) .route("/auth", get(auth_login)) .route("/auth/callback", get(auth_callback)) .route("/logout", get(logout)) @@ -100,7 +107,11 @@ pub fn server_start(app: fn() -> Element) -> Result<(), DashboardError> { .layer(Extension(PendingOAuthStore::default())) .layer(middleware::from_fn(require_auth)) .layer(Extension(server_state)) - .layer(session); + .layer(session) + .layer(SetResponseHeaderLayer::overriding( + axum::http::HeaderName::from_static("x-robots-tag"), + axum::http::HeaderValue::from_static("noindex, nofollow"), + )); axum::serve(listener, router.into_make_service()) .await