Skip to content

mcp-app-lint: read CSS url() only from CSS, hint at unkeyed URLs - #16

Merged
shteynu merged 1 commit into
mainfrom
fix/csp-url-call
Oct 14, 2026
Merged

shteynu merged 1 commit into
mainfrom
fix/csp-url-call

Conversation

@shteynu

@shteynu shteynu commented Oct 14, 2026

Copy link
Copy Markdown
Owner

What

Two problems in --suggest-csp from 0.1.7, found by running it on built MCP App bundles.

  • A false origin. The CSS url() pattern ignored case and ran over the whole document. So new URL("https://github.com/cfworker") in a bundled JSON Schema validator came out as a needed resourceDomains origin, and could also feed MCPAPP001's suggestion and MCPAPP021. url() and @import are now read only from <style> blocks and style attributes.

  • Missed origins. A bundle that hands a URL string to a library was reported as needing no CSP. The ext-apps map example is one: a Cesium base URL in a template literal and an OpenStreetMap tile template. The key such a URL needs cannot be told from the code, so these origins are now listed as hints, never put into the declaration:

    • a line of their own with --format text;
    • a stderr note next to the JSON, so stdout keeps the 0.1.7 shape;
    • mentioned in the suggest_csp MCP tool's result.

    Link targets, XML namespaces, framework documentation hosts and placeholders such as *.example.com are left out. mentionedOrigins is exported.

Verification

  • npm test (mcp-app-lint 55, including new cases for both problems), npm run typecheck, npm run build, npm run test:census.
  • Built Vue example (basic-server-vue/dist/mcp-app.html): needs no CSP; before the fix it was given https://github.com.
  • Published @modelcontextprotocol/server-map@2.0.3: the hint lists exactly https://cesium.com and https://tile.openstreetmap.org.
  • Published server-basic-react, server-budget-allocator and server-pdf: unchanged.

mcp-app-lint: the CSS url() pattern was case-insensitive and ran over the
whole document, so `new URL("https://github.com/cfworker")` in a bundled
JSON Schema validator came out of --suggest-csp as a needed resource origin
(and would feed MCPAPP001's suggestion and MCPAPP021). url() and @import are
now read from <style> blocks and style attributes only.

A bundle that hands a URL string to a library (the ext-apps map example:
a Cesium base URL in a template literal, an OpenStreetMap tile template)
was reported as needing no CSP. Such origins are now listed as hints whose
key cannot be told statically: a text line, a stderr note next to the JSON
(stdout keeps the 0.1.7 shape), and `mentioned` in the suggest_csp tool.
Link targets, XML namespaces, framework documentation hosts and
placeholders are left out. Checked on the published ext-apps map,
basic-react, budget-allocator and pdf packages and the built Vue example.
@shteynu
shteynu merged commit 4ad555b into main Oct 14, 2026
3 checks passed
@shteynu
shteynu deleted the fix/csp-url-call branch October 14, 2026 14:02
shteynu pushed a commit that referenced this pull request Oct 14, 2026
All seven packages and the Claude Code plugin at 0.1.8; CHANGELOG dated
2026-10-14. Lockfile: only the workspace versions changed.

Changes since 0.1.7: mcp-app-lint only (PR #16). --suggest-csp no longer
reads `new URL()` in script as a CSS url(), and lists absolute URLs with no
known key (map tiles, a CDN base URL) as hints instead of reporting such a
UI as needing no CSP. The other packages are unchanged.

npm run check green on these versions (Chromium proofs, corpus 54/54 and
24/24). From a clean install of the mcp-app-lint tarball: the built Vue
example needs no CSP, and the published ext-apps map bundle gives the hint
https://cesium.com https://tile.openstreetmap.org.
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.

1 participant