[codex] Route Fed ChatGPT auth through Fed edge (#17151)

## Summary
- parse chatgpt_account_is_fedramp from signed ChatGPT auth metadata
- add _account_is_fedramp=true to ChatGPT backend-api requests only for
FedRAMP ChatGPT-auth accounts
This commit is contained in:
jackz-oai
2026-04-16 07:13:15 +00:00
committed by GitHub
parent 4cd85b28d2
commit f97be7dfff
11 changed files with 103 additions and 0 deletions
+24
View File
@@ -1,4 +1,5 @@
use http::HeaderMap;
use http::HeaderValue;
/// Adds authentication headers to API requests.
///
@@ -8,3 +9,26 @@ use http::HeaderMap;
pub trait AuthProvider: Send + Sync {
fn add_auth_headers(&self, headers: &mut HeaderMap);
}
pub(crate) fn add_fedramp_routing_header(headers: &mut HeaderMap) {
headers.insert("X-OpenAI-Fedramp", HeaderValue::from_static("true"));
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn add_fedramp_routing_header_sets_header() {
let mut headers = HeaderMap::new();
add_fedramp_routing_header(&mut headers);
assert_eq!(
headers
.get("X-OpenAI-Fedramp")
.and_then(|v| v.to_str().ok()),
Some("true")
);
}
}