Repository navigation
[Bugs] core: asset allowlist warnings, comment, docs and release note - #1163
Conversation
…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.
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. |
Aymericr
left a comment
There was a problem hiding this comment.
Maintainer review: looks good to merge once CI is green.
- The
no origin is permittedwording now matches whatsafeFetchactually does, and the newasset_allowlist_has_no_https_entrieswarning only fires when every valid entry ishttp:, 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
left a comment
There was a problem hiding this comment.
[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.
parseAllowedOriginskeeps onlyparsed.origin, which never includes userinfo, and records{ index, reason: 'credentials_dropped' }(packages/core/src/schema/asset-url.ts:68).allowedOriginsFromlogs that case asasset_allowlist_entry_credentials_droppedwith{ 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
hunter2appears 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 logsloggableUrlof 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 checkedhttps://%2A.example.comandhttps://user:pw@%2a.x.com. A credentialed wildcard entry is reported once, aswildcard_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
isValidtwice 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
safeFetchstill evaluated it,resolveCheckedAddresseswould callblocked('url_host_blocked', …), and that writessafe_fetch_blockedtoconsole.error.errorLogis a per-testconsole.errorspy (:84-89), andfetch_timeoutgoes throughprotocolError, which doesn't log. Soexpect(errorLog…).toEqual([])(:647) catches any evaluation. - If the address were connected to instead,
requestswould be non-empty. If the blocked throw escaped,unhandledwould be non-empty.
CHANGELOG (CHANGELOG.md:11-15, Unreleased > Breaking)
It covers all four points from my #1161 review:
- whitespace-only now admits nothing (:12);
- entries are normalised, so a trailing slash, uppercase,
:443, a path or credentials grant the origin (:13); - only
http:/https:entries count, wildcards are skipped, and an http-only list rejects every scene asset URL (:14); - 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.
What does this PR do?
Small follow-up to #1161 for the shared
PASCAL_ALLOWED_ASSET_ORIGINSparser inpackages/core/src/schema/asset-url.ts.no origin is permitted. The http-only warning notes thatsafeFetchstill fetches the listedhttp:origins.allowedOriginsFromnow says what the cache does. It holds only the most recent value, so warnings repeat when the value changes.https:origins, so an allowlist of onlyhttp:entries rejects every one. That now logs a one-timeasset_allowlist_has_no_https_entrieswarning. A mixed allowlist doesn't warn.https://user:secret@hostentry keeps its origin. The dropped credentials are reported asasset_allowlist_entry_credentials_dropped {"index": N}, by index only, never the entry.https://*.example.com) is skipped with reasonwildcard_not_supported, instead of being kept as a literal origin that never matches.127.0.0.1. The test checks that it's neither fetched nor even evaluated (no blocked-host log) once the timeout has fired.packages/mcp/CROSS_CUTTING.md§5 describes the shared parser thatsafeFetchuses.CHANGELOG.md"Unreleased > Breaking" entry covers::443, a path or credentials now grant the origin;http:andhttps:entries counting, and wildcard hosts being skipped;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
cd packages/core && bun test src/schema/asset-url.test.ts: 53 tests pass.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.bun run check, plusturbo run test check-typesfor@pascal-app/coreand@pascal-app/mcp.Screenshots / screen recording
N/A — non-visual change
Checklist
bun devbun checkto verify)mainbranchNote
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.