Skip to content

fix(sandbox): reject unsafe mount credential configurations - #4255

Open
seratch wants to merge 1 commit into
mainfrom
fix/sandbox-mount-credential-boundary
Open

fix(sandbox): reject unsafe mount credential configurations#4255
seratch wants to merge 1 commit into
mainfrom
fix/sandbox-mount-credential-boundary

Conversation

@seratch

@seratch seratch commented Aug 6, 2026

Copy link
Copy Markdown
Member

This pull request fixes cloud mount credentials crossing into model-controlled sandbox processes or durable sandbox state.

Credential-bearing in-container and unknown-boundary mount configurations now fail before provider, filesystem, or helper side effects. Credentialless helpers, Docker volumes, provider-native mounts, and Vercel's explicit trusted create-only opt-in remain supported.

Sandbox session and RunState serialization remove mount authority and require an exact trusted configuration match before rebinding external credentials. Provider failures, cancellation paths, snapshots, temporary credential files, and partial Docker startup cleanup are also handled without exposing credential values.

Document changes will be done separately.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 87a4bf6788

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/sandbox/_mount_security.py Outdated
Comment thread src/agents/sandbox/_mount_security.py Outdated
Comment thread src/agents/sandbox/_mount_security.py Outdated
Comment thread src/agents/extensions/sandbox/blaxel/mounts.py Outdated
@seratch
seratch force-pushed the fix/sandbox-mount-credential-boundary branch from 87a4bf6 to 670ec3c Compare August 7, 2026 07:54

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 670ec3cc5d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/sandbox/entries/mounts/base.py Outdated
Comment thread src/agents/sandbox/sandboxes/docker.py Outdated
Comment thread src/agents/extensions/sandbox/vercel/sandbox.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fdd7fa31d4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/exceptions.py Outdated
Comment thread src/agents/sandbox/_mount_security.py Outdated
Comment thread src/agents/sandbox/_mount_security.py Outdated
Comment thread src/agents/sandbox/_mount_security.py Outdated
@seratch
seratch force-pushed the fix/sandbox-mount-credential-boundary branch from fdd7fa3 to b0df561 Compare August 7, 2026 15:41
@seratch seratch changed the title fix: prevent sandbox mounts from exposing credentials fix(sandbox): reject unsafe mount credential configurations Aug 7, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b0df5611f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/sandbox/_mount_security.py Outdated
Comment thread src/agents/sandbox/_mount_security.py Outdated
@seratch
seratch force-pushed the fix/sandbox-mount-credential-boundary branch from b0df561 to 8db5444 Compare August 8, 2026 03:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8db5444fa2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/sandbox/_mount_security.py Outdated
Comment thread src/agents/sandbox/_mount_security.py
@seratch
seratch force-pushed the fix/sandbox-mount-credential-boundary branch from 8db5444 to a4a9b5d Compare August 8, 2026 04:10
@seratch
seratch force-pushed the fix/sandbox-mount-credential-boundary branch from a4a9b5d to 74f7034 Compare August 8, 2026 04:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a4a9b5d25d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/extensions/sandbox/daytona/mounts.py
Comment on lines +375 to +380
def _configured_mount_authority_fields(mount: Mount) -> tuple[str, ...]:
mount_type = _canonical_mount_type(type(mount)) or mount.type
fields = [
name
for name in _AUTHORITY_FIELDS_BY_MOUNT_TYPE.get(mount_type, ())
if getattr(mount, name, None) is not None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject config-line injection in credentialless mounts

When an in-container rclone mount places credentials in another config-rendered string, this classifier accepts it as credentialless; for example, S3Mount(s3_provider="AWS\naccess_key_id = ...\nsecret_access_key = ...") passes validation, and _rclone_required_lines() inserts those lines verbatim into the sandbox config while serialization retains the secret. Other endpoint/account fields are rendered similarly, so reject CR/LF or otherwise safely encode every value written into rclone configuration before allowing the mount.

AGENTS.md reference: AGENTS.md:L137-L137

Useful? React with 👍 / 👎.

Comment thread src/agents/run_state.py
Comment on lines +1456 to +1460
if "sandbox" in state_json:
if not isinstance(state_json["sandbox"], Mapping):
state_json["sandbox"] = {}
_raise_invalid_run_state_sandbox_envelope()
sanitized_sandbox, _redacted = sanitize_run_state_sandbox_mount_authority(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Check RunState schema before parsing sandbox state

When this SDK receives a snapshot from a future unsupported schema that changes the sandbox envelope, this block interprets the future payload before _build_run_state_from_json() checks $schemaVersion. A new non-mapping shape therefore raises an invalid envelope error and clears the caller's payload instead of producing the documented unsupported-version UserError; validate the schema version first and sanitize only layouts this reader supports.

AGENTS.md reference: AGENTS.md:L136-L136

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 74f703410f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +880 to +883
opaque_fields = _OPAQUE_STRATEGY_AUTHORITY_FIELDS.get(
strategy_type,
_ALL_OPAQUE_STRATEGY_AUTHORITY_FIELDS,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject opaque fields on custom mount strategies

When a custom MountStrategyBase stores authority in any field outside the hard-coded set, such as api_token, this sanitizer leaves it untouched; validation likewise sees no configured authority, so both session-state and RunState serialization retain the secret verbatim. This is distinct from inherited built-in mount fields: a registered custom strategy's own credential fields still bypass the boundary. Reject unknown strategy payloads or redact their entire opaque configuration rather than enumerating two known field names.

AGENTS.md reference: AGENTS.md:L137-L137

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant