Data Protection
What protects stored data now
Section titled “What protects stored data now”- At rest: Railway encrypts volumes, backups, point-in-time recovery, buckets, and variables (AES-256). The API does not encrypt columns itself.
- Column types: PII is stored as ordinary
TEXT(user name and email, invite email, surety and contractor details, org domain),TEXT[](surety.attorneys,surety.notes(#516),contractor_account.notes), andJSONB(the audit log’sbefore/aftersnapshots). - Uniqueness: emails are unique case-insensitively
(
uniq_auth_user_emailonlower(email)), and lookups comparelower(email). Org domains areUNIQUE (domain)andNULLwhen unset. - Passwords: bcrypt, cost 12 (
authn.HashPassword/authn.ValidatePasswordininternal/authn/hash.go). - OTP codes: only an HMAC-SHA256 of the code is stored
(
auth.otp.code_hash), keyed withAUTH_OTP_SECRET(AuthConfig.OTPSecret) and compared in constant time.
The migration that removed it
Section titled “The migration that removed it”Migrations 00028–00030 decrypted every column in place: 00028 added
plaintext twins, 00029 filled them, and 00030 swapped them in and dropped
the encrypted domain. 00029 was a Go migration; #504 replaced it with an
empty SQL placeholder (00029_auth_decrypt_fields.sql) whose Down raises
migration 00029 is irreversible, so migrate down cannot cross it.