mirror of
https://github.com/openai/codex.git
synced 2026-11-09 00:39:32 +00:00
add deny ACEs for world writable dirs (#7022)
Our Restricted Token contains 3 SIDs (Logon, Everyone, {WorkspaceWrite
Capability || ReadOnly Capability})
because it must include Everyone, that left us vulnerable to directories
that allow writes to Everyone. Even though those directories do not have
ACEs that enable our capability SIDs to write to them, they could still
be written to even in ReadOnly mode, or even in WorkspaceWrite mode if
they are outside of a writable root.
A solution to this is to explicitly add *Deny* ACEs to these
directories, always for the ReadOnly Capability SID, and for the
WorkspaceWrite SID if the directory is outside of a workspace root.
Under a restricted token, Windows always checks Deny ACEs before Allow
ACEs so even though our restricted token would allow a write to these
directories due to the Everyone SID, it fails first because of the Deny
ACE on the capability SID
This commit is contained in:
1 parent
54ee302a06
commit
3f92ad4190
4 files changed
+224
-3
No files matched your search
+13
-2
@@ -343,7 +343,8 @@ impl App {
|
||||
let env_map: std::collections::HashMap<String, String> = std::env::vars().collect();
|
||||
let tx = app.app_event_tx.clone();
|
||||
let logs_base_dir = app.config.codex_home.clone();
|
||||
Self::spawn_world_writable_scan(cwd, env_map, logs_base_dir, tx);
|
||||
let sandbox_policy = app.config.sandbox_policy.clone();
|
||||
Self::spawn_world_writable_scan(cwd, env_map, logs_base_dir, sandbox_policy, tx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -717,7 +718,14 @@ impl App {
|
||||
std::env::vars().collect();
|
||||
let tx = self.app_event_tx.clone();
|
||||
let logs_base_dir = self.config.codex_home.clone();
|
||||
Self::spawn_world_writable_scan(cwd, env_map, logs_base_dir, tx);
|
||||
let sandbox_policy = self.config.sandbox_policy.clone();
|
||||
Self::spawn_world_writable_scan(
|
||||
cwd,
|
||||
env_map,
|
||||
logs_base_dir,
|
||||
sandbox_policy,
|
||||
tx,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -911,6 +919,7 @@ impl App {
|
||||
cwd: PathBuf,
|
||||
env_map: std::collections::HashMap<String, String>,
|
||||
logs_base_dir: PathBuf,
|
||||
sandbox_policy: codex_core::protocol::SandboxPolicy,
|
||||
tx: AppEventSender,
|
||||
) {
|
||||
#[inline]
|
||||
@@ -920,8 +929,10 @@ impl App {
|
||||
}
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let result = codex_windows_sandbox::preflight_audit_everyone_writable(
|
||||
&logs_base_dir,
|
||||
&cwd,
|
||||
&env_map,
|
||||
&sandbox_policy,
|
||||
Some(logs_base_dir.as_path()),
|
||||
);
|
||||
if let Ok(ref paths) = result
|
||||
|
||||
Reference in new issue
Block a user