Repository navigation
Commit 8fc1332
fix(security): close auto_config()'s missed log-redaction cache invalidation (#5053)
Holistic pass over #5053 looking for the next Copilot-review gap before another
round-trip: auto_config() (userinterface.py) is a third, independent place that
writes into self.args - alongside set_arg() and web.py's apps.yaml batch editor,
both already fixed - and had no invalidation at all. It resolves `re:` patterns
against live HA entity ids on every startup/reconfigure pass, so a resolved or
newly-unmatched-and-removed value could keep leaking under (or being missed by)
a stale redaction pattern until Predbat next restarts - the same leak class this
PR exists to close, just at a call site the first four review rounds didn't
reach. Invalidates once at the end of the pass, only when something changed,
rather than per key, since auto_config() iterates every configured arg on each
call.
Also documents, at the top of hass.py, why the module's "outside AppDaemon"
naming does not mean the write-time redaction only partially covers the real
addon population: genuine AppDaemon-hosted installs are retired, there is no
appdaemon dependency in this repo, and predbat.PredBat unconditionally inherits
from this file's Hass class in every currently supported install path (Predbat
app/addon and Docker) - so there is no separate, unprotected logging pipeline
left for the Samba-share scenario this PR targets.
Added a regression test mirroring test_set_arg_invalidates_log_secret_cache:
confirmed it fails with exactly the leak described (the resolved value reaches
the log unredacted) when the fix is reverted, and passes with it restored.
./run_all --quick and ./run_pre_commit both green.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 2dd5a06 commit 8fc1332
3 files changed
Lines changed: 82 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
7 | 19 | | |
8 | 20 | | |
9 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
618 | 672 | | |
619 | 673 | | |
620 | 674 | | |
| |||
706 | 760 | | |
707 | 761 | | |
708 | 762 | | |
| 763 | + | |
709 | 764 | | |
710 | 765 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1214 | 1214 | | |
1215 | 1215 | | |
1216 | 1216 | | |
| 1217 | + | |
1217 | 1218 | | |
1218 | 1219 | | |
1219 | 1220 | | |
| |||
1223 | 1224 | | |
1224 | 1225 | | |
1225 | 1226 | | |
| 1227 | + | |
1226 | 1228 | | |
1227 | 1229 | | |
1228 | 1230 | | |
1229 | 1231 | | |
1230 | 1232 | | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
1231 | 1246 | | |
1232 | 1247 | | |
1233 | 1248 | | |
| |||
0 commit comments