fix(billing): make payment-gateway credential a write-only secret #263
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/pms-342-payment-gateway-write-only-secret"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
GET /payment-gateways previously returned the decrypted gateway config (e.g. a Stripe secret key) to the client on every visit to the gateways page, defeating the at-rest encryption the moment the page is opened. Treat the credential as a write-only secret.
PaymentGatewayConfigResponse no longer carries the decrypted
config; it exposes only non-secret metadata (provider, is_active, is_test_mode) plusconfigured: boolso the client can render the list without ever seeing the plaintext. list_payment_gateways stops decrypting entirely; decryption stays server-internal for actual gateway calls.UpsertPaymentGatewayConfigRequest.config becomes Option: omitting it on update preserves the stored secret (metadata-only UPDATE that leaves config_encrypted untouched), while providing it replaces the secret. A first-time create with no config is a 400, since config_encrypted is NOT NULL and there is no existing secret to keep.
Adds an integration test asserting the upsert and list response bodies contain no plaintext credential field, that a config-less update preserves the stored encrypted secret, and that creating a gateway without a config is rejected.
#PMS-342