-
-
Notifications
You must be signed in to change notification settings - Fork 0
Contributing
- Fork the repository
- Clone:
git clone https://github.com/YOUR_USERNAME/Apotropaios-Firewall-Manager-Python-Variant.git - Setup:
make dev-setup && source .venv/bin/activate - Branch:
git checkout -b feature/your-feature develop - Develop (follow coding standards below)
- Test:
make check(mypy --strict + 322 tests -- MUST pass) - Security:
make security-scan(6 checks -- MUST pass) - PR: Submit against
developbranch
-
make typecheck-- mypy --strict with zero errors across all 35 files -
make test-- 322/322 tests passing, no skips, no xfail -
make security-scan-- All 6 static pattern checks passing
- Full type annotations on every function (params + return)
-
from __future__ import annotationsat top of every module - Google-style docstrings on all public functions/classes
- Module headers with File, Project, Synopsis, Description, Notes, Version
- Never
shell=Truein subprocess -- always list-form - Always capture stderr on subprocess calls
- Validate all input through
core/validation.pybefore use - Atomic writes for persistent data (temp →
os.replace()) - Thread safety via
threading.Lockon shared mutable state - No circular imports -- strict 5-layer dependency ordering
- No stubs or placeholders -- every function fully implemented
- New feature → unit tests (normal + error paths)
- Bug fix → regression test that fails before fix
- New validator → valid AND invalid input tests
- New CLI command → subprocess integration test
- New backend → MockBackend-based tests
- New backend command-composition or fail-closed path → direct builder/mapper test (see
tests/unit/test_backend_validation.py) - New workflow or issue template → covered by the CI meta-suite (
tests/ci/test_workflows.py)
The suite has four tiers: unit (tests/unit/), integration (tests/integration/), security (tests/security/), and CI meta-tests (tests/ci/) that validate the workflow and issue-template files as data.
Five workflows run on every pull request and must pass before merge: ci.yml (lint, strict typing, test matrix on Python 3.12 and 3.13 with coverage, security tests, and consistency checks), security.yml (bandit SAST plus the security suite), codeql.yml (CodeQL semantic analysis), docs-validate.yml (the two validation scripts plus the CI meta-suite), and release.yml (tag-versus-version gate, build, checksums, and release publishing on version tags).
Two scripts back the consistency gates and run locally:
python3 scripts/check_version_consistency.py # every version location agrees
python3 scripts/validate_docs.py # documentation matches sourceThe first verifies that every version-bearing file matches the canonical VERSION. The second verifies documentation accuracy against source -- line counts, suite-total test counts, command counts, the no-version-identifiers-outside-changelogs policy, and internal links. Run both before opening a pull request.
Workflow action pins follow a fixed standard (checkout@v6, setup-python@v6, upload-artifact@v6, download-artifact@v6, codeql-action@v4), enforced by the CI meta-suite. PyYAML is a required CI dependency alongside pytest: without it the CI meta-suite is silently excluded from collection.
File issues through the structured forms: Bug Report, Feature Request, Documentation Issue, and Platform / Backend Support Request. Blank issues are disabled. Security vulnerabilities go through the private disclosure process in the security policy, never as a public issue.
feat(nftables): add rate limiting support
fix(firewalld): reset iterates ALL zones
docs(developer): expand validation detail
test(security): add hostname injection tests
| Code | Pitfall | Prevention |
|---|---|---|
| PY-003 | CLI handlers scaffolded but never wired | Wire immediately when engine module completes |
| PY-004 | Tests pass with dead CLI code | Use subprocess integration tests |
| PY-005 | pip vs pip3 | Always pip3 |
| PY-007 | Post-shutdown console noise | Remove console handler before shutdown marker |
| PY-008 | Status shows rules instead of service state | Status = service state. List = rules. |
| PY-009 | pip install discovers data/ as package | Explicit package discovery in pyproject.toml |
DO NOT report vulnerabilities through public issues. See Security Policy for coordinated disclosure process. Security fix PRs should include CWE reference, regression test, and SECURITY.md update.
Apotropaios Firewall Manager -- Python Variant · Home · Quick Start · Architecture · Security · Bash Variant
Apotropaios -- Python Variant
Getting Started
Architecture
Operations
Project
35 files · 14,545 lines · 322 tests