Skip to content

Gate the quota-hook example's counter table off the MCP surface#576

Open
kylebernhardy wants to merge 1 commit into
mainfrom
docs/quota-example-exposure
Open

Gate the quota-hook example's counter table off the MCP surface#576
kylebernhardy wants to merge 1 commit into
mainfrom
docs/quota-example-exposure

Conversation

@kylebernhardy

Copy link
Copy Markdown
Member

One-hunk fix to the mcp.<profile>.quota.* example in reference/mcp/configuration.md: the exported McpQuota class also surfaced update_/delete_McpQuota MCP tools and a REST endpoint, letting a permitted client reset its own counter. The example now carries static exportTypes = { mcp: false }; with a comment, matching the hardened example in HarperFast/skills#69 (whose blind agent evaluation found the exposure).

Generated by an LLM (Claude Fable 5).

The example exported the counter table, which surfaces update_/delete_
verb tools and REST — letting a permitted client reset its own quota.
Found by a blind agent evaluation of the harper-mcp skill (skills#69).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kylebernhardy kylebernhardy requested a review from a team as a code owner July 8, 2026 23:42
@kylebernhardy kylebernhardy requested a review from kriszyp July 8, 2026 23:42

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the McpQuota class in reference/mcp/configuration.md to restrict its export types, preventing the exposure of MCP tools. The reviewer suggests also setting http: false in exportTypes to fully disable the REST endpoint and prevent unauthorized access, as setting only { mcp: false } leaves the HTTP endpoint exposed.

// update_/delete_McpQuota MCP tools and a REST endpoint, letting a
// permitted client reset its own counter. Keep the quota table off the MCP
// surface and restrict its REST permissions.
static exportTypes = { mcp: false };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The comment mentions keeping the quota table off the MCP surface and restricting its REST permissions. However, setting only { mcp: false } leaves the REST (HTTP) endpoint fully exposed. To completely disable the REST endpoint as well, you should also set http: false in exportTypes.

Suggested change
static exportTypes = { mcp: false };
static exportTypes = { mcp: false, http: false };

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-576

This preview will update automatically when you push new commits.

@kriszyp kriszyp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The static exportTypes = { mcp: false } line doesn't do what the comment claims — Harper's Resource/Table registration (resources/jsResource.ts, resources/Resources.ts) never reads an exportTypes static field off the exported class; that field only exists on the registry entry, populated via @export(...) (GraphQL schema tables) or a server.resources.set(name, resource, exportTypes) call. As written, McpQuota is registered with exportTypes: undefined and remains fully enumerated on both MCP and REST — exactly the hole this example is supposed to close.

Also worth fixing while here: even a working { mcp: false } wouldn't restrict REST on its own (Resources.getMatch's !== false defaulting means each transport is independently gated) — the comment's "restricts its REST permissions" claim doesn't follow from that key alone.

The mechanism that's actually wired today: server.resources.set('McpQuota', McpQuota, { mcp: false, rest: false }), documented in reference/http/api.md. Happy to help swap the example over to that if useful.

— KrAIs

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.

3 participants