Repository navigation
Add a draft-only SignuDoc MCP server - #260
mariomeyer wants to merge 6 commits into
Conversation
|
@mariomeyer is attempting to deploy a commit to the Basic Intelligence Team on Vercel. A member of the Team first needs to authorize it. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
3d89e8f to
6fd30ff
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d89e8f106
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (granted === "prepare") { | ||
| return needed !== "write"; |
There was a problem hiding this comment.
Restrict webhook-delivery reads for prepare keys
When webhooks have recorded envelope events, a prepare key can now call GET /api/v1/webhook-deliveries, since that route only requires read. Its handler calls listApiWebhookDeliveries without the actor, and src/lib/webhooks/log.ts:149–155 selects all non-test deliveries without user or API-key filtering. The returned payloads contain envelope data, signer details and metadata, exposing envelopes created by other keys or users despite the new key-scoped envelope endpoints. Reject prepare keys on this route or filter deliveries to envelopes belonging to both the authenticated user and API key.
Useful? React with 👍 / 👎.
[Medium impact] The PR adds agent access to envelope preparation and reads within SignuDoc accounts. Block merging until FindingsSummaryAdds a draft-only MCP endpoint and a new
Reviews (1) · Last reviewed commit: "docs: document SignuDoc MCP setup" · Reviewed by Greptile |
| if (granted === "prepare") { | ||
| return needed !== "write"; |
There was a problem hiding this comment.
Draft keys read other envelopes
A prepare key can call GET /api/v1/webhook-deliveries because this branch grants access to every read route. That route returns stored payloads without checking the key or owner. These include other envelopes' titles, metadata, signer emails, and owner details, bypassing the new limits on envelope reads.
Block this route for prepare keys or filter its results to envelopes created by that key.
How this was verified: The read guard accepts prepare, and the delivery query returns full envelope payloads without a key or owner filter.
| } catch (error) { | ||
| if ( | ||
| error instanceof DocumentImportError || | ||
| error instanceof PendingUploadError | ||
| ) { | ||
| return toolError(error.message); | ||
| } | ||
| return toolError( | ||
| "Could not create the draft. Retry with the same idempotency key or review drafts in the dashboard.", | ||
| ); |
There was a problem hiding this comment.
decodeInlinePdf throws a plain Error for malformed base64 or a missing PDF header. This catch hides its useful message and tells the agent to retry the same request, which fails again.
Use a known input-error type and return its message so the agent knows to fix the PDF data.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
/api/mcp, authenticated with a dedicatedprepareAPI-key scope.Verification
npm test: 510 passed.npm run test:db: 414 passed.npm run typecheck: passed.npm run lint: passed with eight existing warnings and no new warnings.next build --webpack: passed.git diff --check: passed.The default Turbopack build could not bind its internal worker port in the local environment; the production webpack build passed.
Scheduled sending is intentionally out of scope.
Note
Add draft-only SignuDoc MCP server with
prepareAPI key scope/api/mcproute exposing two draft tools (upload target, unsent draft creation) and four read tools (envelope list, get, events, file download). Drafts are created unsent; sending remains dashboard-only.prepareAPI key scope betweenreadandwrite: prepare grants read plus draft creation, butsendEnvelopeForApirejects it with 403. A DB migration widens the scope check constraint (migration).preparescope, host/origin checks, and a configured app URL. Inline PDF input is limited to 3 MiB and must be canonical base64 with a PDF header (draft-tools.ts).prepareinstead ofwrite; write keys still pass, but any caller relying on the exact write requirement changes. The file-download handler in route.ts now returns 404 when its envelope lookup finds nothing.Macroscope summarized 6fd30ff.