Fix PCI Stripe e anteprima regia; checkout sempre hosted.
Blocca l'invio di numeri carta dall'API server, usa Checkout anche per i cambi piano e nasconde correttamente il placeholder video in regia. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
20
backend/spec/config/stripe_pci_guard_spec.rb
Normal file
20
backend/spec/config/stripe_pci_guard_spec.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe StripePciGuard do
|
||||
it "rileva hash carta grezza" do
|
||||
expect(described_class.raw_card_hash?({ number: "4242424242424242" })).to be true
|
||||
expect(described_class.raw_card_hash?({ exp_month: 12 })).to be true
|
||||
expect(described_class.raw_card_hash?({ token: "tok_visa" })).to be false
|
||||
end
|
||||
|
||||
it "blocca PaymentMethod.create con numero carta" do
|
||||
skip "Stripe gem non caricata" unless defined?(Stripe::PaymentMethod)
|
||||
|
||||
expect {
|
||||
Stripe::PaymentMethod.create(
|
||||
type: "card",
|
||||
card: { number: "4242424242424242", exp_month: 12, exp_year: 2034, cvc: "123" }
|
||||
)
|
||||
}.to raise_error(SecurityError, /PCI/)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user