Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Skip SVG text nodes in prompt-injection-redact#135

Merged
twschiller merged 1 commit into
mainfrom
worktree-immutable-dazzling-russell
Jun 4, 2026
Merged

Skip SVG text nodes in prompt-injection-redact#135
twschiller merged 1 commit into
mainfrom
worktree-immutable-dazzling-russell

Conversation

@twschiller

Copy link
Copy Markdown
Contributor

Summary

  • Fixes Whole product detail redacted on demo site #133: the default ruleset was redacting the entire <article> product header on the demo site
  • Root cause: prompt-injection-redact matched injection-shaped text inside the inline "Verified" SVG's <title> / <desc> / <text> and walked up looking for a paragraph-like ancestor. With no p/li/td/etc. between the SVG and the article, it escalated to <article> and replaced the whole header.
  • svg-text-strip is the rule that handles SVG accessible/rendered text; skip those nodes in prompt-injection-redact so a buried-in-SVG match no longer collapses a surrounding section.

Test plan

  • jest src/rules/__tests__/prompt-injection-redact.test.ts — 15/15 pass, including new regression case mirroring the demo SVG shape
  • jest src/rules — 934/934 pass
  • bun run typecheck
  • Manual: load the extension with default rules, visit https://shield-dark-pattern-demo.vercel.app/product/p-headphones-1, confirm the product header (image, title, price, Add to Cart) renders normally and SVG title/desc/text are still scrubbed

🤖 Generated with Claude Code

Injection-shaped text inside an inline SVG's <title>/<desc>/<text>
has no paragraph-level ancestor, so the rule's container walk escalated
all the way to <article>/<section> and replaced the entire surrounding
header. svg-text-strip already scrubs those nodes; skip them here so a
buried-in-SVG match no longer wipes out the whole product header.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-browser-shield-demo-site Ready Ready Preview, Comment Jun 4, 2026 9:20pm

Request Review

@twschiller twschiller merged commit f2945a2 into main Jun 4, 2026
7 checks passed
@twschiller twschiller deleted the worktree-immutable-dazzling-russell branch June 4, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Whole product detail redacted on demo site

1 participant