fix: make stripe webhooks explicitly toggleable with mandatory secret validation

This commit is contained in:
2026-04-17 19:13:16 +05:45
parent 334f05783f
commit 5a9022bffc
11 changed files with 238 additions and 42 deletions
+11 -4
View File
@@ -135,11 +135,12 @@ impl Api {
}
pub fn router(self) -> Router {
let stripe_webhooks_enabled = self.billing.webhooks_enabled();
let state = AppState {
api: Arc::new(self),
};
Router::new()
let router = Router::new()
.route("/identity", get(get_identity))
.route("/plans", get(list_plans))
.route("/plans/:id", get(get_plan))
@@ -157,9 +158,15 @@ impl Api {
.route(
"/tenants/:pubkey/stripe/session",
get(create_stripe_session),
)
.route("/stripe/webhook", post(stripe_webhook))
.with_state(state)
);
let router = if stripe_webhooks_enabled {
router.route("/stripe/webhook", post(stripe_webhook))
} else {
router
};
router.with_state(state)
}
fn extract_auth_pubkey(&self, headers: &HeaderMap) -> std::result::Result<String, ApiError> {