mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
## What changed Move shell command construction, bounded process execution, and JSON header parsing from `rmcp-client` into `codex-http-headers-helper`. Preserve the 10-second timeout, 64 KiB output limit, process-tree cleanup, and rejection of invalid or duplicate headers. Keep MCP environment setup and reserved-header validation in `rmcp-client`. Mark helper-provided header values as sensitive so debug formatting redacts credentials. ## Testing Add parser tests for credential-safe errors and debug redaction, and adapt the MCP reserved-header test to exercise helper execution. GitOrigin-RevId: e32d96261ff3648722014971bbf3803d37176ab4
23 lines
782 B
Rust
23 lines
782 B
Rust
#![cfg(test)]
|
|
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn invalid_output_does_not_expose_credentials() {
|
|
for output in [
|
|
r#"{"Authorization": "secret", "Other": 123}"#,
|
|
r#"{"bad name": "secret"}"#,
|
|
r#"{"Authorization": "secret\r\nInjected: value"}"#,
|
|
r#"{"Authorization": "secret", "authorization": "other"}"#,
|
|
r#"{"Authorization":"secret","Authorization":"secret"}"#,
|
|
r#"["secret"]"#,
|
|
"secret",
|
|
] {
|
|
let error = parse_headers(output.as_bytes()).expect_err("invalid headers");
|
|
assert!(!error.to_string().contains("secret"));
|
|
}
|
|
let headers = parse_headers(br#"{"Authorization":"secret"}"#).unwrap();
|
|
assert!(headers["authorization"].is_sensitive());
|
|
assert!(!format!("{headers:?}").contains("secret"));
|
|
}
|