Skip to content

[Bugs] core: asset allowlist warnings, comment, docs and release note - #1163

Merged
Aymericr merged 5 commits into
mainfrom
cursor/asset-allowlist-warnings-docs-5540
Oct 27, 2026
Merged

Aymericr merged 5 commits into
mainfrom
cursor/asset-allowlist-warnings-docs-5540

Conversation

@Aymericr

@Aymericr Aymericr commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Small follow-up to #1161 for the shared PASCAL_ALLOWED_ASSET_ORIGINS parser in packages/core/src/schema/asset-url.ts.

  • Warning wording: the no-valid-entry warning now reads no origin is permitted. The http-only warning notes that safeFetch still fetches the listed http: origins.
  • Cache comment: the comment on allowedOriginsFrom now says what the cache does. It holds only the most recent value, so warnings repeat when the value changes.
  • New warning for http-only allowlists: scene asset URLs accept only https: origins, so an allowlist of only http: entries rejects every one. That now logs a one-time asset_allowlist_has_no_https_entries warning. A mixed allowlist doesn't warn.
  • Credentials in entries: a full https://user:secret@host entry keeps its origin. The dropped credentials are reported as asset_allowlist_entry_credentials_dropped {"index": N}, by index only, never the entry.
  • Wildcard entries: a wildcard host (https://*.example.com) is skipped with reason wildcard_not_supported, instead of being kept as a literal origin that never matches.
  • Late-DNS test: the late answer is now 127.0.0.1. The test checks that it's neither fetched nor even evaluated (no blocked-host log) once the timeout has fired.
  • Docs: packages/mcp/CROSS_CUTTING.md §5 describes the shared parser that safeFetch uses.
  • Release note: the root CHANGELOG.md "Unreleased > Breaking" entry covers:
    • a whitespace-only value now admitting nothing instead of meaning unset;
    • core normalising entries, so a trailing slash, uppercase, :443, a path or credentials now grant the origin;
    • only http: and https: entries counting, and wildcard hosts being skipped;
    • the log line rename from safe_fetch_allowlist_entry_ignored {entry} to [pascal] asset_allowlist_entry_ignored {index, reason}, so alerts on the old name need updating.

How to test

  1. cd packages/core && bun test src/schema/asset-url.test.ts: 53 tests pass.
    • The credentials and wildcard tests fail if those parser checks are removed.
    • The http-only test fails if its warning is removed.
  2. cd packages/mcp && bun test src/lib/safe-fetch.test.ts: 46 tests pass. The late-DNS test fails if the lookup and its address check keep running after the timeout; the late loopback answer then gets checked and logged.
  3. Ran locally: bun run check, plus turbo run test check-types for @pascal-app/core and @pascal-app/mcp.

Screenshots / screen recording

N/A — non-visual change

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch
Open in Web Open in Cursor 

Note

Medium Risk
Touches security-sensitive asset origin allowlisting and documents breaking env semantics (whitespace-only now denies all origins); misconfiguration could block legitimate assets or confuse operators relying on old log names.

Reviewed by Cursor Bugbot for commit 6a15b74. Bugbot is set up for automated code reviews on this repo. Configure here.

…wlist

The no-valid-entry warning no longer says only https: origins are
refused, since safeFetch refuses http: too. An allowlist whose entries
are all http: now warns once that scene asset URLs (https: only) are all
rejected. The cache comment says what it does: one value, so warnings
repeat when the value changes.
CROSS_CUTTING describes the shared core parser safeFetch uses; the
changelog notes under Breaking that a whitespace-only
PASCAL_ALLOWED_ASSET_ORIGINS now admits nothing instead of meaning unset.
@Aymericr Aymericr added the bot:bugs label Oct 27, 2026 — with Cursor
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 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-27T01:14:30.312391Z 9af8ea3 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.

@Aymericr Aymericr left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maintainer review: looks good to merge once CI is green.

  • The no origin is permitted wording now matches what safeFetch actually does, and the new asset_allowlist_has_no_https_entries warning only fires when every valid entry is http:, so a mixed list stays quiet. The test covers both cases and restores the env var.
  • The cache comment and the CROSS_CUTTING.md §5 text match the code.
  • The CHANGELOG "Breaking" entry for whitespace-only values is a good call-out.

Non-visual change, so no screenshots needed. Posting as a comment because GitHub doesn't let this account approve its own PR. Treat this as the cross-review approval, and Bugs can merge once checks pass.

…cts wildcards

A full https://user:secret@host entry keeps its origin; the dropped
credentials are now reported as asset_allowlist_entry_credentials_dropped
by index only. A wildcard host (https://*.example.com) is skipped with
reason wildcard_not_supported instead of being kept as an origin that
never matches. The http-only warning notes that safeFetch still fetches
the listed http: origins.
The late answer is now 127.0.0.1, and the test checks it is neither
fetched nor even evaluated (no blocked-host log), so a lookup that keeps
running past the timeout fails it.

@Aymericr Aymericr left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

[Maintainer] Cross-review at 6a15b74

Approved at 6a15b74. All notes below are non-blocking.

CI at this head: ci ✅, quality ✅, cli-smoke ✅, Changed paths ✅, Cursor Bugbot ✅ (no findings). mergeable_state is clean.

This PR touches safeFetch's allowlist, so it still needs Security's written approval at this SHA. This review isn't that approval. The earlier triage COMMENT review on this PR was at 9af8ea3d, an older head, and doesn't cover this one. This review supersedes it.

No secret or entry text in logs

  • Credentials path. parseAllowedOrigins keeps only parsed.origin, which never includes userinfo, and records { index, reason: 'credentials_dropped' } (packages/core/src/schema/asset-url.ts:68). allowedOriginsFrom logs that case as asset_allowlist_entry_credentials_dropped with { index } only (:88-91). Every other issue logs { index, reason } (:93). The no-valid-entry and no-https warnings (:97, :98-101) are fixed strings.
  • The new test asserts that hunter2 appears in neither the credentials line nor the wildcard line (asset-url.test.ts, "logs dropped credentials and wildcard entries by index, never the entry").
  • safeFetch's own logging is unchanged: it logs loggableUrl of the request (userinfo stripped) and the request origin, never an entry. No path I could find puts entry text or credentials into a log.
  • Wildcards (:64). parsed.hostname.includes('*') also catches a percent-encoded %2A, since the URL host parser decodes it to *. I checked https://%2A.example.com and https://user:pw@%2a.x.com. A credentialed wildcard entry is reported once, as wildcard_not_supported, and still without its value.

One-time warnings

  • They fire once per distinct value. The single-entry cache (:74, :85) means a repeat read of the same value returns before any warning. The http-only test calls isValid twice and asserts exactly one line. A mixed http and https list stays quiet.
  • As the new comment says, a value that changes (A → B → A) warns again on each change. That's fine.
  • Test-resettability (non-blocking). There's no explicit reset. Tests "reset" only by using a raw value no earlier test used. If two tests in the same process ever pick the same string, the second won't see its warnings, and its result will depend on test order. A small exported resetAllowedOriginsCacheForTests() (or clearing it in the files' beforeEach) would make the warning tests independent of order.

Late-DNS test (packages/mcp/src/lib/safe-fetch.test.ts:642-648)

This now genuinely exercises a rebinding answer, and it would fail if the late answer were used:

  • The late answer is 127.0.0.1 (:642).
  • If safeFetch still evaluated it, resolveCheckedAddresses would call blocked('url_host_blocked', …), and that writes safe_fetch_blocked to console.error. errorLog is a per-test console.error spy (:84-89), and fetch_timeout goes through protocolError, which doesn't log. So expect(errorLog…).toEqual([]) (:647) catches any evaluation.
  • If the address were connected to instead, requests would be non-empty. If the blocked throw escaped, unhandled would be non-empty.

CHANGELOG (CHANGELOG.md:11-15, Unreleased > Breaking)

It covers all four points from my #1161 review:

  1. whitespace-only now admits nothing (:12);
  2. entries are normalised, so a trailing slash, uppercase, :443, a path or credentials grant the origin (:13);
  3. only http:/https: entries count, wildcards are skipped, and an http-only list rejects every scene asset URL (:14);
  4. the log rename, plus the new credentials line, and a note to update alerts (:15).

Nit (:12): "…so scene asset URLs on https: origins and safeFetch image fetches are all refused" reads as if safeFetch changed too. safeFetch already refused everything for a whitespace-only value. Something like "(as safeFetch already did)" would avoid a false alarm in the release notes.

Docs

CROSS_CUTTING.md §5 matches the code: shared parser, normalisation, credentials dropped, other schemes and wildcards skipped, index-and-reason warnings, no-valid-entry admits nothing.

No merge from me.

@Aymericr
Aymericr merged commit ebfbd59 into main Oct 27, 2026
5 checks passed
@Aymericr
Aymericr deleted the cursor/asset-allowlist-warnings-docs-5540 branch October 27, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants