fix(security): close fail-open paths found by the integration suite - #7886
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
54e3401 to
7ad6309
Compare
- Keep an organization's permission groups governing while its payment is failing: enforcement read the usable-subscription set, so a past-due card resolved to "no permission group", which denies nothing and lifted every restriction the organization had configured - Shorten the one-time token lifetime from 24 hours to 2 minutes; the token redeems for a session cookie, so an unredeemed one was a bearer credential for that session until it expired - Refuse the plugin's password-reset endpoints by shape, and refuse the verification sender when it is asked for a reset: both reach the same mailer as the application route without its per-recipient budget - Answer an expired or reused reset link with a 400 and fixed copy rather than a 500 carrying the library's wording, while keeping the request half indistinguishable from a success so it discloses no addresses - Return an invitation token only to callers who may manage the workspace, and stop sending terminal invitations to the client at all - Validate usage dates with the calendar check zod already ships, which cannot throw out of validation the way the hand-rolled round trip did
7ad6309 to
b7560e3
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 28 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Summary
Six fixes for issues surfaced while running the integration suite. Each was confirmed against the source before being fixed, and each carries a regression test that was verified to fail without its fix.
activeonly), so apast_dueorganization resolved toentitled: false→config: null— which denies nothing, and therefore lifted every restriction the organization had configured, silently, for the whole dunning window. The billing summary meanwhile reported the subscription as active, and the admin could not open permission-group settings to notice. Governance now reads its own resolver: every entitled status counts, the billing block does not apply, and a read failure throws rather than answering "no restrictions"./api/auth/forget-passwordwithout its per-recipient budget or its audit record. Now refused by shape rather than by an exact list, so a renamed or added alias cannot reopen the path. The verification-code sender takes its purpose from the request body and sends reset mail when asked for it, so it is refused for that purpose and left reachable for the one the product actually sends — the resend button on/verify.z.iso.date(), the leap-year-aware calendar check zod already ships, which cannot throw.Type of Change
Testing
Rebased onto
stagingafter the SSO merge. Reviewed by three independent passes (correctness/regression, cleanup, simplify) whose findings are folded in — including two the review caught that the first round missed: the verification sender reached the same mailer under a different purpose, and routing the management API through the governance reader would have opened it for an organization whose settings page still 404s.Tested manually.
bun run lint,bun run type-check,bun run check:audits(46 audits),bun run check:api-validation, andbun run docs-manifest:checkall pass; 3,720 tests pass across the affected surface. Every new test was checked against the unfixed code first to confirm it fails there — one initially did not, and was rewritten to assert the query filter rather than a mocked row.Checklist