fix: sanitize rendered markdown HTML

Add a shared rehype pipeline (rehype-raw -> rehype-sanitize -> rehype-highlight) to every markdown renderer so scripts, frames and event handlers are stripped from model output and repository files while safe HTML and highlighting survive.

Also delete change walkthroughs when their session is deleted (including in-flight generation), build schedule model options from default/favorite/recent state, and include 127.0.0.1 origins in the default trusted origins.
This commit is contained in:
Chris Scott committed 2026-10-06 19:27:49 -04:00
1 parent b36d412ca2
commit 3d143568c1
25 files changed
+343 -101

No files matched your search

+2 -3
View File
@@ -1,13 +1,12 @@
import React, { useEffect, useState, useId, useCallback } from 'react'
import ReactMarkdown from 'react-markdown'
import remarkGfm from 'remark-gfm'
import rehypeHighlight from 'rehype-highlight'
import rehypeRaw from 'rehype-raw'
import mermaid from 'mermaid'
import { Maximize2, X, AlertCircle } from 'lucide-react'
import { CopyButton } from '@/components/ui/copy-button'
import { MarkdownLink } from '@/components/ui/markdown-link'
import { useTheme } from '@/hooks/useTheme'
import { markdownRehypePlugins } from '@/lib/markdownRehypePlugins'
interface TextPartProps {
text: string
@@ -195,7 +194,7 @@ export function TextPart({ text, onFileClick }: TextPartProps) {
<div className="prose prose-invert prose-enhanced max-w-none text-foreground overflow-hidden break-words leading-snug">
<ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeHighlight, rehypeRaw]}
rehypePlugins={markdownRehypePlugins}
components={{
code({ className, children, ...props }) {
const isInline = !className || !className.includes('language-')