veza/veza-backend-api/migrations/rollback
senke d31f5733d6
Some checks failed
Veza CI / Backend (Go) (push) Failing after 0s
Veza CI / Frontend (Web) (push) Failing after 0s
Veza CI / Rust (Stream Server) (push) Failing after 0s
Security Scan / Secret Scanning (gitleaks) (push) Failing after 0s
Veza CI / Notify on failure (push) Failing after 0s
chore(release): v1.0.6.2 — subscription payment-gate bypass hotfix
Closes a bypass surfaced by the 2026-04 audit probe (axis-1 Q2): any
authenticated user could POST /api/v1/subscriptions/subscribe on a paid
plan and receive 201 active without the payment provider ever being
invoked. The resulting row satisfied `checkEligibility()` in the
distribution service via `can_sell_on_marketplace=true` on the Creator
plan — effectively free access to /api/v1/distribution/submit, which
dispatches to external partners.

Fix is centralised in `GetUserSubscription` so there is no code path
that can grant subscription-gated access without routing through the
payment check. Effective-payment = free plan OR unexpired trial OR
invoice with non-empty hyperswitch_payment_id. Migration 980 sweeps
pre-existing fantôme rows into `expired`, preserving the tuple in a
dated audit table for support outreach.

Subscribe and subscribeToFreePlan treat the new ErrSubscriptionNoPayment
as equivalent to ErrNoActiveSubscription so re-subscription works
cleanly post-cleanup. GET /me/subscription surfaces needs_payment=true
with a support-contact message rather than a misleading "you're on
free" or an opaque 500. TODO(v1.0.7-item-G) annotation marks where the
`if s.paymentProvider != nil` short-circuit needs to become a mandatory
pending_payment state.

Probe script `scripts/probes/subscription-unpaid-activation.sh` kept as
a versioned regression test — dry-run by default, --destructive logs in
and attempts the exploit against a live backend with automatic cleanup.
8-case unit test matrix covers the full hasEffectivePayment predicate.

Smoke validated end-to-end against local v1.0.6.2: POST /subscribe
returns 201 (by design — item G closes the creation path), but
GET /me/subscription returns subscription=null + needs_payment=true,
distribution eligibility returns false.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 12:21:53 +02:00
..
076_create_gear_items_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
077_create_live_streams_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
078_add_missing_indexes_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
082_create_api_keys_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
125_follow_counts_triggers_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
129_playlist_editorial_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
132_quiet_hours_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
133_notification_grouping_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
134_weekly_digest_prefs_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
900_triggers_and_functions_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
910_create_audit_logs_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
920_add_performance_indexes_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
930_add_missing_foreign_keys_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
931_add_refresh_tokens_updated_at_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
940_performance_indexes_v0951_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
941_notification_prefs_defaults_v0105_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
942_create_co_listening_sessions_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
943_create_track_stems_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
944_create_data_exports_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
945_creator_analytics_v0110_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
946_advanced_analytics_v0111_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
947_moderation_advanced_v0112_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
948_marketplace_complete_v0120_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
949_subscription_plans_v0121_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
950_distribution_platforms_v0122_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
951_education_courses_v0123_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
960_performance_indexes_v0124_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
970_password_login_history_v0130_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
971_security_advanced_v0133_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
972_seller_kyc_v0135_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
973_support_tickets_v0135_down.sql chore: cleanup old e2e tests, playwright configs, reorganize down migrations 2026-03-18 11:35:26 +01:00
980_void_unpaid_subscriptions_down.sql chore(release): v1.0.6.2 — subscription payment-gate bypass hotfix 2026-04-17 12:21:53 +02:00