mirror of
https://github.com/openai/codex.git
synced 2026-11-15 22:53:30 +00:00
Harden internal Guardian session isolation (#40497)
## Why Internal Guardian reviews must remain independent of parent-session customization while still honoring managed execution and environment restrictions. ## What changed - Apply the restricted Guardian session path to both internal and subagent review sources. - Start internal reviews without inherited user instructions, extensions, MCP servers, or multi-agent behavior. - Preserve managed execution policy and selected environment constraints while exposing only the allowed review tools. Honor shell feature restrictions across every selected environment and retain code mode when enabled. ## Testing - Cover internal review isolation from parent state and managed instructions. - Cover optional tool filtering, managed shell restrictions, code mode, and secondary environment profiles. GitOrigin-RevId: edbf7d8a6fe3ee8213a1c75bc8ec331a1cf49006
This commit is contained in:
1 parent
be3a666143
commit
8476434a97
11 files changed
+475
-62
No files matched your search
@@ -659,7 +659,7 @@ async fn required_mcp_servers_for_input(
|
||||
turn_context: &TurnContext,
|
||||
user_input: &[UserInput],
|
||||
) -> (Vec<String>, Vec<crate::plugins::PluginCapabilitySummary>) {
|
||||
if crate::guardian::is_guardian_reviewer_source(&turn_context.session_source) {
|
||||
if crate::guardian::is_basic_session_source(&turn_context.session_source) {
|
||||
return (Vec::new(), Vec::new());
|
||||
}
|
||||
|
||||
@@ -765,7 +765,7 @@ async fn build_skills_and_plugins(
|
||||
let turn_context = step_context.turn.as_ref();
|
||||
// Guardian input embeds the parent transcript as untrusted evidence. Do not interpret skill or
|
||||
// plugin mentions from that generated prompt as requests to inject additional instructions.
|
||||
if crate::guardian::is_guardian_reviewer_source(&turn_context.session_source) {
|
||||
if crate::guardian::is_basic_session_source(&turn_context.session_source) {
|
||||
return Some((Vec::new(), HashSet::new()));
|
||||
}
|
||||
|
||||
@@ -1322,7 +1322,7 @@ pub(crate) fn build_prompt(
|
||||
parallel_tool_calls: true,
|
||||
base_instructions,
|
||||
output_schema: turn_context.final_output_json_schema.clone(),
|
||||
output_schema_strict: !crate::guardian::is_guardian_reviewer_source(
|
||||
output_schema_strict: !crate::guardian::is_basic_session_source(
|
||||
&turn_context.session_source,
|
||||
),
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user