mirror of
https://github.com/openai/codex.git
synced 2026-11-14 21:40:39 +00:00
Harden credential handling in shell snapshots and replay (#44040)
## Why Shell quoting can hide credentials from raw-text checks, and startup files can restore real credentials after the broker replaces them with dummy values. ## What changed - Decode shell literals without evaluating them and reject snapshots containing credentials in executable source, including aliases, functions, and heredocs. - Preserve credential policy overrides, explicit unsets, and aliases whose source variables were removed. Support credential aliases in Zsh tied arrays while rejecting credentials that span array elements. - Guard snapshot replay against credential restoration through shell startup files and preserve unrelated `ENV` settings. - Apply Windows environment-key casing rules to credential overrides, suppress unredacted sandbox diagnostics during snapshot capture, and clear inherited environment variables before launching escalated commands. ## Testing Add regression coverage for shell quoting and escaped credentials, Zsh tied arrays, startup-file replay, readonly credentials, policy overrides, and sensitive capture timeout and cancellation handling. GitOrigin-RevId: 58274c07c715423241d26ce6dd2c2b4230cf0f64
This commit is contained in:
@@ -6,6 +6,8 @@ mod capture;
|
||||
mod credentials;
|
||||
#[path = "shell_snapshot_exports.rs"]
|
||||
mod exports;
|
||||
#[path = "shell_snapshot_literals.rs"]
|
||||
mod literals;
|
||||
#[path = "shell_snapshot_render.rs"]
|
||||
mod render;
|
||||
|
||||
@@ -17,6 +19,8 @@ pub use credentials::PreparedSnapshot;
|
||||
pub use credentials::SnapshotCredentialEnvironment;
|
||||
pub use credentials::prepare_snapshot_credentials;
|
||||
|
||||
use capture::BASH_SH_SNAPSHOT_HEADER;
|
||||
|
||||
#[cfg(all(test, unix))]
|
||||
#[path = "shell_snapshot_tests.rs"]
|
||||
mod tests;
|
||||
|
||||
Reference in New Issue
Block a user