Skip to content

feat(platform): let products choose which billing actions need a recent sign-in - #32

Merged
clbotdev merged 1 commit into
mainfrom
feat/billing-recent-auth-actions
Nov 11, 2026
Merged

clbotdev merged 1 commit into
mainfrom
feat/billing-recent-auth-actions

Conversation

@clbotdev

Copy link
Copy Markdown
Contributor

Why

createBillingActionGrants makes every billing action, including starting a checkout, require a sign-in from the last 15 minutes, with no way to opt out. In CourseLit's onboarding a creator signs in, spends more than 15 minutes setting up their school, and then hits "Authentication is required" on the plan step. They are asked to sign in again just to pay us.

No common product asks for a fresh sign-in before a purchase, and here it protects nothing:

  • The single-use grant (bound to one person, session, action and target, valid for minutes) already stops replay and CSRF.
  • The payment provider confirms the payer.
  • A hijacked session that can start a checkout or cancel a plan can already do worse in the product without re-authenticating.

What

  • createBillingActionGrants({ recentAuthActions }) lists the actions that need a recent sign-in. The default is every action, so existing products behave the same. Pass ["payer_transfer"], or [] for none.
  • docs/architecture.md says what "sensitive action" means: hard to undo or able to move money or control away from the owner. Buying, changing or cancelling a plan is not.
  • ADR 0013's consequence line points to the option.
  • Changeset: minor for @codelitdev/platform.

Tests

packages/platform/src/billing/billing.test.ts checks that only the named actions need a recent sign-in, and that [] needs none. The full platform typecheck passes.

…nt sign-in

createBillingActionGrants takes recentAuthActions, defaulting to every
action as before. The architecture guide now says which actions count as
sensitive: buying, changing or cancelling a plan doesn't.
@clbotdev
clbotdev merged commit 706cf79 into main Nov 11, 2026
1 check passed
@clbotdev
clbotdev deleted the feat/billing-recent-auth-actions branch November 11, 2026 06:49
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.

2 participants