sentry_core/utils.rs
1//! Utilities reused across dependant crates and integrations.
2
3const SENSITIVE_HEADERS_UPPERCASE: &[&str] = &[
4 "AUTHORIZATION",
5 "PROXY_AUTHORIZATION",
6 "COOKIE",
7 "SET_COOKIE",
8 "X_FORWARDED_FOR",
9 "X_REAL_IP",
10 "X_API_KEY",
11];
12
13/// Determines if the HTTP header with the given name shall be considered as potentially carrying
14/// sensitive data.
15pub fn is_sensitive_header(name: &str) -> bool {
16 SENSITIVE_HEADERS_UPPERCASE.contains(&name.to_ascii_uppercase().replace("-", "_").as_str())
17}