diff --git a/codex-rs/tui/src/security_report_viewer.rs b/codex-rs/tui/src/security_report_viewer.rs index addd0c353d..2964b3547e 100644 --- a/codex-rs/tui/src/security_report_viewer.rs +++ b/codex-rs/tui/src/security_report_viewer.rs @@ -1,3 +1,6 @@ +use base64::Engine; +use base64::engine::general_purpose::STANDARD as BASE64_STANDARD; + const REPORT_STYLES: &str = include_str!("security_report_assets/styles.css"); const REPORT_SCRIPT: &str = include_str!("security_report_assets/script.js"); const MARKED_JS: &str = include_str!("security_report_assets/marked.min.js"); @@ -21,7 +24,7 @@ fn escape_html(input: &str) -> String { pub(crate) fn build_report_html(title: &str, markdown: &str) -> String { let escaped_title = escape_html(title); - let report_payload = serde_json::to_string(markdown).unwrap_or_else(|_| "\"\"".to_string()); + let report_payload = BASE64_STANDARD.encode(markdown); let styles = REPORT_STYLES; let script = REPORT_SCRIPT; format!( @@ -83,7 +86,32 @@ pub(crate) fn build_report_html(title: &str, markdown: &str) -> String {