mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
Enable sandboxed V8 for code mode (#36374)
## Why Code mode must link against a V8 build with sandbox support, but Windows MSVC still used upstream non-sandboxed prebuilts and package builds selected the older release artifact profile. ## What changed - Enable the `v8_enable_sandbox` feature directly for the code mode runtime. - Select the `ptrcomp_sandbox_release` archive and bindings in Cargo packaging and CI, including Windows MSVC release builds. - Point Bazel's Windows MSVC targets at the sandbox-enabled Codex artifacts and enable the matching crate feature. ## Testing Add a runtime test that calls `v8__V8__IsSandboxEnabled()` and verifies that the linked V8 library has sandbox support enabled. GitOrigin-RevId: c1b49b44a6ccfea5b5006d69ec7866848d1cddd7
This commit is contained in:
@@ -9,9 +9,6 @@ doctest = false
|
||||
name = "codex_code_mode_runtime"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[features]
|
||||
sandbox = ["v8/v8_enable_sandbox"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
@@ -24,7 +21,7 @@ serde_json = { workspace = true }
|
||||
tokio = { workspace = true, features = ["macros", "rt", "sync", "time"] }
|
||||
tokio-util = { workspace = true, features = ["rt"] }
|
||||
tracing = { workspace = true }
|
||||
v8 = { workspace = true }
|
||||
v8 = { workspace = true, features = ["v8_enable_sandbox"] }
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = { workspace = true }
|
||||
|
||||
@@ -354,6 +354,19 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn linked_v8_has_sandbox_enabled() {
|
||||
unsafe extern "C" {
|
||||
fn v8__V8__IsSandboxEnabled() -> bool;
|
||||
}
|
||||
|
||||
// `rusty_v8` exposes this symbol for verifying linked sandbox support.
|
||||
assert!(
|
||||
unsafe { v8__V8__IsSandboxEnabled() },
|
||||
"code mode must link against sandbox-enabled V8"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn runtime_thread_panic_before_initialization_is_reported_directly() {
|
||||
let (event_tx, event_rx) = mpsc::unbounded_channel();
|
||||
|
||||
Reference in New Issue
Block a user