fix(types): P0 mypy — explicit binascii import, drop dead or None in ntlmssp

syslog_bridge.py: base64.binascii is not a public mypy-visible attribute;
import binascii directly and reference binascii.Error at the except clause.
Propagated to all 26 template subdirectory copies (all were drift-free).

ntlmssp.py: `principal = username or None` widened the type to str | None
for no runtime reason — _decode_str() always returns str.  Drop the `or None`.
Propagated to smb/ and rdp/ copies.

762 → 722 mypy errors (-40).
This commit is contained in:
2026-05-01 00:09:00 -04:00
parent fc1f0914b7
commit 909913e912
30 changed files with 57 additions and 30 deletions

View File

@@ -13,6 +13,7 @@ Facility: local0 (16). SD element ID uses PEN 55555.
"""
import base64
import binascii
import re
from datetime import datetime, timezone
from typing import Any, Optional
@@ -144,7 +145,7 @@ def classify_authorization(header_value: Optional[str]) -> Optional[dict[str, An
if scheme == "basic":
try:
decoded = base64.b64decode(rest, validate=True).decode("utf-8", errors="replace")
except (ValueError, base64.binascii.Error):
except (ValueError, binascii.Error):
return None
if ":" not in decoded:
return None