Skip to content

Reject embedded sandbox paths in Rust compiler outputs - #36

Merged
dzbarsky merged 1 commit into
mainfrom
codex/reject-embedded-sandbox-paths
Aug 6, 2026
Merged

Reject embedded sandbox paths in Rust compiler outputs#36
dzbarsky merged 1 commit into
mainfrom
codex/reject-embedded-sandbox-paths

Conversation

@dzbarsky

@dzbarsky dzbarsky commented Aug 1, 2026

Copy link
Copy Markdown
Member

Summary

CARGO_MANIFEST_DIR and OUT_DIR can contain Bazel's action working directory during compilation. Retaining either value in a Rust executable, library, or object embeds an absolute sandbox path that is invalid outside that action.

  • Scan successful, code-generating Rust compiler outputs for the exact resolved ${pwd} value in process_wrapper, using a streaming, binary-safe matcher.
  • Check the compiler's real output files, including cc_common.link and distributed ThinLTO objects, while excluding metadata-only actions.
  • Preserve compile-time include_str!/include_bytes! and relative paths.
  • Update build-script cleanup tests to inspect the actual OUT_DIR runfiles instead of embedding stale compile-action paths.

Validation

  • 33 focused Bazel tests covering process-wrapper behavior, compiler action arguments, generated sources, procedural macros, build scripts, and pipelined compilation.
  • 5 macOS debug-build tests, including remapped debug symbols.
  • 11 cc_common.link integration tests.
  • 6 output-path-mapping, static-library, and shared-library tests.
  • Real Rust compilations reject retained CARGO_MANIFEST_DIR and OUT_DIR values while accepting compile-time file inclusion and relative manifest paths.

AI assistance: OpenAI Codex.

@dzbarsky
dzbarsky force-pushed the codex/reject-embedded-sandbox-paths branch 4 times, most recently from b06be59 to 79963e6 Compare August 5, 2026 04:58
@dzbarsky
dzbarsky marked this pull request as ready for review August 5, 2026 05:08
@dzbarsky
dzbarsky force-pushed the codex/reject-embedded-sandbox-paths branch 4 times, most recently from 34e4da0 to d940f17 Compare August 5, 2026 05:58
Scan code-generating rustc outputs for the resolved ${pwd} value after successful compilation. Reject embedded CARGO_MANIFEST_DIR, OUT_DIR, and other sandbox paths while preserving compile-time include_str! and relative paths.

Inspect cargo_build_script OUT_DIR through test runfiles instead of retaining compile-action paths.

Assisted-by: OpenAI Codex
@dzbarsky
dzbarsky force-pushed the codex/reject-embedded-sandbox-paths branch from d940f17 to 231d94c Compare August 5, 2026 06:06
@dzbarsky
dzbarsky merged commit ac8740f into main Aug 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant