mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Protect inline visualization viewers from sandbox writes (#38306)
## Why Inline visualization viewer documents must remain outside locations that a sandboxed session can modify before they are opened in a browser. ## What changed - Materialize viewer documents in a dedicated cache under `CODEX_HOME`, keyed by the source and artifact thread IDs, instead of alongside visualization artifacts. - Create visualization links only when the active filesystem policy cannot write to the viewer cache. This also disables links for full-disk-write sessions and applies the policy consistently when loading transcript history. - Reject viewer cache paths containing symbolic links and track materialized documents in memory so unchanged viewers are reused without trusting existing file contents. ## Testing - Verify that rendering an unchanged visualization reuses the existing viewer file, while an updated fragment refreshes it. GitOrigin-RevId: 12b7fbe522a68076e5d683a987b7801940d131c2
This commit is contained in:
1 parent
363427b5e3
commit
902bd9e06b
10 files changed
+116
-52
No files matched your search
@@ -126,7 +126,7 @@ impl App {
|
||||
&cwd,
|
||||
user_items.iter().map(|(_, item)| item.clone()),
|
||||
visibility,
|
||||
Some(self.config.codex_home.as_path()),
|
||||
Some(&self.config),
|
||||
);
|
||||
let mut persisted_user_cells = user_items
|
||||
.into_iter()
|
||||
@@ -204,7 +204,7 @@ impl App {
|
||||
&cwd,
|
||||
items,
|
||||
visibility,
|
||||
Some(self.config.codex_home.as_path()),
|
||||
Some(&self.config),
|
||||
);
|
||||
if self.backtrack.overlay_preview_active {
|
||||
self.backtrack.nth_user_message = self.backtrack.nth_user_message.saturating_add(
|
||||
|
||||
@@ -406,7 +406,7 @@ async fn older_pagination_reconciles_review_prompts_across_page_boundaries() ->
|
||||
&app.config.cwd,
|
||||
started.turns.iter().flat_map(|turn| turn.items.clone()),
|
||||
crate::thread_transcript::RawReasoningVisibility::Hidden,
|
||||
Some(app.config.codex_home.as_path()),
|
||||
Some(&app.config),
|
||||
);
|
||||
app.enqueue_primary_thread_session(started.session, started.turns)
|
||||
.await?;
|
||||
@@ -575,7 +575,7 @@ async fn transcript_home_loads_every_older_history_page() -> Result<()> {
|
||||
&app.config.cwd,
|
||||
started.turns.iter().flat_map(|turn| turn.items.clone()),
|
||||
crate::thread_transcript::RawReasoningVisibility::Hidden,
|
||||
Some(app.config.codex_home.as_path()),
|
||||
Some(&app.config),
|
||||
);
|
||||
app.enqueue_primary_thread_session(started.session, started.turns)
|
||||
.await?;
|
||||
@@ -718,7 +718,7 @@ async fn remote_legacy_history_start_negotiates_once_for_resume_and_fork() -> Re
|
||||
&mut app_server,
|
||||
paginated_thread_id,
|
||||
crate::thread_transcript::RawReasoningVisibility::Hidden,
|
||||
Some(app.config.codex_home.as_path()),
|
||||
Some(&app.config),
|
||||
vec![Arc::new(PlainHistoryCell::new(vec!["visible".into()]))],
|
||||
)
|
||||
.await
|
||||
@@ -940,7 +940,7 @@ async fn underfilled_scrollback_fetches_older_pages_without_opening_the_transcri
|
||||
&app.config.cwd,
|
||||
started.turns.iter().flat_map(|turn| turn.items.clone()),
|
||||
crate::thread_transcript::RawReasoningVisibility::Hidden,
|
||||
Some(app.config.codex_home.as_path()),
|
||||
Some(&app.config),
|
||||
);
|
||||
initial_cells.insert(
|
||||
/*index*/ 0,
|
||||
@@ -1076,7 +1076,7 @@ async fn paginated_workflows_never_request_full_thread_history() -> Result<()> {
|
||||
&mut app_server,
|
||||
paginated_thread_id,
|
||||
crate::thread_transcript::RawReasoningVisibility::Hidden,
|
||||
Some(app.config.codex_home.as_path()),
|
||||
Some(&app.config),
|
||||
)
|
||||
.await?;
|
||||
assert!(!cells.is_empty());
|
||||
@@ -1105,7 +1105,7 @@ async fn paginated_workflows_never_request_full_thread_history() -> Result<()> {
|
||||
&mut app_server,
|
||||
legacy_thread_id,
|
||||
crate::thread_transcript::RawReasoningVisibility::Hidden,
|
||||
Some(app.config.codex_home.as_path()),
|
||||
Some(&app.config),
|
||||
)
|
||||
.await?;
|
||||
let legacy_reads = recorded_params(&requests, "thread/read");
|
||||
@@ -1287,7 +1287,7 @@ async fn cold_paginated_subagent_transcript_excludes_inherited_parent_history()
|
||||
&mut app_server,
|
||||
child_thread_id,
|
||||
crate::thread_transcript::RawReasoningVisibility::Hidden,
|
||||
Some(app.config.codex_home.as_path()),
|
||||
Some(&app.config),
|
||||
)
|
||||
.await?;
|
||||
let visible_history = cells
|
||||
|
||||
@@ -24,6 +24,7 @@ use crate::history_cell::ReasoningSummaryCell;
|
||||
use crate::history_cell::SessionInfoCell;
|
||||
use crate::history_cell::UserHistoryCell;
|
||||
use crate::history_cell::raw_lines_from_source;
|
||||
use crate::legacy_core::config::Config;
|
||||
use crate::thread_transcript::RawReasoningVisibility;
|
||||
use crate::thread_transcript::thread_items_to_transcript_cells;
|
||||
|
||||
@@ -42,12 +43,11 @@ impl App {
|
||||
} else {
|
||||
RawReasoningVisibility::Hidden
|
||||
};
|
||||
let codex_home = self.config.codex_home.to_path_buf();
|
||||
let cells = load_export_transcript(
|
||||
app_server,
|
||||
thread_id,
|
||||
visibility,
|
||||
Some(codex_home.as_path()),
|
||||
Some(&self.config),
|
||||
self.transcript_cells.clone(),
|
||||
)
|
||||
.await?;
|
||||
@@ -77,7 +77,7 @@ pub(super) async fn load_export_transcript(
|
||||
app_server: &mut AppServerSession,
|
||||
thread_id: ThreadId,
|
||||
visibility: RawReasoningVisibility,
|
||||
codex_home: Option<&Path>,
|
||||
config: Option<&Config>,
|
||||
visible_transcript: Vec<Arc<dyn HistoryCell>>,
|
||||
) -> Result<Vec<Arc<dyn HistoryCell>>, String> {
|
||||
let mut thread = app_server
|
||||
@@ -123,7 +123,7 @@ pub(super) async fn load_export_transcript(
|
||||
&thread.cwd,
|
||||
[item],
|
||||
visibility,
|
||||
codex_home,
|
||||
config,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user