René's URL Explorer Experiment


Title: JS: Add models for the MCP server SDKs and flow summaries for zod by Alex-Hofer · Pull Request #22749 · github/codeql · GitHub

Open Graph Title: JS: Add models for the MCP server SDKs and flow summaries for zod by Alex-Hofer · Pull Request #22749 · github/codeql

X Title: JS: Add models for the MCP server SDKs and flow summaries for zod by Alex-Hofer · Pull Request #22749 · github/codeql

Description: Follow-up to #22702; #22703 proposes the same for Python. MCP servers expose tools to LLM agents. Every argument of a tool, resource or prompt callback is chosen by the client, that is by a model that prompt injection can steer, or by anyone who can reach the server over HTTP. This PR models that input for the TypeScript SDKs as data extensions in javascript/ql/lib/ext: the callback arguments and the low-level requests as sources of the opt-in ai threat model (#22810), the request headers and the bearer token as sources of the remote threat model. First commit, the MCP SDKs: @modelcontextprotocol/sdk 1.x and @modelcontextprotocol/server 2.x, McpServer: the arguments of the callbacks of tool, registerTool, prompt and registerPrompt, and the URI and template variables of resource and registerResource. The low-level Server: request.params in handlers of setRequestHandler, also when the server is reached through McpServer.server, and the parameters of custom methods in 2.x. The request headers and the bearer token that the SDK hands to a callback: extra.requestInfo.headers and extra.authInfo.token in 1.x, ctx.http.req.headers.get() and ctx.http.authInfo.token in 2.x. fastmcp: addTool({execute}), addResourceTemplate({load}), addPrompt({load}). typeModel rows for the import paths with and without .js and for a server that arrives as a typed parameter. Second commit, flow summaries for zod (independent of the first, can be split off): handlers of the low-level server get the raw arguments and validate them with a zod schema before use (Schema.parse(request.params.arguments)). There is no model of zod, so the flow ends at that call. Four rows let data flow from the argument of parse, safeParse, parseAsync and safeParseAsync to the result. I used kind value: js/path-injection does not follow a taint summary there (it is a data-flow configuration with flow states) and does follow a value one; I checked both on a small server. Tests: library-tests/threat-models/sources gets mcp.ts, fastmcp.ts and zod.ts with inline expectations (threat-source, hasFlow); callbacks that are not registered with a server and a static resource have none. codeql test run passes locally with CLI 2.27.1. Evidence: as a model pack, these rows take CodeQL 2.27.1 from 6 to 25 of 38 real, publicly disclosed vulnerabilities in TypeScript and JavaScript MCP servers in mcp-vulnbench. On the half of the cases that the models were not run on while they were written, plain CodeQL finds 3 of 21, the rows of the first commit 11, and both commits together 14 (the zod rows were measured with kind taint), at 2.62 instead of 0.08 alarms per KLOC. Known limits are documented there: servers kept in a field of a project class, handler tables built across modules, and sinks such as fetch from undici or Playwright's page.goto. The measurement used the rows as remote, which is on by default; with ai the same sources apply once that threat model is enabled.

Open Graph Description: Follow-up to #22702; #22703 proposes the same for Python. MCP servers expose tools to LLM agents. Every argument of a tool, resource or prompt callback is chosen by the client, that is by a model t...

X Description: Follow-up to #22702; #22703 proposes the same for Python. MCP servers expose tools to LLM agents. Every argument of a tool, resource or prompt callback is chosen by the client, that is by a model t...

Opengraph URL: https://github.com/github/codeql/pull/22749

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:fec908df-4016-62c5-3cc2-ab54f84b29fa
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idBDD4:11970D:17571D3:1FC77A5:6AF99426
html-safe-noncea918a69b0991d9bcf156526d98257ac05380f94af23245be173769864fe544be
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREQ0OjExOTcwRDoxNzU3MUQzOjFGQzc3QTU6NkFGOTk0MjYiLCJ2aXNpdG9yX2lkIjoiNjExMTY0NDc2MDcwMTI0NDQ1NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac4108295112db2f84db610c75884d1137f3d1cfd5ae6febfe88b0aed5929a39ee
hovercard-subject-tagpull_request:4729674501
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/github/codeql/pull/22749/files
twitter:imagehttps://avatars.githubusercontent.com/u/62021660?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/62021660?s=400&v=4
og:image:altFollow-up to #22702; #22703 proposes the same for Python. MCP servers expose tools to LLM agents. Every argument of a tool, resource or prompt callback is chosen by the client, that is by a model t...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None612d3e6ffd693e7ea8d9fcf452370995872baef31d825b1fedef704cd3d24ac7
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/github/codeql git https://github.com/github/codeql.git
octolytics-dimension-user_id9919
octolytics-dimension-user_logingithub
octolytics-dimension-repository_id143040428
octolytics-dimension-repository_nwogithub/codeql
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id143040428
octolytics-dimension-repository_network_root_nwogithub/codeql
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release072e34035c13c31543fba9f025cbbbda4210dae4
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/github/codeql/pull/22749/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fcodeql%2Fpull%2F22749%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fcodeql%2Fpull%2F22749%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=github%2Fcodeql
Reloadhttps://github.com/github/codeql/pull/22749/files
Reloadhttps://github.com/github/codeql/pull/22749/files
Reloadhttps://github.com/github/codeql/pull/22749/files
githubhttps://github.com/github
codeqlhttps://github.com/github/codeql
Codehttps://github.com/github/codeql
Issues1k (1k)https://github.com/github/codeql/issues
Pull requests516 (516)https://github.com/github/codeql/pulls
Discussionshttps://github.com/github/codeql/discussions
Actionshttps://github.com/github/codeql/actions
Projectshttps://github.com/github/codeql/projects
Security and qualityhttps://github.com/github/codeql/security
Insightshttps://github.com/github/codeql/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fgithub%2Fcodeql%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgithub%2Fcodeql%2Fissues%2Fnew%2Fchoose
owen-mchttps://github.com/owen-mc
github:mainhttps://github.com/github/codeql/tree/main
Alex-Hofer:js-mcp-modelshttps://github.com/Alex-Hofer/codeql/tree/js-mcp-models
Conversation 7 https://github.com/github/codeql/pull/22749
Commits 5 https://github.com/github/codeql/pull/22749/commits
Checks 40 https://github.com/github/codeql/pull/22749/checks
Findings https://github.com/github/codeql/pull/22749/findings
Files changed https://github.com/github/codeql/pull/22749/files
Please reload this pagehttps://github.com/github/codeql/pull/22749/files
JS: Add models for the MCP server SDKs and flow summaries for zod https://github.com/github/codeql/pull/22749/files#top
Show all changes 5 commits https://github.com/github/codeql/pull/22749/files
ef9a0a1 JS: Add models for the MCP server SDKs Alex-Hofer Oct 3, 2026 https://github.com/github/codeql/pull/22749/commits/ef9a0a1db26abc7e887eef94a1edb903283a4ffe
2341a58 JS: Add flow summaries for zod schema parsing Alex-Hofer Oct 3, 2026 https://github.com/github/codeql/pull/22749/commits/2341a5813f9126d9e16918328a688d796ce6133a
3460d05 JS: Use the ai threat model for MCP handler input Alex-Hofer Oct 15, 2026 https://github.com/github/codeql/pull/22749/commits/3460d05b920d80c3479cc18aaec16475743e89d5
20c6662 Merge branch 'main' into js-mcp-models Alex-Hofer Oct 29, 2026 https://github.com/github/codeql/pull/22749/commits/20c6662608e6510d9621a77b9fe4ba5e3e346b92
e2bc115 Shared: Accept the ai threat model as a source kind in model validation Alex-Hofer Oct 30, 2026 https://github.com/github/codeql/pull/22749/commits/e2bc1151e099acdfbf457502855ce3e5b3d0263a
Clear filters https://github.com/github/codeql/pull/22749/files
Please reload this pagehttps://github.com/github/codeql/pull/22749/files
Please reload this pagehttps://github.com/github/codeql/pull/22749/files
2026-10-03-mcp-models.md https://github.com/github/codeql/pull/22749/files#diff-f93e827509f2133a6ec2e106970c8746fc76c49c771f5bf031617345c675f4ba
2026-10-03-zod.md https://github.com/github/codeql/pull/22749/files#diff-13d82221489e9ca8e178ebd2aebac5f6cd621ab9c049d890732f0443a46e1f5a
fastmcp.model.yml https://github.com/github/codeql/pull/22749/files#diff-d67ee27d3d5f6d4112ea5f40e8c82ded161496e416b75fb9019f238498ee94fd
mcp.model.yml https://github.com/github/codeql/pull/22749/files#diff-1a0a1275fd50792fe3f48e2006848c279bbea8e0fa63c9c82f5ba3a2c1256529
zod.model.yml https://github.com/github/codeql/pull/22749/files#diff-5851bdf6b6326ac426af1f1d4df5908f5ec598645950815d9122b587238e05f8
fastmcp.ts https://github.com/github/codeql/pull/22749/files#diff-bc26c5d791ef7c1152b9d10a6a75591fa7e24a699d31e76e6e2cc1c4cf4df86d
mcp.ts https://github.com/github/codeql/pull/22749/files#diff-cd845bae08e607d53e9972416fd02ee794e19b5fdf942bca54845c63c7279b58
zod.ts https://github.com/github/codeql/pull/22749/files#diff-0337b0f9d8b1f3c67274ad00582511b2b4ef97486b9be93e8cdc057b71a26ac0
ModelValidation.qll https://github.com/github/codeql/pull/22749/files#diff-91aa4933a4678a234e67334da0e0feb29f52cc2b3f396a2b13b5d63d64442db4
https://github.com/github/codeql/blob/main/CODEOWNERS#L16
javascript/ql/lib/change-notes/2026-10-03-mcp-models.mdhttps://github.com/github/codeql/pull/22749/files#diff-f93e827509f2133a6ec2e106970c8746fc76c49c771f5bf031617345c675f4ba
View file https://github.com/Alex-Hofer/codeql/blob/e2bc1151e099acdfbf457502855ce3e5b3d0263a/javascript/ql/lib/change-notes/2026-10-03-mcp-models.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/codeql/pull/22749/{{ revealButtonHref }}
https://github.com/github/codeql/blob/main/CODEOWNERS#L16
javascript/ql/lib/change-notes/2026-10-03-zod.mdhttps://github.com/github/codeql/pull/22749/files#diff-13d82221489e9ca8e178ebd2aebac5f6cd621ab9c049d890732f0443a46e1f5a
View file https://github.com/Alex-Hofer/codeql/blob/e2bc1151e099acdfbf457502855ce3e5b3d0263a/javascript/ql/lib/change-notes/2026-10-03-zod.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/codeql/pull/22749/{{ revealButtonHref }}
https://github.com/github/codeql/blob/main/CODEOWNERS#L16
javascript/ql/lib/ext/fastmcp.model.ymlhttps://github.com/github/codeql/pull/22749/files#diff-d67ee27d3d5f6d4112ea5f40e8c82ded161496e416b75fb9019f238498ee94fd
View file https://github.com/Alex-Hofer/codeql/blob/e2bc1151e099acdfbf457502855ce3e5b3d0263a/javascript/ql/lib/ext/fastmcp.model.yml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/codeql/pull/22749/{{ revealButtonHref }}
https://github.com/github/codeql/blob/main/CODEOWNERS#L16
javascript/ql/lib/ext/mcp.model.ymlhttps://github.com/github/codeql/pull/22749/files#diff-1a0a1275fd50792fe3f48e2006848c279bbea8e0fa63c9c82f5ba3a2c1256529
View file https://github.com/Alex-Hofer/codeql/blob/e2bc1151e099acdfbf457502855ce3e5b3d0263a/javascript/ql/lib/ext/mcp.model.yml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/codeql/pull/22749/{{ revealButtonHref }}
https://github.com/github/codeql/blob/main/CODEOWNERS#L16
javascript/ql/lib/ext/zod.model.ymlhttps://github.com/github/codeql/pull/22749/files#diff-5851bdf6b6326ac426af1f1d4df5908f5ec598645950815d9122b587238e05f8
View file https://github.com/Alex-Hofer/codeql/blob/e2bc1151e099acdfbf457502855ce3e5b3d0263a/javascript/ql/lib/ext/zod.model.yml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/codeql/pull/22749/{{ revealButtonHref }}
https://github.com/github/codeql/blob/main/CODEOWNERS#L16
javascript/ql/test/library-tests/threat-models/sources/fastmcp.tshttps://github.com/github/codeql/pull/22749/files#diff-bc26c5d791ef7c1152b9d10a6a75591fa7e24a699d31e76e6e2cc1c4cf4df86d
View file https://github.com/Alex-Hofer/codeql/blob/e2bc1151e099acdfbf457502855ce3e5b3d0263a/javascript/ql/test/library-tests/threat-models/sources/fastmcp.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/codeql/pull/22749/{{ revealButtonHref }}
https://github.com/github/codeql/blob/main/CODEOWNERS#L16
javascript/ql/test/library-tests/threat-models/sources/mcp.tshttps://github.com/github/codeql/pull/22749/files#diff-cd845bae08e607d53e9972416fd02ee794e19b5fdf942bca54845c63c7279b58
View file https://github.com/Alex-Hofer/codeql/blob/e2bc1151e099acdfbf457502855ce3e5b3d0263a/javascript/ql/test/library-tests/threat-models/sources/mcp.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/codeql/pull/22749/{{ revealButtonHref }}
https://github.com/github/codeql/blob/main/CODEOWNERS#L16
javascript/ql/test/library-tests/threat-models/sources/zod.tshttps://github.com/github/codeql/pull/22749/files#diff-0337b0f9d8b1f3c67274ad00582511b2b4ef97486b9be93e8cdc057b71a26ac0
View file https://github.com/Alex-Hofer/codeql/blob/e2bc1151e099acdfbf457502855ce3e5b3d0263a/javascript/ql/test/library-tests/threat-models/sources/zod.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/codeql/pull/22749/{{ revealButtonHref }}
https://github.com/github/codeql/blob/main/CODEOWNERS#L25
shared/mad/codeql/mad/ModelValidation.qllhttps://github.com/github/codeql/pull/22749/files#diff-91aa4933a4678a234e67334da0e0feb29f52cc2b3f396a2b13b5d63d64442db4
View file https://github.com/Alex-Hofer/codeql/blob/e2bc1151e099acdfbf457502855ce3e5b3d0263a/shared/mad/codeql/mad/ModelValidation.qll
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/github/codeql/pull/22749/{{ revealButtonHref }}
https://github.com/github/codeql/pull/22749/files#diff-91aa4933a4678a234e67334da0e0feb29f52cc2b3f396a2b13b5d63d64442db4
https://github.com/github/codeql/pull/22749/files#diff-91aa4933a4678a234e67334da0e0feb29f52cc2b3f396a2b13b5d63d64442db4
Please reload this pagehttps://github.com/github/codeql/pull/22749/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.