Dev.to Security 🔐 Cybersecurity 👁 0 📖 2 min read

Your test fixtures are probably emailing a stranger

quick one for anyone who seeds a staging database. think about what is in that seed file. emails, phone numbers, IPs, card numbers. if any of those is a real thing, then one day your staging box sends a welcome mail to a

quick one for anyone who seeds a staging database. think about what is in that seed file. emails, phone numbers, IPs, card numbers. if any of those is a real thing, then one day your staging box sends a welcome mail to an actual person, and you will not even know.

so the rule i follow is make every value harmless by how it is built, not by being careful. careful fails, we all get lazy on a friday.

emails first. use example.com. it is reserved for documentation by RFC 2606, nobody can register it, no inbox sits behind it. a made up domain like testmail.in feels safe but it is not, someone can buy it next year and then every fixture you ever sent goes to them.

IPs next. there are three blocks set aside for examples, 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 (RFC 5737). nothing real is ever there. a random IP is a live server on somebody's network, and your rate limit test or port check can hit it. 192.168 stuff is also not safe, that is real on somebody's LAN.

cards. a number that passes the Luhn check is not fake, make sure of this okay. about one in ten random 16 digit numbers passes it, and with a real bank prefix in front it can match a live card. only use the test numbers the gateway itself publishes, Stripe and Razorpay both have lists, and they work in the sandbox and nowhere else.

then a seed. same seed same rows, every machine. a test that fails on run nine and the data is gone is a ghost, you cannot chase it. keep the seed in the repo, not a megabyte of sample data.

and the gap, which is phone numbers in india. the UK keeps a block of 1,000 mobile numbers for drama that nobody gets allocated. i looked and i could not find an Indian equivalent. so a random 10 digit number starting 6 to 9 can belong to a real person. use them for display and validation only, point every SMS or OTP test at your own phone or the provider's test mode.

i built a generator that does all of this, emails at example.com, IPs from those three blocks, the published cards, seeds. so ya, biased. the full write up is here if you want the details: https://theomnikit.com/guides/test-data-that-cannot-reach-a-real-person?utm_source=devto&utm_medium=article&utm_campaign=devto-fixtures-email-a-stranger

do you seed with real looking data or obviously fake? i go obviously fake now.

used an AI assistant to help draft this, the facts are from the guide page.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.