Skip to content

Protect shell snapshots when credential brokerage is enabled - #43909

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/685356cb9e80f11cf69d053e4d239ee6ccf43a9e
Sep 8, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/685356cb9e80f11cf69d053e4d239ee6ccf43a9e

Conversation

@copyberry

@copyberry copyberry Bot commented Sep 8, 2026

Copy link
Copy Markdown

Protect shell snapshots when credential brokerage is enabled

Why

Shell startup files can introduce credentials or overwrite brokered dummy values. Snapshot capture and replay need to respect the command's sandbox and environment policy without persisting real credentials.

What changed

  • Capture and validate brokered snapshots per command using its requested shell, working directory, login mode, sandbox, and environment policy.
  • Discover shell-initialized credentials and prepare snapshot exports for brokered replay. Preserve shell functions and aliases while preventing startup files from overwriting dummy credentials during replay.
  • Rebuild snapshots as credential broker state changes and retain each command's snapshot for the lifetime of its process.
  • Reject brokered POSIX shell execution when a protected snapshot cannot be created, and reject brokerage with shell_zsh_fork. Restore real credentials and remove brokerage markers for unsupported PowerShell and Cmd execution; escalated commands bypass protected snapshots.

Testing

Add regression coverage for credential discovery and redaction, environment filtering, readonly exports, shell function and heredoc replay, command working directories and login modes, sandbox enforcement, and missing or disabled snapshots.

## Why

Shell startup files can introduce credentials or overwrite brokered dummy values. Snapshot capture and replay need to respect the command's sandbox and environment policy without persisting real credentials.

## What changed

- Capture and validate brokered snapshots per command using its requested shell, working directory, login mode, sandbox, and environment policy.
- Discover shell-initialized credentials and prepare snapshot exports for brokered replay. Preserve shell functions and aliases while preventing startup files from overwriting dummy credentials during replay.
- Rebuild snapshots as credential broker state changes and retain each command's snapshot for the lifetime of its process.
- Reject brokered POSIX shell execution when a protected snapshot cannot be created, and reject brokerage with `shell_zsh_fork`. Restore real credentials and remove brokerage markers for unsupported PowerShell and Cmd execution; escalated commands bypass protected snapshots.

## Testing

Add regression coverage for credential discovery and redaction, environment filtering, readonly exports, shell function and heredoc replay, command working directories and login modes, sandbox enforcement, and missing or disabled snapshots.

GitOrigin-RevId: 685356cb9e80f11cf69d053e4d239ee6ccf43a9e
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/685356cb9e80f11cf69d053e4d239ee6ccf43a9e branch from cd84127 to 2e220af Compare September 8, 2026 21:01
@copyberry
copyberry Bot merged commit 2e220af into main Sep 8, 2026
42 of 73 checks passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/685356cb9e80f11cf69d053e4d239ee6ccf43a9e branch September 8, 2026 21:02
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 8, 2026

This branch was previously deployed

1 inactive deployment
issue-triage 2e220af1 Deployed Sep 8, 2026 by privacyguy123 via Identify potential duplicates (all issues) #43639
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants