跳至主要內容
返回技術博客

· 2 min read · ·

CodeQL and MCP inputs: put acceptance criteria at the tool boundary

Use CodeQL’s AI threat model update to separate parameter validation, authorization, and side-effect checks when delivering MCP tools.

  • CodeQL
  • MCP
  • Delivery
On this page
  1. Map where each parameter goes
  2. Make rejection reasons testable
  3. Keep the scan configuration with the result
  4. Leave unknowns visible in the handover
  5. Sources

GitHub’s December 4, 2026 CodeQL announcement says enabling the ai threat model tracks model-generated arguments in JavaScript, TypeScript, and Python MCP handlers. It is a useful prompt to make acceptance boundaries explicit. The checks below are proposed delivery guidance, not a report of an implementation on this site.

Map where each parameter goes

Imagine an internal tool accepting a project identifier and document name, then returning a document. I would map the path through parsing, authorization, and the actual read. This hypothetical example helps distinguish the step that recognizes a valid format from the step that permits access.

A well-formed string does not establish a caller’s right to the resource. Document allowed values, resource ownership, and where authorization is evaluated separately. A single checkbox labelled “input validation complete” can hide several different responsibilities.

Make rejection reasons testable

Prepare three sets of synthetic requests: valid and authorized, malformed, and well-formed but unauthorized. Write the expected result before running each case, then compare both the response and backend behavior with that expectation.

For a tool that changes data, also check that rejection leaves no partial writes. An error response is a visible outcome, not sufficient evidence that side effects stopped. Disposable test data and before-and-after records make that claim verifiable without involving private information.

Keep the scan configuration with the result

The announcement makes enabling the ai threat model a condition. Retain the scanner version, configuration, language coverage, and scanned commit so the team can establish what actually ran. When no alert appears, ask whether the relevant path was analyzed before interpreting the result.

For an existing alert, retain the source of the data, the handling point, and the reason for the disposition. If it does not apply, explain which condition prevents the unwanted behavior and how that condition was tested. A bare “false positive” label gives the next maintainer little to evaluate.

Leave unknowns visible in the handover

Scanning, functional checks, and authorization tests complement one another, but answer different questions. I would separate verified behavior, uncovered paths, and follow-up owners in the handover, with reproducible test conditions attached.

As tools become easier to connect to AI workflows, their contracts need to say what they may do, when they must refuse, and whether refusal truly prevents changes. Improved analysis supplies additional evidence; the delivery decision still needs to be checked against observable behavior.

Sources

Official announcement

Related reading

Markdown · PDF

SUBSCRIBE

新文章寄到你的信箱

每月約 2–4 篇,主題是 AI 導入、Web 工程與維運。只在有新文章時寄出,隨時可以退訂。

送出後會收到一封確認信,點擊確認才會開始寄送。確認信可能被歸到垃圾郵件,請留意一下。

用 RSS 訂閱

習慣用 Feedly、Inoreader 或其他閱讀器?加入這個網址即可。

https://www.8plus.app/feed.xml
開啟 RSS

想把文章裡的想法落地?

預約一場諮詢,讓我們針對你的系統與流程一起討論可行的做法。