Skip to content

Conversation

@iceweasel-oai
Copy link
Collaborator

a few fixes based on testing feedback:

  • ensure cap_sid file is always written by elevated setup.
  • always log to same file whether using elevated sandbox or not
  • process potentially slow ACE write operations in parallel
  • dedupe write roots so we don't double process any
  • don't try to create read/write ACEs on the same directories, due to race condition

@iceweasel-oai iceweasel-oai changed the title bug fixes and perf improvements for sandbox setup bug fixes and perf improvements for elevated sandbox setup Dec 16, 2025
Copy link
Collaborator

@dylan-hurd-oai dylan-hurd-oai left a comment

Choose a reason for hiding this comment

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

Couple of non-blocking comments, but generally curious if it would be worth it to make more of this async!

let cap_sid_path = cap_sid_file(codex_home);
let is_workspace_write = matches!(&policy, SandboxPolicy::WorkspaceWrite { .. });

if matches!(&policy, SandboxPolicy::DangerFullAccess) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like we're adding this to fail earlier - is there a reason not to add this check immediately after parse_policy?

}

let (tx, rx) = mpsc::channel::<(PathBuf, Result<bool>)>();
std::thread::scope(|scope| {
Copy link
Collaborator

Choose a reason for hiding this comment

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

run_setup is getting pretty long here - worth splitting up at all? particularly since we're splitting out threads

}
}

let res = unsafe { ensure_allow_write_aces(&root, &psids) };
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we potentially encapsulate the psid *mut c_void to reduce the proliferation of unsafe calls It looks like ensure_allow_write_aces is only called here - maybe we could update it to take in a str/String and call convert_string_sid_to_sid inside there?

@iceweasel-oai iceweasel-oai merged commit 3d14da9 into main Dec 16, 2025
64 of 68 checks passed
@iceweasel-oai iceweasel-oai deleted the dev/iceweasel/sandbox-set-fixes branch December 16, 2025 17:48
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants