Repository navigation
Harden URL Cleaner from DEV-22 security review - #30
Conversation
Cap batch URL length, reject inherited tool names, echo only InputError messages, keep Android share-target POSTs on-device via the service worker, and apply the small Host/healthz/CI/smoke cleanups. Co-authored-by: Andromeda <heyandromeda@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: e0e98102-1806-46b5-9e9b-cde82380367a) |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 819c2efd05
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let shared = ""; | ||
| try { | ||
| const formData = await request.formData(); | ||
| shared = String(formData.get("url") || formData.get("text") || formData.get("title") || ""); |
There was a problem hiding this comment.
Preserve URL-aware fallback between shared fields
When a share contains a nonempty url field without an HTTP(S) link and a valid link in text, this selects the invalid value and discards the usable link. The same happens when plain text accompanies a URL in title. Previously, parseHandoffParams tried each field until it found a valid URL, and tests/handoff.test.js explicitly covers the invalid-url/valid-text fallback. After this redirect, parseHandoffUrl receives only the selected field and returns an empty handoff, so these shares no longer populate or clean the URL. Preserve all three fields in the fragment, or apply the existing URL-aware extraction before selecting one.
Useful? React with 👍 / 👎.
pretest already builds dist. Rebuilding at import time raced with explanations.test.js and failed the ci check. Co-authored-by: Andromeda <heyandromeda@users.noreply.github.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: d1b14ebd-1ba9-4455-87f9-b4301ea14e49) |
cleanBatch now echoes only InputError messages. Share-target POSTs that miss the service worker 303 to / without reading the body. CI pin tests scan every workflow uses line, and MCP falls back if an older engine has no InputError class. Co-authored-by: Andromeda <heyandromeda@users.noreply.github.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 56829390-c1f3-4376-a05b-2f4e095e25e4) |
The service worker no longer keeps only the first non-empty field, so an invalid url still falls back to a link in text or title. Middleware stays a body-blind 303 to /. Co-authored-by: Andromeda <heyandromeda@users.noreply.github.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: d5f5c8e8-2d0a-40b4-b827-bbc3716df008) |
loadHandoff now strips url/text/title from the address bar even if no field contains a valid link, and a valid url field still wins over an embedded &url= in text. Co-authored-by: Andromeda <heyandromeda@users.noreply.github.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: 991935f3-a031-47d5-9409-b73757c0ea95) |
Passive review of
mainate961ecafound 4 Low and 4 Informational items. This PR fixes all of them, plus four small re-verify gaps. No live deployment was tested.Low
F1. Batch item length cap.
clean_urls_batchnow rejects items longer than 8192 characters with a per-item error; other items still run.F2. Inherited tool names.
tools/callusesObject.hasOwn(TOOLS, name), so__proto__,constructor, andtoStringreturn JSON-RPC-32602 Unknown tool.F3. InputError vs internal errors. Engine validation throws
InputError. MCP echoes only that class.cleanBatchalso echoes per-itemerror.messageonly forInputErrorand uses a generic message otherwise.F4. Share target stays on-device. Manifest share target is now
POST+application/x-www-form-urlencoded.sw.jsintercepts that POST and redirects to/#url=with no network request. If the worker is not yet controlling the page,middleware.jsresponds303to/without reading the body. Legacy?url=and#url=handoff still work.Informational
F5. CI actions pinned to full commit SHAs (version tags in comments). The pin test scans every
.github/workflows/*.ymluses:line, with or without a list dash.F6.
HOST=0.0.0.0/::defaults now include loopback Host names (localhost,127.0.0.1,[::1], with and without port).F7.
/healthzis Host-checked first and returns{ ok: true }only (noengineSha). Origin and token checks stay off.F8.
http-smoke.shwrites undermktemp -dand removes it on exit.N1. MCP uses
engine.InputError ?? class InputError extends Error {}so an olderENGINE_DIRcannot crash on the first validation error.Tests
npm test— 151 passingcd mcp && node --test tests/*.mjs— 26 passingnpm run test:playwrightincludingtests/share-target.playwright.mjsDoes not touch open PRs #23 or #29.
Note
Medium Risk
Share-target and middleware behavior changes affect PWA install/share flows; MCP Host/healthz and error-handling changes affect local HTTP clients, but core URL cleaning logic is largely unchanged.
Reviewed by Cursor Bugbot for commit dadae70. Bugbot is set up for automated code reviews on this repo. Configure here.