
January 31, 2017. A tired GitLab engineer fighting a spam wave at 11pm runs a delete to clear a broken database directory, then watches in horror as it chews through the primary instead of the empty secondary. 300 GB of live production data gone in seconds, and five separate backup methods turn out to be broken. The guard that would have saved them: only ever delete inside the backup root, nowhere else.
Objective
Return whether a path is safe to wipe: it must sit inside the backup root, not out in production.
Steps
$ under_backup_root("/var/opt/backup/db-2017")
1
$ under_backup_root("/var/opt/gitlab/data")
0
$ under_backup_root("/var/opt/backup/")
0
Expected files
Allowed functions
None. Write every helper yourself.
Loading solutions...