Introducing a new way to review your PRs.

Read the announcement

raroque / vibe-security-skill

Agent skill that audits vibe-coded apps for common security vulnerabilities introduced by AI coding assistants

View on GitHub

15 documents · Updated Oct 30, 2026

docs / payment-security

Payment security

Payment security protects the full transaction path from product selection to provider confirmation and access control. A secure integration keeps prices, customer identity, payment events, and entitlement state under trusted server control while limiting the data sent to the payment provider.

Security boundary

The payment provider is an external service that processes money and reports payment state. The application must treat client input as a request for an action, not as proof of price, identity, payment success, or account rights.

Transaction authority

The server owns the values that determine what a customer buys and what the customer must pay. It resolves the product or plan from trusted records before it starts checkout, so a client cannot replace the amount, currency, product, or quantity with a cheaper choice.

References: vibe-security/…/payments.md• L3-29

Payment data boundary

The application should pass only the payment context that the provider needs to complete the transaction. Payment status and customer references must not become trusted application state until the provider confirms them through an authenticated provider event.

References: vibe-security/…/payments.md• L31-49

Transaction flow

The transaction flow connects a client request to a server-owned order, a provider result, and a business decision. Each transition has a different trust source.

This diagram shows how trusted application data and authenticated provider events produce the final payment state.

flowchart LR
    A[Client requests purchase] --> B[Server resolves product and plan]
    B --> C[Payment provider checkout]
    C --> D[Authenticated provider event]
    D --> E[Server updates payment state]
    E --> F[Server checks access or entitlement]

Checkout context

Checkout context is the server-created link between a payment attempt and the intended customer, product, or plan. The server must set this context itself and must reject client-supplied identity or plan metadata as a source of truth.

References: vibe-security/…/payments.md• L61-63

Provider event trust

A webhook is an event sent by the payment provider to the application. The application must verify the event signature before it uses the event to change payment or account state, and it must preserve the request body needed for that verification.

References: vibe-security/…/payments.md• L31-49

Business controls

Payment security also protects business rules. The application must connect confirmed payment state to the correct customer and must apply current subscription or plan rules when it grants access.

Entitlement state

Entitlement is the application’s record of what a customer may use. The database, kept current from verified provider events, is the source for protected requests. Client flags, old login data, and stale token claims cannot prove that a subscription remains active.

References: vibe-security/…/payments.md• L52-59

Review points

A payment-integration review should trace these controls across the complete flow:

  • Product, price, currency, and quantity come from trusted server-side records.
  • Checkout identity and plan context are created by the server.
  • Provider callbacks are authenticated before they change state.
  • Payment and subscription records map to the intended customer.
  • Protected actions check current entitlement state on the server.

References: vibe-security/…/payments.md• L3-29 vibe-security/…/payments.md• L31-63

This page is the payment-specific child of External integration security. Review it with Data access security for payment records and Secrets and environment security for provider credentials and signing secrets.

Change checklist

When these files or sections are changed, remember to consider these:

  • Recheck every path that creates checkout context when product, plan, or customer fields change.
  • Recheck provider event verification when webhook routing, request parsing, or event handling changes.
  • Recheck access decisions when subscription or entitlement state changes.
  • Recheck the payment-to-customer mapping when account or checkout identity fields change.

Important failure modes

TriggerConsequenceGuard
A client supplies the amount or planThe customer can pay less than intended or select an unauthorized planResolve product and price data on the server
An unsigned provider callback changes stateAn attacker can mark a payment or subscription as successfulVerify the provider signature before processing the event
Checkout metadata comes from the clientPayment state can attach to another customer or planSet and validate checkout context on the server
Access uses a stale client flag or token claimA cancelled or expired subscription keeps accessCheck current server-side entitlement state

Key files

FileWhy to read it
vibe-security/…/payments.mdDefines the core review rules for prices, checkout context, provider callbacks, and subscription access.