Commit 1d4704e
committed
fix(backup): reject pre-backup audit rows that a tab desynchronised
The pre-backup state-dir audit parses `find -printf "%y\t%p\t%l\n"` rows by
splitting on tab and reading the third field as the link target. A tab is a
legal byte in a Linux filename, so a path containing one splits the row into
extra fields: the real link target moves past the third field and is
discarded, and a fragment of the row is checked against the symlink whitelist
in its place. A symlink the audit is meant to reject is then recorded as
allowed.
Extra fields can only come from such a tab, so classify those rows as
violations. Shorter rows stay on the existing paths: the audit output is
trimmed as a whole, which removes the trailing empty `%l` of a final
non-symlink row.
Row classification moves into `classifyPreBackupAuditRow` so the field-count
check does not push `backupSandboxState` past its cognitive-complexity limit;
measured 148 before, 135 after.
Signed-off-by: Udaya Tejas <udayatejas2004@gmail.com>1 parent 390e3bb commit 1d4704e
2 files changed
Lines changed: 71 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1307 | 1307 | | |
1308 | 1308 | | |
1309 | 1309 | | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
1310 | 1342 | | |
1311 | 1343 | | |
1312 | 1344 | | |
| |||
1565 | 1597 | | |
1566 | 1598 | | |
1567 | 1599 | | |
1568 | | - | |
1569 | | - | |
1570 | | - | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
1571 | 1604 | | |
1572 | 1605 | | |
1573 | 1606 | | |
| |||
1611 | 1644 | | |
1612 | 1645 | | |
1613 | 1646 | | |
| 1647 | + | |
1614 | 1648 | | |
1615 | 1649 | | |
1616 | 1650 | | |
1617 | | - | |
1618 | | - | |
1619 | | - | |
1620 | | - | |
1621 | | - | |
1622 | | - | |
1623 | | - | |
1624 | | - | |
1625 | | - | |
1626 | | - | |
1627 | | - | |
1628 | | - | |
1629 | | - | |
1630 | | - | |
1631 | | - | |
1632 | | - | |
1633 | | - | |
| 1651 | + | |
1634 | 1652 | | |
1635 | 1653 | | |
1636 | 1654 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
200 | 204 | | |
201 | 205 | | |
202 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
0 commit comments