Docs / Threat Shield

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:

What triggers an anomaly

AnomalySeverityCondition
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 the next backup is compared with. A warning: Monday's backup is the baseline, Tuesday's loses a column and raises a warning once, and the next backup is compared with Tuesday's. A critical anomaly: Monday's backup is the baseline, Tuesday's loses a table and is flagged critical, the next backups are compared with Monday's, and once you resolve Tuesday's anomaly the next backup is compared with Tuesday's. a warning a critical anomaly Mon backup the baseline Tue: a column gone warning, sent once Next backup compared with Tue Mon backup the baseline Tue: a table gone critical, flagged Next backups compared with Mon You resolve Tue next compared with Tue
A critical anomaly keeps the last good backup as the comparison until you mark the drop as intended, so a second backup of the same damage is not taken as normal.

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:

Monday's snapshot holds 70,000 rows. Tuesday's holds 11,200, a drop of 84 percent, which raises a critical row_volume_drop anomaly. The alert names Monday's snapshot and pruning keeps it. Mon 02:00 snapshot 70,000 rows in 3 tables compared with the one before Tue 02:00 snapshot 11,200 rows, down 84% row_volume_drop, critical the alert names Monday's snapshot pruning keeps Monday's snapshot
A drop of more than 20% in a database's rows, against the snapshot before, is critical. The counts come from the host. SafeGrd never opens the snapshot.

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:

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.