Repository navigation
Conversation
Scoped-down v1 of issue #428 per the agreed issue-comment discussion: a review_project MCP tool / CLI command that statically flags hand-written request.body validation (manual JSON.parse, typeof/Array.isArray checks, explicit required-field checks) in function/middleware source, pointing authors at the declarative request.body.schema alternative instead. Built on the existing collectSourcesFor/collectTrustedSources source loader (via prepareFunctionSnapshot) so it inherits the same read-only, no-execution, no-binding-read, byte-budgeted guarantees; no new trust boundary is introduced. Only the one native-alternative pattern ships; other pattern types and the extension-alternative/gap/manual-review taxonomy are explicitly out of scope for this slice. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Collaborator
Author
|
Closing without merging — main already has a broader implementation of this from #437 (merged while this PR was in progress in an isolated worktree), covering 4 detection signals (manual body validation, cookie/session, global mutable state, outbound network calls) vs. this PR's single signal. No unique value left to carry over. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Scoped-down v1 of #428, per the agreed scoping comment on the issue (see
gh issue view 428 --comments): the full native/extension/gap/manual-review taxonomy needs a general rule engine and an extension-alternative catalog this repo doesn't have yet, so this PR lands exactly one unambiguous pattern and proves the plumbing.review_projectv1 detects hand-writtenrequest.bodyvalidation (manualJSON.parse,typeof ... === '...'checks,Array.isArray(...)checks, explicit required-field checks like!body.nameorbody.email === undefined) in function/middleware source, and points at the declarative alternative (request.body.schema,src/body-schema.ts).prepareFunctionSnapshot(itself built oncollectSourcesFor/collectTrustedSourcesinsrc/function-sources.ts) to load function/middleware source — no new file access, no new trust boundary. Never executes project code, never reads env/secret bindings, never makes network calls, stays within the existing per-module/total byte budgets.review_project(same trust tier asinspect) and a CLI commandurlcode review-project [--json], following thesearch_docs/docs searchhouse style from Add function-handler section to llms.txt and urlcode docs search CLI #432.request.bodydirectly or a whole-body alias (const body = request.body); destructured per-field aliases are intentionally not tracked to avoid false positives on generic short identifiers. Missing a real case is preferred over flagging an unrelated validation.{format: 1, findings: [...], truncated?: true}), matching other bounded tool outputs in this codebase.docs/TOOLING.mdsection states the v1 scope and non-goals explicitly: no code execution, no other pattern types yet,native-alternativefindings only.Judgment calls
const body = request.body) is tracked for aliasing; destructured field names (const { name } = request.body) are not, to keep false-positive risk low as the issue discussion asked.reviewProjectis exported fromsrc/review-project.tsbut not re-exported fromsrc/index.ts, matching howsearchDocs(the pattern this follows) is MCP/CLI-internal only.Test plan
npm run typechecknpm run lintnode --conditions=development --test test/review-project.test.ts test/mcp.test.ts test/mcp-authoring.test.ts test/exports.test.ts test/cli.test.ts(all pass; updated hardcoded MCP tool-list counts intest/mcp.test.tsandtest/mcp-authoring.test.tsfor the new tool)node scripts/check-local-links.ts,check-trust-model-prose.ts,check-guidance-claims.tsurlcode review-project --project ...and--jsonagainst a fixture projectCloses #428
🤖 Generated with Claude Code