[PR #5382] [MERGED] Fix safe bot-browser notes and background prompt review #6745

Closed
opened 2026-10-23 04:13:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5382
Author: @SpicyMarinara
Created: 8/22/2026
Status: ✅ Merged
Merged: 8/22/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/5377-5379-issue-sweep


📝 Commits (4)

  • adaaa8d chore: start issue sweep for #5377 and #5379
  • 515676f fix(ui): secure bot notes and review backgrounds
  • 92366df fix(security): parse chat styles before sanitizing
  • 7f0d2cb fix(security): harden sanitized chat links

📊 Changes

9 files changed (+410 additions, -189 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 e2e/core-flows.e2e.ts (+81 -8)
📝 packages/client/src/components/bot-browser/BotBrowserView.tsx (+35 -5)
📝 packages/client/src/components/chat/ChatArea.tsx (+1 -0)
📝 packages/client/src/components/chat/ChatMessage.tsx (+8 -149)
➕ packages/client/src/lib/chat-html.ts (+163 -0)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+36 -4)
📝 packages/server/src/services/generation/illustrator-background-generation.ts (+61 -23)
📝 scripts/regressions/prompt.regression.ts (+23 -0)

📄 Description

Why

Bot-browser author notes currently expose raw HTML/CSS text, and manual Roleplay gallery backgrounds bypass the enabled media-prompt review gate. This sweep makes author notes readable without granting remote content access to scripts or surrounding UI, and makes manual background generation pause for the same review flow as illustrations.

Closes #5377
Closes #5379

Summary

  • Render bot-browser author-note HTML through the existing chat allowlist.
  • Scope sanitized CSS to one contained notes panel; remove scripts, event handlers, link destinations, and global selectors.
  • Route manual Roleplay Gallery background prompts through the existing media review modal.
  • Resume with the saved background plan and the reviewed prompt, without rerunning the planner.
  • Add focused regression coverage and changelog entries.

Automated validation

  • pnpm localization:check
  • pnpm check
  • pnpm regression:prompt
  • pnpm smoke:ui — 255 passed, 107 platform-intentional skips
  • Focused desktop browser proof — 2 passed
  • git diff --check

The browser proof verifies safe formatting, script/event removal, inert links, fixed-position containment, and no custom-property leakage to body.

Test plan

  • Run focused regression coverage for HTML/CSS containment and background prompt review.
  • Run pnpm localization:check.
  • Run pnpm check.
  • Run pnpm smoke:ui.
  • Manually verify formatted author notes in the bot browser.
  • Manually verify unsafe scripts, event handlers, navigation, and global CSS cannot escape the author-notes panel.
  • Manually verify Gallery → Background pauses for prompt review when enabled and generates directly when disabled.

Summary by CodeRabbit

  • New Features

    • Added manual review for Roleplay background-generation prompts before image creation.
    • Reviewed prompts and positive/negative prompt edits are submitted exactly as approved.
    • Background generation can resume using the reviewed plan and prompt settings.
  • Bug Fixes

    • Improved sanitization of Bot-browser creator notes while preserving safe formatting.
    • Blocked scripts, unsafe links, event handlers, and unsafe styles in rich text.
    • Corrected background retry targeting and prompt-review behavior.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/5382 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 8/22/2026 **Status:** ✅ Merged **Merged:** 8/22/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/5377-5379-issue-sweep` --- ### 📝 Commits (4) - [`adaaa8d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/adaaa8d0beb25ecc7e199a17d5acc6a92aeb2bbd) chore: start issue sweep for #5377 and #5379 - [`515676f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/515676f012b5f62d338b7f285a131ef503ab0e2d) fix(ui): secure bot notes and review backgrounds - [`92366df`](https://github.com/Pasta-Devs/Marinara-Engine/commit/92366df642715cc43f2c93474ffb0e8b38ad060d) fix(security): parse chat styles before sanitizing - [`7f0d2cb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7f0d2cb3869931690b7b954b102472fefdb94c59) fix(security): harden sanitized chat links ### 📊 Changes **9 files changed** (+410 additions, -189 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `e2e/core-flows.e2e.ts` (+81 -8) 📝 `packages/client/src/components/bot-browser/BotBrowserView.tsx` (+35 -5) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+1 -0) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+8 -149) ➕ `packages/client/src/lib/chat-html.ts` (+163 -0) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+36 -4) 📝 `packages/server/src/services/generation/illustrator-background-generation.ts` (+61 -23) 📝 `scripts/regressions/prompt.regression.ts` (+23 -0) </details> ### 📄 Description ## Why Bot-browser author notes currently expose raw HTML/CSS text, and manual Roleplay gallery backgrounds bypass the enabled media-prompt review gate. This sweep makes author notes readable without granting remote content access to scripts or surrounding UI, and makes manual background generation pause for the same review flow as illustrations. Closes #5377 Closes #5379 ## Summary - Render bot-browser author-note HTML through the existing chat allowlist. - Scope sanitized CSS to one contained notes panel; remove scripts, event handlers, link destinations, and global selectors. - Route manual Roleplay Gallery background prompts through the existing media review modal. - Resume with the saved background plan and the reviewed prompt, without rerunning the planner. - Add focused regression coverage and changelog entries. ## Automated validation - `pnpm localization:check` - `pnpm check` - `pnpm regression:prompt` - `pnpm smoke:ui` — 255 passed, 107 platform-intentional skips - Focused desktop browser proof — 2 passed - `git diff --check` The browser proof verifies safe formatting, script/event removal, inert links, fixed-position containment, and no custom-property leakage to `body`. ## Test plan - [ ] Run focused regression coverage for HTML/CSS containment and background prompt review. - [ ] Run `pnpm localization:check`. - [ ] Run `pnpm check`. - [ ] Run `pnpm smoke:ui`. - [ ] Manually verify formatted author notes in the bot browser. - [ ] Manually verify unsafe scripts, event handlers, navigation, and global CSS cannot escape the author-notes panel. - [ ] Manually verify Gallery → Background pauses for prompt review when enabled and generates directly when disabled. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added manual review for Roleplay background-generation prompts before image creation. - Reviewed prompts and positive/negative prompt edits are submitted exactly as approved. - Background generation can resume using the reviewed plan and prompt settings. - **Bug Fixes** - Improved sanitization of Bot-browser creator notes while preserving safe formatting. - Blocked scripts, unsafe links, event handlers, and unsafe styles in rich text. - Corrected background retry targeting and prompt-review behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:13:19 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6745
No description provided.