test(embed): cover the redirect-safety guard#76
Conversation
Extract the post-submit redirect check into a pure `isSafeRedirect(url, base)` and inject it into the served embed via `.toString()`, so the browser runs the exact function unit-tested here (no drift). Tests cover http(s)/relative allow and javascript:/data:/mailto:/ftp:/tel: block.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughA reusable ChangesSafe redirect handling
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Extracts the post-submit redirect check into a pure
isSafeRedirect(url, base)(inserver/src/lib/embed.ts) and injects it into the served embed via.toString()— so the browser runs the exact function that's unit-tested, with no drift between test and shipped code.Tests: allows absolute http(s) and relative URLs; blocks
javascript:/data:/mailto:/ftp:/tel:. 35/35 pass. No behaviour change; embed output verified (syntax + logic).🤖 Generated with Claude Code
Summary by CodeRabbit
javascript:,data:,mailto:,ftp:, andtel:.