mirror of
https://github.com/openai/codex.git
synced 2026-09-16 12:13:30 +00:00
fix: make $PWD/.agent read-only like $PWD/.codex
This commit is contained in:
@@ -589,13 +589,18 @@ impl SandboxPolicy {
|
||||
}
|
||||
subpaths.push(top_level_git);
|
||||
}
|
||||
#[allow(clippy::expect_used)]
|
||||
let top_level_codex = writable_root
|
||||
.join(".codex")
|
||||
.expect(".codex is a valid relative path");
|
||||
if top_level_codex.as_path().is_dir() {
|
||||
subpaths.push(top_level_codex);
|
||||
|
||||
// Make .agent/skills and .codex/config.toml and related
|
||||
// files read-only to the agent, by default.
|
||||
for subdir in &[".agent", ".codex"] {
|
||||
#[allow(clippy::expect_used)]
|
||||
let top_level_codex =
|
||||
writable_root.join(subdir).expect("valid relative path");
|
||||
if top_level_codex.as_path().is_dir() {
|
||||
subpaths.push(top_level_codex);
|
||||
}
|
||||
}
|
||||
|
||||
WritableRoot {
|
||||
root: writable_root,
|
||||
read_only_subpaths: subpaths,
|
||||
|
||||
Reference in New Issue
Block a user