Skip to content

Harden URL Cleaner from DEV-22 security review - #30

Merged
heyandromeda merged 5 commits into
mainfrom
cursor/dev-22-security-hardening-38b2
Oct 24, 2026
Merged

heyandromeda merged 5 commits into
mainfrom
cursor/dev-22-security-hardening-38b2

Conversation

@heyandromeda

@heyandromeda heyandromeda commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Passive review of main at e961eca found 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_batch now rejects items longer than 8192 characters with a per-item error; other items still run.

F2. Inherited tool names. tools/call uses Object.hasOwn(TOOLS, name), so __proto__, constructor, and toString return JSON-RPC -32602 Unknown tool.

F3. InputError vs internal errors. Engine validation throws InputError. MCP echoes only that class. cleanBatch also echoes per-item error.message only for InputError and uses a generic message otherwise.

F4. Share target stays on-device. Manifest share target is now POST + application/x-www-form-urlencoded. sw.js intercepts that POST and redirects to /#url= with no network request. If the worker is not yet controlling the page, middleware.js responds 303 to / 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/*.yml uses: 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. /healthz is Host-checked first and returns { ok: true } only (no engineSha). Origin and token checks stay off.

F8. http-smoke.sh writes under mktemp -d and removes it on exit.

N1. MCP uses engine.InputError ?? class InputError extends Error {} so an older ENGINE_DIR cannot crash on the first validation error.

Tests

  • npm test — 151 passing
  • cd mcp && node --test tests/*.mjs — 26 passing
  • npm run test:playwright including tests/share-target.playwright.mjs

Does not touch open PRs #23 or #29.

Open in Web Open in Cursor 

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.

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>
@vercel

vercel Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
url-cleaner Ready Ready Preview Oct 24, 2026 9:06am UTC

@cursor

cursor Bot commented Oct 24, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T08:19:24.080006Z 819c2ef PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread sw.js Outdated
let shared = "";
try {
const formData = await request.formData();
shared = String(formData.get("url") || formData.get("text") || formData.get("title") || "");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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>
@cursor

cursor Bot commented Oct 24, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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>
@cursor

cursor Bot commented Oct 24, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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>
@cursor

cursor Bot commented Oct 24, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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>
@cursor

cursor Bot commented Oct 24, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@heyandromeda
heyandromeda merged commit fef0906 into main Oct 24, 2026
4 checks passed
cursor Bot pushed a commit that referenced this pull request Oct 24, 2026
Co-authored-by: Andromeda <heyandromeda@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
Preview — dadae703 Deployed Oct 24, 2026 by vercel[bot]
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.

2 participants