Threat Shield
Threat Shield tells you when a backup succeeded but the data in it shrank, and which earlier snapshot is the known-good one to restore from.
A backup that exits 0 can still hold the wrong data. If a migration drops a table or a script truncates one, the next backup copies what is left and reports success. When the host reports the backup, Threat Shield compares the snapshot's counts with the one before it. If they dropped sharply, the snapshot is marked anomalous instead of healthy.
What it compares
Threat Shield does not open snapshots. It works from the counts the host reports with each backup, and those say nothing about the contents:
- Tables and rows per table (Postgres, MySQL, MariaDB and SQLite)
- Each table's columns, by name (Postgres, MySQL, MariaDB and SQLite)
- Collections and documents (MongoDB)
- Installed extensions (Postgres)
- Files (file trees)
- Messages (mailboxes)
What triggers an anomaly
| Anomaly | Severity | Condition |
|---|---|---|
| row_volume_drop | Critical | Compared with the snapshot before, a database's total rows drop by more than 20%, a file tree's files by 25% or more, or a mailbox's messages by 30% or more. Rows that left with an old partition are not counted. Neither are rows gone from a table whose newest row is still there, since that is a purge of old rows. A drop of fewer than 100 rows is a warning, and so is a drop in a file tree or mailbox that held fewer than 50 items. |
| table_drop | Critical | A table or collection from the snapshot before is missing. It is not flagged when a newer partition of the same name replaced it (messages_2026_10_15 gone, messages_2026_10_18 new). It is also not flagged when a new table has the same columns, which is a rename. A missing table that held no rows is a warning. |
| empty_snapshot | Critical | The snapshot has no tables, files or messages where the one before had some. A file tree or mailbox that held fewer than 50 items is a warning. |
| extension_mismatch | Warning | A Postgres extension from the snapshot before is missing. Without it, the schema can fail to restore. |
| stale_table | Warning | A table gained at least 5 rows and 1%, but its newest updated_at, modified_at or created_at did not move. That is what rows loaded from an old export look like. Check that the surface's connection string points at the live database. Fewer rows with the same newest row is a purge of old rows, and is not flagged. This warning does not make SafeGrd keep the snapshot before any longer. |
| column_drop | Warning | A table from the snapshot before has lost a column, by name. The table and its rows are still there, but the data in that column is gone, and no row count would show it. If a column of the same type was added at the same time, it is taken as a rename and not flagged. A migration that drops a column on purpose looks the same, so this is only a warning, and the snapshot before is not kept any longer. Once you have checked the change, resolve it, and the next backup is compared with this one. Columns are compared only when both backups recorded them. |
A warning is sent once. The next backup is compared with the flagged snapshot, so the same change does not raise it again. A critical anomaly works differently. The next backups are compared with the snapshot before the flagged one, until you resolve the anomaly. After that, the next backup is compared with the flagged snapshot.
What each snapshot records
Each completed snapshot carries Threat Shield's record. It names the snapshot it was compared with, and lists each check with the numbers it used and whether it passed. It also lists what changed between the two: tables added and gone, tables whose definition changed, columns lost or gained, and the tables whose row count moved most. The console shows this record on every snapshot, including the ones that were not flagged. A surface's first backup records that there was nothing to compare it with.
Each PostgreSQL, MySQL, MariaDB and SQLite backup also records every table's columns (name,
type, not null, primary key) and a hash of the table's definition. A MongoDB backup records
each collection the same way. It lists the top-level fields across every document in the
backup, with their BSON type (mixed where documents disagree). _id
counts as the primary key, and a field that every document has counts as not null. If a field
disappears from every document, you get the same column_drop warning.
Column names are schema, like the table names already recorded. The rows stay sealed in the backup. On the surface's Tables tab in the console, you can see each table across the last 30 backups: its row count as a line, its size, its newest row, when its definition changed, and what the last drill found for it. Click a row to see its columns (details).
Newest row and sample hash
For each table, a PostgreSQL backup records two more things, and the console shows both in a snapshot's table list:
- The newest value in the first timestamp column the table has, out of
updated_at,modified_atandcreated_at. It is read under the backup's own snapshot. A table with none of the three has no newest row. On a table over 256 MB, the value is read only when an index leads with that column, so the backup does not read the table twice. - A SHA-256 of the table's first 100 rows by primary key. A table without a primary key has no hash. SafeGrd records the hash but does not alert on it, because any update to those rows changes it.
Why the good snapshot is still there
The alert names the last known-good snapshot, and pruning keeps it while you look into the anomaly (Storage and retention). Under Object Lock, the snapshots taken before the damage cannot be deleted until their locks end anyway.
Threat Shield does not freeze or extend any lock. A lock is set once, when the snapshot is written. To
keep a known-good snapshot longer, restore it and back it up again, or copy it out with
safegrd export.
Alerts
Threat Shield sends each anomaly as the anomaly event (Alerts).
You see it in three places:
- Your organization's webhook (Slack, Discord or generic JSON) gets the surface, what dropped, and the known-good snapshot.
- On paid plans, the organization's owners and admins get an email, once an owner or admin turns email alerts on under Settings → Alerts.
- The console marks the surface and the snapshot as anomalous.
When you drop data on purpose
If you prune an audit log or drop a table on purpose, the next backup flags the drop. For a warning you do not need to do anything, because the next backup is compared with the flagged one anyway. For a critical anomaly, resolve it in the console. The next backup is then compared with the flagged snapshot.