feat: modernize to Software Factory standards, add AppSec suite, and bump to v2.0.0
- Refactor tests to achieve 100% Zero-Mocks compliance (remove unittest.mock, add tests.helpers.env_override and stdlib redirects) - Extract testable parsing methods in package managers and inspector - Add tests/test_security.py with 5 negative AppSec test cases (Zip Slip, Root Gate, Tampering SHA-256, Secret Sanitization, and AST check for zero shell=True) - Expand is_sanitized_target to redact all private SSH/TLS keys (*.key, *.pem, id_*) - Split Gitea CI/CD pipelines into test-and-lint.yaml and build-and-release.yaml - Add .gitleaks.toml configuration - Formally close v1.0.0 genesis plan in docs/plans/linux-backuper/00-status.md as immutable ADR - Bump version to v2.0.0 across __init__.py, man page, tests, and documentation
This commit is contained in:
1 parent
3e5f2ab498
commit
4b3346fd74
22 files changed
+577
-203
No files matched your search
@@ -0,0 +1,21 @@
|
||||
"""Test helpers providing pure standard library utilities without mocks."""
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
from typing import Dict, Iterator, Optional
|
||||
|
||||
@contextlib.contextmanager
|
||||
def env_override(env_dict: Dict[str, str]) -> Iterator[None]:
|
||||
"""Context manager to safely override environment variables and restore original state."""
|
||||
original: Dict[str, Optional[str]] = {}
|
||||
for key, value in env_dict.items():
|
||||
original[key] = os.environ.get(key)
|
||||
os.environ[key] = value
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
for key, orig_val in original.items():
|
||||
if orig_val is None:
|
||||
os.environ.pop(key, None)
|
||||
else:
|
||||
os.environ[key] = orig_val
|
||||
Reference in new issue
Block a user