Skip to content

Conversation

@iceweasel-oai
Copy link
Contributor

dedicated sandbox command runner exe.

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@iceweasel-oai iceweasel-oai force-pushed the dev/iceweasel/elevated-sandbox-3 branch from f8b4ff0 to a2e9b51 Compare December 11, 2025 05:50
@iceweasel-oai
Copy link
Contributor Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +77 to +78
if ok == 0 {
return Err(anyhow::anyhow!("SetInformationJobObject failed"));
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Badge Close job handle when SetInformationJobObject fails

If SetInformationJobObject fails, the function returns early without closing the job handle and the caller later drops the error with .ok(), so the handle is leaked and the process runs without the intended kill-on-close guard. When the job setup fails (e.g., due to missing privileges), a subsequent crash or timeout can leave the child process orphaned because the job object never enforces kill-on-close.

Useful? React with 👍 / 👎.

);

let policy = parse_policy(&req.policy_json_or_preset).context("parse policy_json_or_preset")?;
let psid_cap: *mut c_void = unsafe { convert_string_sid_to_sid(&req.cap_sid).unwrap() };
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Badge Reject invalid capability SID instead of panicking

The runner converts the capability SID with convert_string_sid_to_sid(&req.cap_sid).unwrap(). If the request file contains an invalid SID string (corrupted or user-supplied), this panics before any logging or cleanup instead of returning a structured error, so the command runner will crash rather than reporting a bad request.

Useful? React with 👍 / 👎.

Copy link
Collaborator

@etraut-openai etraut-openai left a comment

Choose a reason for hiding this comment

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

Looks good. I spotted one potential problem that you should look into before merging.

)
};
let (proc_info, _si) = match spawn_result {
Ok(v) => v,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We're closing these handles only in the error case. I'm not 100%, but I think we probably want to close them in the success case as well. I think these handles are ref counted by the kernel, so when they're passed to CreateProcessAsUserW, the ref count will be incremented. Since we don't close them here, they will never be closed. You should confirm this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great catch! I'll fix this

};

// Optional job kill on close.
let h_job = unsafe { create_job_kill_on_close().ok() };
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice use of a job object!

@iceweasel-oai iceweasel-oai merged commit 3e81ed4 into main Dec 11, 2025
26 checks passed
@iceweasel-oai iceweasel-oai deleted the dev/iceweasel/elevated-sandbox-3 branch December 11, 2025 21:51
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 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