op-vault: test that a token is independent of the PAN, not free of "4242" #126
Loading…
Reference in a new issue
No description provided.
Delete branch "openpay/token-independence-test"
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?
pan_never_appears_in_token_stringfailed the openpay leg of standards-build on #102, which touches nothing in openpay.Cause. The test asserted that the token never contains
"424242"or"4242". A token isTOKEN_PREFIXplus a UUIDv7 in hex. A random hex string contains"4242"now and then: 23 of 200,000 UUIDv7s did, about 1 in 8,700. Any PR whose openpay leg runs can hit this. The timestamp part of the token at CI time (01a0f4ee2960) has no4242in it, so the match came from the random suffix.Fix. Keep the full-PAN check. Replace the substring checks with the property they were meant to stand for: the same card tokenized twice gets two different tokens, and neither contains the PAN. A missing substring never showed that the token isn't derived from the card. Two different tokens for one card does show it.
Verified.
cargo test -p op-vault --features in-memory: 40 + 11 passed.--features in-memorythe lifecycle binary has 0 tests. CI's openpay leg does enable the feature, which is why it failed there.🤖 Generated with Claude Code