kin: BATON-ARCH-011 Защитить BOT_TOKEN от утечки в nginx access.log

This commit is contained in:
Gros Frumos 2026-03-20 21:07:25 +02:00
parent 192c16b35e
commit 2c17ad4ddc
3 changed files with 113 additions and 3 deletions

View file

@ -32,15 +32,21 @@ _BACKEND_DIR = Path(__file__).parent.parent / "backend"
def test_aggregator_task_creation_commented_out_in_main():
"""asyncio.create_task must not appear in active code in main.py (ADR-004)."""
"""aggregator.run() must not appear in an active create_task call in main.py (ADR-004).
Note: other create_task calls (e.g. keep-alive) are allowed only the
SignalAggregator task is disabled in v1.
"""
source = (_BACKEND_DIR / "main.py").read_text()
active_lines = [
line
for line in source.splitlines()
if "create_task" in line and not line.strip().startswith("#")
if "create_task" in line
and "aggregator" in line
and not line.strip().startswith("#")
]
assert active_lines == [], (
f"Found active asyncio.create_task in main.py: {active_lines}"
f"Found active asyncio.create_task(aggregator...) in main.py: {active_lines}"
)