Repository navigation
Pass the operator's reviewed policy to inspection commands and the authoring MCP server (#834) - #849
Merged
Merged
Conversation
Adds proofs/private-requests: a packed-consumer site where Better Auth 1.7.6 on node:sqlite owns accounts, sessions and its tables, an operator adapter mounts its native handler and turns its verified session into the request principal and #840's request-bound `identity` capability, and ordinary function routes implement owner-private requests and one reviewer-only approval with parameterized SQL. The adapter refuses before serving on a missing secret, an uninitialized schema, an origin or basePath mismatch, telemetry left on, or a disabled rate limiter; forwards only an exact allowlist of Better Auth paths (disabledPaths misses parametric routes); and supplies the admitted client address for throttling in a header it always overwrites. test/private-requests.integration.ts (npm run test:proof) packs this checkout, installs it into a copy of the site, and exercises setup, explicit policy approval, provider/target refusals, declarative fixtures with audit ready, and the HTTP flow including foreign-owner and reviewer denial, malformed input, concurrent approval, cancellation, sign-out, revocation and throttling. Core: explain/report state that an extension mount's subpaths are provider-defined and not inspected, and list the capabilities a registration declares on the routes it protects. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tion verify:workspaces and the workspace-integration job now run npm run test:proof after test:addons. The proof packs the already-built core with --ignore-scripts, like the other packaging tests, so prepare never rebuilds dist under another test. Changes under proofs/ or to the proof's test are high-impact, so they select that job on a pull request. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t a shell On Windows the proof's behavior passed but teardown did not: separate t.after hooks run in registration order, so the temp site was removed while the served runtime still held its SQLite files (EBUSY), the server-stop hook never ran, and the live child kept the test process alive until the job timeout. One unwind stack now attempts every closer, newest first. npm runs through npm_execpath under this Node, so Windows needs no shell (DEP0190). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…thoring (#834) bootstrap, context, explain, review, plan-feature and mcp accept the operator's --policy. A verified policy pins the host file to its reviewed projectSha256, so no PROJECT_SHA256 export is needed; bootstrap and context repeat it in their emitted commands and drop it from prerequisites. The MCP server verifies it once at startup and its run_validate/run_test/run_audit runners forward the same file, and run_tests uses its grants. No tool argument can name, create or change a policy; an edited project still invalidates it until the operator reviews and replaces the file. An empty, unparseable or missing policy file is now named (#847). bootstrap no longer offers the site's data/ directory for serving, and its serving hint says operator code, credentials and data stay outside the project. The #843 proof now runs its connected MCP workflow: run_validate and run_test pass on the packed site with only the operator's flags. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Sep 28, 2026
…text-834 # Conflicts: # proofs/private-requests/README.md # test/private-requests.integration.ts
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.
Problem and change
The #843 proof (#848, which this PR is stacked on) found the gap #834 describes. A site whose routes need operator-granted bindings could not be validated or tested from the authoring MCP server, and the inspection commands needed
PROJECT_SHA256exported by hand.bootstrapdid name--policyand--originunderprerequisites, but nothing could accept a policy, so its commands never became complete.This PR lets the operator's reviewed policy reach those tools:
--policyonbootstrap,context,explain,review,plan-featureandmcp. A verified policy pins the host file to itsprojectSha256, so noPROJECT_SHA256export is needed.bootstrapandcontextrepeat it in every emitted command and drop it fromprerequisites.bootstrapnames a policy inside the site relative to the site root, since its commands run from there.run_validate,run_testandrun_auditforward the same file (as an absolute path), next to the--host-fileand--originthey already forwarded, and in-processrun_testsuses its grants.urlcode mcpaccepts no--policy"). The file is chosen only by the operator on the server's command line. No tool argument can name, create or change it, and editing the project still invalidates it until the operator reviews and replaces the file. Please veto this if you want MCP to stay grant-free.data/directory (operator databases and keys; init's.gitignorealready excludes it) is no longer offered for serving. The hint for other directories now says operator code, credentials and data stay outside the project.extensionsis now the only host-loading command without--policy; the #723 test moved to it.Verification
test/validation-context.test.tscovers:bootstrapcommands carry--policyand run as printed;data/is excluded.contextandexplainload a host that refuses without a reviewed revision.run_validatepasses,run_testspasses 1/1 andget_contextcommands carry the policy.test:proofgains the connected MCP workflow:urlcode mcp --allow-authoring --host-file host.mjs --origin … --policy …on the packed Better Auth site, whererun_validateexits 0 andrun_testpasses all 34 cases. Now 12/12.PROJECT_SHA256unset, over MCP:run_validate0,run_test34/34,run_audit0, andget_context {bootstrap: true}returns complete commands with no prerequisites. On the CLI,context,explain,reviewandplan-featureall succeed.npm run verifysteps all pass: corenpm test1,097 tests, workspace suites,audit:packages,test:addons,test:proof,check:code,check:docs.npm run test:packagepasses.test:proofis on Prove embedded Better Auth in one local URLCode site (#843) #848.Compatibility and security
CLI flags are additive. The MCP tool descriptions and
docs/TOOLING.mdnow describe the forwarded policy. No YAML or schema change.Grants still come only from an operator file outside the project, pinned to the reviewed revision. Nothing computes, writes or repins a policy. Runner children still get only
PATH(plusPROJECT_SHA256in the old host-without-policy case).Changes match the documented portable contract; docs/examples are updated where needed.
Relevant tests and package checks pass, or limitations are explained above.
No credentials, customer data or private project material are included.
Runtime/starter changes remain aligned where applicable. (Starter assets regenerated; no change.)
🤖 Generated with Claude Code