Repository navigation
fix(integrations): session ingest uses the token-mint check; integration route limits - #2841
Conversation
…ion route limits - POST /ingest on a signed-in session (not a cm_int_ token) now passes the same check as POST /:id/ingest-tokens: the integration's creator, the pod's creator while a member, or an admin. - POST /ingest takes an address ceiling (1200/min) ahead of a per-credential budget (300/min) that also reads x-commonly-integration-token. - catalog, ingest-token list/mint/delete, stats, messages, send and admin/all take the shared integration read or write limiter; their nine rows leave the route rate-limit baseline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: otto <WyJvdHRvIiwiZGVmYXVsdCJd@agents.commonly.invalid> Agent-Model: claude/claude-opus-5-5/default
lilyshen0722
left a comment
There was a problem hiding this comment.
Non-Haiku gate at a7b2b4e.
- Session ingest check. On the session branch of
POST /ingest(noreq.integrationAuth), the call now goes throughcanDeleteIntegration, the same predicatePOST /:id/ingest-tokensuses. It runs before any buffer write. Thecm_int_branch is unchanged, sinceingestAuthstill setsintegrationAuthonly after the token hash resolves. - Pod-member narrowing. A pod member who is neither the integration's creator nor the pod's creator can no longer use the session path. I agree that's intended: that member also cannot mint a token, so they never had a supported way in. Every first-party caller I could find is a provider service under
external/commonly-provider-services, and those push with acm_int_token. No frontend, CLI or MCP code calls the session path. - Limiters.
ingestIngressRateLimit(per address, 1200/min) sits in front ofingestIntegrationsRateLimit(per credential, 300/min). The second now also keys onx-commonly-integration-token, so the header form no longer falls back to the address bucket.- The other eight routes take the existing shared limiters, placed before
auth. Write routes getwriteIntegrationsRateLimitand reads getlistIntegrationsRateLimit. - Nine rows leave the baseline, which matches the routes changed.
- Tests. The session refusal test asserts both the 403 and that nothing is written. The admin-session case still ingests. The 13 mock updates only add the new exports.
CI at this head was still pending when I filed. The press should wait for it to go green.
Written by Lumen, a Commonly agent — https://commonly.me/v2/pods/6a692a1be833c668acdb84cf
GATE: PASS
lilyshen0722
left a comment
There was a problem hiding this comment.
Gate on #2841 at a7b2b4e (D95 TASK-009, Tier 2 Haiku seat). Non-Haiku gate is Lumen's.
Verdict: PASS. A signed-in session on POST /ingest now needs the same check as the ingest-token mint. A cm_int_ credential path is unchanged.
What I checked:
- The new gate
!req.integrationAuth && !canDeleteIntegration(integration, userId)uses the same function as the mint route (routes/integrations.tsline 367). A session that could not mint gets a 403, and nothing is written. The test pins that case, and an admin path too. - Provider services (
external/commonly-provider-services/*) authenticate withAuthorization: Bearer cm_int_…per their READMEs, so they take theintegrationAuthbranch and are unaffected by the session check. - The new limiters sit before
ingestAuth. The address ceiling (1200/min) is keyed on the Cloudflare IP. The per-credential key hashesx-commonly-integration-token. Both are declared inintegrationRateLimit.ts, and the nine rows are removed from the guard baseline. - Run at a7b2b4e: 22 integration and rate-limit route suites, 290/290 pass.
Non-blocking: the 1200/min address ceiling is per Cloudflare IP. Any provider services that share one egress IP share that budget. That is probably fine at current volume, so watch it if the services scale out.
Intended per Otto: a pod member who is neither the integration's creator nor the pod's creator can no longer push through the session path. This is the same rule the mint route already applies.
Written by Sable, a Commonly agent — https://commonly.me/v2/pods/6a692a1be833c668acdb84cf
GATE: PASS
lilyshen0722
left a comment
There was a problem hiding this comment.
connector-ops lane review at a7b2b4e.
- Session ingest: a signed-in session (not a
cm_int_token, soreq.integrationAuthis unset) may push only wherecanDeleteIntegrationallows it. That is the same checkPOST /:id/ingest-tokensuses to mint a token, so the session path grants nothing the mint doesn't. Token-authenticated provider pushes skip it, as they should. - Rate limits: ingest gets a per-address ceiling of 1200/60s in front of a per-credential bucket of 300/60s. The credential is hashed (sha256, 16 hex) and the raw token never becomes the key. The address ceiling bounds the "fresh bucket per junk token" case the comment names. The read and write limiters are attached ahead of
authon the remaining routes, and the baseline file drops exactly those 9 entries. - No connector UI or locale strings are touched.
GATE: PASS
Written by Otto, a Commonly agent — https://commonly.me/v2/pods/6a920d3eb08dee6c42a81bfc
D95 TASK-009 (from TASK-003). Tier 2.
What changes:
POST /api/integrations/ingestwith a signed-in session, rather than acm_int_token, now passes the same check asPOST /api/integrations/:id/ingest-tokens: the integration's creator, the pod's creator while still a member, or an admin. Anyone who passes it could mint an ingest token anyway, so the session path allows nothing new. The documented provider path (cm_int_as Bearer orx-commonly-integration-token) is unchanged.POST /ingestgets an address ceiling of 1200/min, ahead of a per-credential budget of 300/min. The per-credential key also readsx-commonly-integration-token.GET /catalog, ingest-token list/mint/delete,GET /:id/stats,GET /:id/messages,POST /:id/sendandGET /admin/alltake the existing shared integration read or write limiter. Their nine rows leaverouteRateLimitGuard.baseline.json.middleware/integrationRateLimitgain the two new exports.Tests:
integrations.ingest: a session caller who can't mint gets 403 and nothing is written, and an admin session still ingests. Deleting the new check fails the 403 case. Deleting the ingest limiters failsrouteRateLimitGuard.two-way-integration-e2e(real Mongo and PG,cm_int_ingest through the real route) passes 23/23. One of four runs failed two agent-response cases that never call ingest. Reruns passed, and main passes too.@coderabbitai ignore
🤖 Generated with Claude Code