feat(payment): expand Stripe methods and checkout handoff
Docker Image / Build and Push Docker Image (push) Successful in 2m10s
Docker Image / Build and Push Docker Image (push) Successful in 2m10s
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { Logger } from "../logger";
|
||||
|
||||
describe("Logger Stripe secret redaction", () => {
|
||||
it("redacts nested Stripe secret fields and values before formatting", () => {
|
||||
const output = Logger.formatValue({
|
||||
payParams: {
|
||||
clientSecret: "pi_123_secret_card",
|
||||
nested: {
|
||||
customerSessionClientSecret: "cuss_123_secret_saved",
|
||||
handoffToken: "one-time-checkout-token",
|
||||
safe: "order-123",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(output).toContain("order-123");
|
||||
expect(output).not.toContain("secret_card");
|
||||
expect(output).not.toContain("secret_saved");
|
||||
expect(output).not.toContain("one-time-checkout-token");
|
||||
expect(output.match(/\[REDACTED\]/g)?.length).toBeGreaterThanOrEqual(3);
|
||||
});
|
||||
|
||||
it("redacts a secret embedded in a serialized response string", () => {
|
||||
const output = Logger.formatValue(
|
||||
JSON.stringify({ customerSessionClientSecret: "cuss_1_secret_value" }),
|
||||
);
|
||||
|
||||
expect(output).not.toContain("secret_value");
|
||||
expect(output).toContain("[REDACTED]");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user