Repository navigation
fix: escape user input in generated code - #140
Conversation
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughGenerated navigation and keyboard tool snippets now quote user-provided values through a shared JavaScript utility. Tests verify snippets containing apostrophes can be dynamically evaluated. ChangesTool code generation safety
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/tools/keyboard.ts`:
- Line 40: Update the generated comment in the keyboard handling flow around the
response.addCode call so params.key is never emitted as raw user input; remove
that comment or safely encode the key before interpolation. Keep the quoted
params.key argument used by page.keyboard.press unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d31c47e4-af8d-47e3-9452-de0adfca6ce8
📒 Files selected for processing (3)
src/tools/keyboard.tssrc/tools/navigate.tstests/tools-codegen.test.ts
Upstream change
Playwright MCP now escapes user-controlled strings before emitting generated Playwright code. Inputs containing apostrophes previously produced invalid JavaScript.
Why it matters here
This repository already uses its shared code-generation quoting helper for typed text and locator values, but
browser_navigateandbrowser_press_keystill interpolated URL/key input inside raw single quotes. They had the same invalid-code failure fixed upstream.Implemented fix
codegen.quote()helper for navigation URLs and pressed keys.Validation
npm test -- tests/tools-codegen.test.ts tests/tools-navigate.test.tsnpm run lintnpm run buildnpm test— 35 files, 379 tests passedgit diff --checkSummary by CodeRabbit
Bug Fixes
Tests