Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(observability): remove defense-in-depth auth_get_me opaque transport filter

Steven Enamakeldc517239ae03
diff --git a/crates/openhuman-core/src/core/observability.rs b/crates/openhuman-core/src/core/observability.rs
index e648d62b4f..63658f18a4 100644
--- a/crates/openhuman-core/src/core/observability.rs
+++ b/crates/openhuman-core/src/core/observability.rs
@@ -2927,55 +2927,6 @@ pub fn is_session_expired_event(event: &sentry::protocol::Event<'_>) -> bool {
false
}
-/// Defense-in-depth `before_send` filter for opaque `openhuman.auth_get_me`
-/// RPC failures whose message body has been collapsed to just the bare
-/// HTTP method + path (`"GET /auth/me"`) with no underlying transport error.
-///
-/// Pairs with the primary fix at `crate::security::credentials::ops::auth_get_me`,
-/// which replaced `e.to_string()` with `format!("{e:#}")` so the full
-/// `anyhow` context chain reaches the rpc dispatcher. Before that
-/// fix, every transient network failure under this RPC — reqwest timeout,
-/// connection reset, TLS handshake EOF, DNS hiccup — fingerprinted to one
-/// opaque "GET /auth/me" Sentry group (TAURI-RUST-10, ~409 events / 17
-/// users) because `is_transient_message_failure` could not see the
-/// stripped transport phrases.
-///
-/// This filter is the catch-all if anyone re-introduces the same anyhow
-/// `.to_string()` collapse at another call site that eventually reaches
-/// `report_error_or_expected` with the same shape, OR if the existing fix
-/// regresses. Genuine `auth_get_me` errors that carry the underlying
-/// context chain (`"GET /auth/me: error sending request for url (...): …"`)
-/// still page — only the bare path-only body is dropped.
-///
-/// Match criteria (all required):
-/// - tag `domain == "rpc"`
-/// - tag `operation == "invoke_method"`
-/// - tag `method == "openhuman.auth_get_me"`
-/// - `event.message` (or last exception `value`) trims to **exactly**
-/// `"GET /auth/me"` — strict equality, not `contains`, so a body with
-/// the chain appended still surfaces.
-#[cfg(feature = "crash-reporting")]
-pub fn is_auth_get_me_opaque_transport_event(event: &sentry::protocol::Event<'_>) -> bool {
- let tags = &event.tags;
- if tags.get("domain").map(String::as_str) != Some("rpc") {
- return false;
- }
- if tags.get("operation").map(String::as_str) != Some("invoke_method") {
- return false;
- }
- if tags.get("method").map(String::as_str) != Some("openhuman.auth_get_me") {
- return false;
- }
-
- const OPAQUE_BODY: &str = "GET /auth/me";
- let direct = event.message.as_deref();
- let from_exception = event.exception.last().and_then(|e| e.value.as_deref());
- [direct, from_exception]
- .into_iter()
- .flatten()
- .any(|body| body.trim() == OPAQUE_BODY)
-}
-
pub fn is_transient_http_status(status: &str) -> bool {
TRANSIENT_HTTP_STATUSES.contains(&status)
}
diff --git a/crates/openhuman-core/src/core/observability_crash_filter_auth_tests.rs b/crates/openhuman-core/src/core/observability_crash_filter_auth_tests.rs
deleted file mode 100644
index 08e425aeaf..0000000000
--- a/crates/openhuman-core/src/core/observability_crash_filter_auth_tests.rs
+++ /dev/null
@@ -1,97 +0,0 @@
-use super::*;
-
-#[cfg(feature = "crash-reporting")]
-#[test]
-fn auth_get_me_opaque_filter_keeps_full_anyhow_chain_message() {
- // Post-fix shape from `auth_get_me` now using `format!("{e:#}")`.
- let event = event_with_tags_and_message(
- &auth_get_me_tags(),
- "GET /auth/me: error sending request for url \
- (https://api.tinyhumans.ai/auth/me): operation timed out",
- );
- assert!(
- !is_auth_get_me_opaque_transport_event(&event),
- "messages carrying the underlying transport chain must surface — \
- the transient classifier handles those at the rpc dispatcher"
- );
-}
-
-#[cfg(feature = "crash-reporting")]
-#[test]
-fn auth_get_me_opaque_filter_keeps_other_rpc_methods() {
- // Same opaque shape but for a different RPC must NOT be dropped —
- // we don't have evidence the same anti-pattern exists elsewhere,
- // and a path-only body might be a legitimate distinct error for a
- // future endpoint.
- for method in [
- "openhuman.consume_login_token",
- "openhuman.auth_create_channel_link_token",
- "openhuman.thread_list",
- ] {
- let mut tags = auth_get_me_tags();
- // Replace the method tag.
- if let Some(slot) = tags.iter_mut().find(|(k, _)| *k == "method") {
- slot.1 = method;
- }
- let event = event_with_tags_and_message(&tags, "GET /auth/me");
- assert!(
- !is_auth_get_me_opaque_transport_event(&event),
- "filter must be scoped strictly to method=openhuman.auth_get_me \
- — saw method={method}"
- );
- }
-}
-
-#[cfg(feature = "crash-reporting")]
-#[test]
-fn auth_get_me_opaque_filter_requires_rpc_invoke_method_domain() {
- // Wrong domain → must surface.
- let mut tags = auth_get_me_tags();
- if let Some(slot) = tags.iter_mut().find(|(k, _)| *k == "domain") {
- slot.1 = "backend_api";
- }
- let event = event_with_tags_and_message(&tags, "GET /auth/me");
- assert!(!is_auth_get_me_opaque_transport_event(&event));
-
- // Wrong operation → must surface.
- let mut tags = auth_get_me_tags();
- if let Some(slot) = tags.iter_mut().find(|(k, _)| *k == "operation") {
- slot.1 = "post";
- }
- let event = event_with_tags_and_message(&tags, "GET /auth/me");
- assert!(!is_auth_get_me_opaque_transport_event(&event));
-}
-
-#[cfg(feature = "crash-reporting")]
-#[test]
-fn auth_get_me_opaque_filter_matches_exception_value_path() {
- // sentry-tracing path: message empty, exception last value carries
- // the body. The filter must still match.
- let mut event = event_with_tags(&auth_get_me_tags());
- event.exception.values.push(sentry::protocol::Exception {
- value: Some("GET /auth/me".to_string()),
- ..Default::default()
- });
- assert!(
- is_auth_get_me_opaque_transport_event(&event),
- "must also catch the exception-value shape (sentry-tracing bridge)"
- );
-}
-
-#[cfg(feature = "crash-reporting")]
-#[test]
-fn auth_get_me_opaque_filter_ignores_empty_and_unrelated() {
- // No message and no exception → false.
- let event = event_with_tags(&auth_get_me_tags());
- assert!(!is_auth_get_me_opaque_transport_event(&event));
-
- // Unrelated message body with the right tags → false.
- let event = event_with_tags_and_message(
- &auth_get_me_tags(),
- "session JWT verified via GET /auth/me on https://api.tinyhumans.ai",
- );
- assert!(
- !is_auth_get_me_opaque_transport_event(&event),
- "substring match must NOT trigger — strict equality only"
- );
-}
diff --git a/crates/openhuman-core/src/core/observability_crash_filter_messages_tests.rs b/crates/openhuman-core/src/core/observability_crash_filter_messages_tests.rs
index ae5c5c9771..d8febbb49a 100644
--- a/crates/openhuman-core/src/core/observability_crash_filter_messages_tests.rs
+++ b/crates/openhuman-core/src/core/observability_crash_filter_messages_tests.rs
@@ -660,31 +660,3 @@ fn transient_provider_transport_filter_scoped_to_llm_provider() {
);
assert!(!is_transient_provider_transport_failure(&event));
}
-
-// ── is_auth_get_me_opaque_transport_event ────────────────────────────
-// Covers the TAURI-RUST-10 fingerprint shape: `domain=rpc`,
-// `operation=invoke_method`, `method=openhuman.auth_get_me`, message
-// body = exactly "GET /auth/me" (no underlying chain). See the
-// function docstring + the `auth_get_me` fix in
-// `openhuman::security::credentials::ops::auth_get_me` for the broader
-// context.
-
-#[cfg(feature = "crash-reporting")]
-#[test]
-fn auth_get_me_opaque_filter_drops_bare_method_path_message() {
- let event = event_with_tags_and_message(&auth_get_me_tags(), "GET /auth/me");
- assert!(
- is_auth_get_me_opaque_transport_event(&event),
- "bare 'GET /auth/me' message must be dropped (TAURI-RUST-10 shape)"
- );
-}
-
-#[cfg(feature = "crash-reporting")]
-#[test]
-fn auth_get_me_opaque_filter_tolerates_surrounding_whitespace() {
- let event = event_with_tags_and_message(&auth_get_me_tags(), " GET /auth/me ");
- assert!(
- is_auth_get_me_opaque_transport_event(&event),
- "trimmed equality must still match the opaque shape"
- );
-}
diff --git a/crates/openhuman-core/src/core/observability_tests.rs b/crates/openhuman-core/src/core/observability_tests.rs
index d87c4e6bfb..e30b2008d8 100644
--- a/crates/openhuman-core/src/core/observability_tests.rs
+++ b/crates/openhuman-core/src/core/observability_tests.rs
@@ -37,16 +37,6 @@ fn managed_body(status: &str, code: &str) -> String {
)
}
-#[cfg(feature = "crash-reporting")]
-fn auth_get_me_tags() -> Vec<(&'static str, &'static str)> {
- vec![
- ("domain", "rpc"),
- ("operation", "invoke_method"),
- ("method", "openhuman.auth_get_me"),
- ("elapsed_ms", "5003"),
- ]
-}
-
#[cfg(feature = "crash-reporting")]
fn event_with_tags_and_message(
pairs: &[(&str, &str)],
@@ -68,8 +58,6 @@ fn event_with_exception_value(value: &str) -> sentry::protocol::Event<'static> {
event
}
-#[path = "observability_crash_filter_auth_tests.rs"]
-mod crash_filter_auth;
#[path = "observability_crash_filter_integrations_tests.rs"]
mod crash_filter_integrations;
#[path = "observability_crash_filter_messages_tests.rs"]
diff --git a/crates/openhuman-core/src/main.rs b/crates/openhuman-core/src/main.rs
index 51754cdf5a..fb5b5aaa83 100644
--- a/crates/openhuman-core/src/main.rs
+++ b/crates/openhuman-core/src/main.rs
@@ -175,21 +175,6 @@ fn main() {
// filter catches any future call site that re-emits the same
// shape — keeping OPENHUMAN-TAURI-25 / -1Q / -27 / -1G off
// Sentry permanently (~185 events/day combined).
- // Defense-in-depth: drop opaque "GET /auth/me" events from the
- // `openhuman.auth_get_me` RPC. The primary fix in
- // `credentials::ops::auth_get_me` walks the full anyhow context
- // chain so `is_transient_message_failure` can demote transient
- // transport failures at the rpc dispatcher. This catches any
- // future regression where a sibling call site collapses the
- // chain via `e.to_string()` and reproduces TAURI-RUST-10
- // (~409 events / 17 users).
- if openhuman_core::core::observability::is_auth_get_me_opaque_transport_event(&event) {
- log::debug!(
- "[sentry-auth-get-me-opaque-filter] dropping opaque transport event_id={:?}",
- event.event_id
- );
- return None;
- }
// Defense-in-depth: drop user-config provider errors that
// slipped past the call-site classifiers — 4xx client errors,
// subscription/payment issues, embedding API authorization