wargline 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wargline-0.1.0/.gitignore +47 -0
- wargline-0.1.0/CHANGELOG.md +62 -0
- wargline-0.1.0/CONTRIBUTING.md +88 -0
- wargline-0.1.0/LICENSE +201 -0
- wargline-0.1.0/NOTICE +2 -0
- wargline-0.1.0/PKG-INFO +327 -0
- wargline-0.1.0/README.md +292 -0
- wargline-0.1.0/SECURITY.md +33 -0
- wargline-0.1.0/integrations/SKILL.md +156 -0
- wargline-0.1.0/locales/en.yaml +461 -0
- wargline-0.1.0/pyproject.toml +118 -0
- wargline-0.1.0/src/wargline/__init__.py +5 -0
- wargline-0.1.0/src/wargline/__main__.py +4 -0
- wargline-0.1.0/src/wargline/cli.py +1063 -0
- wargline-0.1.0/src/wargline/core/__init__.py +148 -0
- wargline-0.1.0/src/wargline/core/commands.py +217 -0
- wargline-0.1.0/src/wargline/core/context.py +617 -0
- wargline-0.1.0/src/wargline/core/engine.py +521 -0
- wargline-0.1.0/src/wargline/core/exporter.py +1915 -0
- wargline-0.1.0/src/wargline/core/models.py +456 -0
- wargline-0.1.0/src/wargline/core/netinfo.py +1574 -0
- wargline-0.1.0/src/wargline/core/redact.py +779 -0
- wargline-0.1.0/src/wargline/core/registry.py +89 -0
- wargline-0.1.0/src/wargline/core/requests.py +504 -0
- wargline-0.1.0/src/wargline/core/safety.py +1511 -0
- wargline-0.1.0/src/wargline/data/gtfobins_sudo.yaml +129 -0
- wargline-0.1.0/src/wargline/data/high_risk_ports.yaml +60 -0
- wargline-0.1.0/src/wargline/formatters/__init__.py +11 -0
- wargline-0.1.0/src/wargline/formatters/json_fmt.py +11 -0
- wargline-0.1.0/src/wargline/formatters/sarif_fmt.py +194 -0
- wargline-0.1.0/src/wargline/formatters/text_fmt.py +285 -0
- wargline-0.1.0/src/wargline/i18n.py +110 -0
- wargline-0.1.0/src/wargline/mcp/__init__.py +19 -0
- wargline-0.1.0/src/wargline/mcp/server.py +796 -0
- wargline-0.1.0/src/wargline/rules/__init__.py +23 -0
- wargline-0.1.0/src/wargline/rules/base.py +76 -0
- wargline-0.1.0/src/wargline/rules/docker_ufw_bypass.py +1131 -0
- wargline-0.1.0/src/wargline/rules/exposed_services.py +512 -0
- wargline-0.1.0/src/wargline/rules/ssh_hardening.py +1768 -0
- wargline-0.1.0/src/wargline/rules/sudoers_audit.py +2115 -0
- wargline-0.1.0/src/wargline/rules/sysctl_network.py +1280 -0
- wargline-0.1.0/src/wargline/rules/unattended_upgrades.py +885 -0
- wargline-0.1.0/src/wargline/tui.py +1252 -0
- wargline-0.1.0/tests/conftest.py +324 -0
- wargline-0.1.0/tests/fixtures/apt_20auto_upgrades.txt +2 -0
- wargline-0.1.0/tests/fixtures/apt_config_dump_periodic_disabled.txt +4 -0
- wargline-0.1.0/tests/fixtures/apt_config_dump_periodic_enabled.txt +3 -0
- wargline-0.1.0/tests/fixtures/apt_docker_disable_periodic_update.txt +1 -0
- wargline-0.1.0/tests/fixtures/auth_log_sample.txt +5 -0
- wargline-0.1.0/tests/fixtures/authorized_keys_valid.txt +4 -0
- wargline-0.1.0/tests/fixtures/compose_wildcard.yaml +13 -0
- wargline-0.1.0/tests/fixtures/cvtsudoers_risky.json +197 -0
- wargline-0.1.0/tests/fixtures/cvtsudoers_syntax_error.txt +3 -0
- wargline-0.1.0/tests/fixtures/daemon_nftables.json +4 -0
- wargline-0.1.0/tests/fixtures/dnf_automatic_disabled.conf +4 -0
- wargline-0.1.0/tests/fixtures/docker_inspect_sample.json +69 -0
- wargline-0.1.0/tests/fixtures/docker_ps_sample.jsonl +3 -0
- wargline-0.1.0/tests/fixtures/export/hardening.sh +754 -0
- wargline-0.1.0/tests/fixtures/export/hardening.yml +664 -0
- wargline-0.1.0/tests/fixtures/firewalld_active_zones_docker.txt +4 -0
- wargline-0.1.0/tests/fixtures/getent_group_docker_empty.txt +2 -0
- wargline-0.1.0/tests/fixtures/getent_group_docker_members.txt +1 -0
- wargline-0.1.0/tests/fixtures/ip_addr_vpn.json +39 -0
- wargline-0.1.0/tests/fixtures/iptables_nat_docker.txt +5 -0
- wargline-0.1.0/tests/fixtures/journalctl_ssh_24h.txt +8 -0
- wargline-0.1.0/tests/fixtures/nft_docker_compat_accept.txt +35 -0
- wargline-0.1.0/tests/fixtures/nft_input_drop.txt +16 -0
- wargline-0.1.0/tests/fixtures/proc_net_tcp_sample.txt +5 -0
- wargline-0.1.0/tests/fixtures/ss_tulpn_sample.txt +10 -0
- wargline-0.1.0/tests/fixtures/sshd_T_hardened.txt +12 -0
- wargline-0.1.0/tests/fixtures/sshd_T_insecure.txt +12 -0
- wargline-0.1.0/tests/fixtures/sshd_config_default.txt +10 -0
- wargline-0.1.0/tests/fixtures/sshd_config_late_include.txt +6 -0
- wargline-0.1.0/tests/fixtures/stat_sudoers_stock.txt +3 -0
- wargline-0.1.0/tests/fixtures/sudoers_risky.txt +10 -0
- wargline-0.1.0/tests/fixtures/sysctl_10_network_security.conf +5 -0
- wargline-0.1.0/tests/fixtures/ufw_app_info_openssh.txt +6 -0
- wargline-0.1.0/tests/fixtures/ufw_status_active.txt +11 -0
- wargline-0.1.0/tests/fixtures/ufw_status_inactive.txt +1 -0
- wargline-0.1.0/tests/fixtures/ufw_status_profiles_and_source.txt +15 -0
- wargline-0.1.0/tests/fixtures/visudo_ok.txt +1 -0
- wargline-0.1.0/tests/integration/Dockerfile +52 -0
- wargline-0.1.0/tests/integration/__init__.py +0 -0
- wargline-0.1.0/tests/integration/conftest.py +257 -0
- wargline-0.1.0/tests/integration/test_scenarios.py +420 -0
- wargline-0.1.0/tests/unit/test_approve.py +520 -0
- wargline-0.1.0/tests/unit/test_cli.py +1001 -0
- wargline-0.1.0/tests/unit/test_commands.py +499 -0
- wargline-0.1.0/tests/unit/test_context.py +276 -0
- wargline-0.1.0/tests/unit/test_docker_ufw_bypass.py +697 -0
- wargline-0.1.0/tests/unit/test_engine.py +300 -0
- wargline-0.1.0/tests/unit/test_export.py +590 -0
- wargline-0.1.0/tests/unit/test_exposed_services.py +566 -0
- wargline-0.1.0/tests/unit/test_formatters.py +283 -0
- wargline-0.1.0/tests/unit/test_i18n.py +110 -0
- wargline-0.1.0/tests/unit/test_mcp.py +1208 -0
- wargline-0.1.0/tests/unit/test_models.py +125 -0
- wargline-0.1.0/tests/unit/test_netinfo.py +535 -0
- wargline-0.1.0/tests/unit/test_packaging.py +360 -0
- wargline-0.1.0/tests/unit/test_redact.py +294 -0
- wargline-0.1.0/tests/unit/test_registry.py +176 -0
- wargline-0.1.0/tests/unit/test_safety.py +1413 -0
- wargline-0.1.0/tests/unit/test_ssh_hardening.py +1039 -0
- wargline-0.1.0/tests/unit/test_sudoers_audit.py +1177 -0
- wargline-0.1.0/tests/unit/test_sysctl_network.py +1312 -0
- wargline-0.1.0/tests/unit/test_tui.py +1226 -0
- wargline-0.1.0/tests/unit/test_unattended_upgrades.py +376 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Local specification, notes, and scratch artifacts
|
|
2
|
+
SPEC.md
|
|
3
|
+
*.local.md
|
|
4
|
+
notes/
|
|
5
|
+
scratch/
|
|
6
|
+
|
|
7
|
+
# Environment and secrets
|
|
8
|
+
.env
|
|
9
|
+
.env.*
|
|
10
|
+
*.pem
|
|
11
|
+
*.key
|
|
12
|
+
*.p12
|
|
13
|
+
*.kdbx
|
|
14
|
+
|
|
15
|
+
# Logs and local runtime state
|
|
16
|
+
*.log
|
|
17
|
+
logs/
|
|
18
|
+
|
|
19
|
+
# Editor and OS metadata
|
|
20
|
+
.vscode/
|
|
21
|
+
.idea/
|
|
22
|
+
*.swp
|
|
23
|
+
*.swo
|
|
24
|
+
*~
|
|
25
|
+
.DS_Store
|
|
26
|
+
Thumbs.db
|
|
27
|
+
|
|
28
|
+
# Python bytecode, virtualenvs, and build outputs
|
|
29
|
+
__pycache__/
|
|
30
|
+
*.py[cod]
|
|
31
|
+
*$py.class
|
|
32
|
+
.venv/
|
|
33
|
+
venv/
|
|
34
|
+
env/
|
|
35
|
+
build/
|
|
36
|
+
dist/
|
|
37
|
+
*.egg-info/
|
|
38
|
+
.eggs/
|
|
39
|
+
|
|
40
|
+
# Test, lint, typecheck, and coverage caches
|
|
41
|
+
.pytest_cache/
|
|
42
|
+
.mypy_cache/
|
|
43
|
+
.ruff_cache/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
htmlcov/
|
|
47
|
+
coverage.xml
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-12-02
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Core engine and safety:**
|
|
13
|
+
- Read-only `SystemContext` collector with `/proc` ancestor session resolution across `sudo` `env_reset`.
|
|
14
|
+
- Shared `core/netinfo.py` telemetry collectors for listening sockets (`ss` and `/proc/net` fallback), firewalls (`ufw`, `firewalld`, `nftables`), VPN interfaces, and Docker published ports.
|
|
15
|
+
- Atomic drop-in writer with path allowlist and symlink refusal, root-owned snapshots under `/var/lib/wargline/snapshots/`, global apply/confirm/rollback lock (`/run/wargline.lock`), and `systemd-run` dead-man rollback timer with new-session confirmation.
|
|
16
|
+
- Stable placeholder redaction (`core/redact.py`) across scan reports, previews, explanations, snapshots, and MCP results.
|
|
17
|
+
- Dynamic rule plugin discovery (`RuleRegistry`) and English locale catalog (`locales/en.yaml`).
|
|
18
|
+
- **Hardening rules:**
|
|
19
|
+
- `ssh.hardening`: OpenSSH effective config audit (`sshd -T` / `-C`), 24-hour failed auth telemetry, StrictModes key pre-flight guard, `00-wargline.conf` apply with dead-man timer and rollback.
|
|
20
|
+
- `firewall.docker_bypass`: Docker published port exposure detection across iptables and nftables backends with compose and firewall guidance (read-only).
|
|
21
|
+
- `services.exposed_ports`: wildcard listener audit against `data/high_risk_ports.yaml` and `/var/run/docker.sock` permission checks (read-only).
|
|
22
|
+
- `system.sudoers_audit`: `cvtsudoers` JSON and fallback audit for `NOPASSWD: ALL`, GTFOBins entries (`data/gtfobins_sudo.yaml`), risky `Defaults`, file permissions, and `docker` group members (read-only).
|
|
23
|
+
- `system.sysctl_network`: runtime kernel parameter audit, precedence checks, container guard, `99-wargline.conf` apply with runtime value rollback and dead-man timer.
|
|
24
|
+
- `system.unattended_upgrades`: `apt-config dump` audit and `20auto-upgrades` apply on Debian/Ubuntu, plus `dnf-automatic` read-only detection on RHEL/Fedora.
|
|
25
|
+
- **CLI and formatters:**
|
|
26
|
+
- `wargline` CLI with `scan`, `fix`, `confirm`, `rollback`, `export`, `approve`, `mcp`, `--version`, and hidden `--self-test` packaging verification.
|
|
27
|
+
- `text`, `json` (`schema_version: "1"`), and `sarif` (2.1.0) scan output formatters, `--redact`, `--lang`, and `--fail-on` exit codes.
|
|
28
|
+
- **Interactive TUI wizard (`[tui]`):**
|
|
29
|
+
- Five-screen Textual wizard for browsing findings, inspecting evidence, reviewing previews, typing exact `rule_id` confirmation with `preview_hash` verification, and viewing new-session confirm instructions.
|
|
30
|
+
- **Host-independent export:**
|
|
31
|
+
- Standalone Bash script (`--format bash`) and Ansible playbook (`--format ansible`) generators with target-side pre-flight checks, backup and `rollback.sh`, `systemd-run` timers, strict command-output validation, and commented manual guidance for read-only rules.
|
|
32
|
+
- **MCP server and human approval (`[mcp]`):**
|
|
33
|
+
- Stdio MCP server redacted by default with read-only tools (`scan_system`, `explain_rule`, `preview_fix`, `export_remediation`, `list_snapshots`) and `--allow-write` request tools (`request_apply`, `get_request_status`).
|
|
34
|
+
- Terminal-gated `wargline approve <request-id>` (and `--reject`) with TTY, environment, and process ancestry checks, JSONL audit logging (`/var/log/wargline/mcp.log`), and portable agent skill guide (`integrations/SKILL.md`).
|
|
35
|
+
- **Testing, CI, and packaging:**
|
|
36
|
+
- Unit test suite with mocked OS fixtures and Docker-based systemd integration tests (`tests/integration/`, with `WARGLINE_INTEGRATION_TARBALL` support for testing release binaries).
|
|
37
|
+
- Standalone Linux one-directory release binaries (`amd64` and `arm64`, glibc 2.28) with PyInstaller spec, build script, container smoke scripts (`packaging/`), `SHA256SUMS`, and build provenance attestations.
|
|
38
|
+
- GitHub Actions CI for Python 3.11 to 3.14 unit tests, integration tests, `gitleaks` scanning, Dependabot configuration, and release workflow (`.github/workflows/release.yml`) with TestPyPI/PyPI OIDC trusted publishing and `RELEASING.md`.
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- `system.sysctl_network`: format evidence for keys compliant at runtime but overridden at boot by `ufw` as `runtime <value>, set to <ufw_value> at boot by <file> (ufw)` instead of `<value> (recommended: <expected>); overridden at boot by ...`.
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- `system.sysctl_network`: a second sysctl fix no longer removes per-interface lines that an earlier fix wrote to `/etc/sysctl.d/99-wargline.conf` while the interface still exists and is not virtual, and warns in preview when dropping entries for missing or virtual interfaces.
|
|
47
|
+
- Frozen-build install-path check: when `sys.frozen` is set, validate both the unresolved and resolved executable, `sys._MEIPASS` (e.g. `<install dir>/_internal`), and every parent directory of both, refusing world-writable parents such as `/tmp` one-file extractions.
|
|
48
|
+
|
|
49
|
+
- `system.sysctl_network`: detect managed sysctl keys overridden to non-compliant values at boot by `ufw` (`/etc/ufw/ufw.conf`, `/etc/default/ufw`, default `/etc/ufw/sysctl.conf`), report them even when runtime values are currently compliant, and warn in preview to update or comment out those lines and run `ufw reload` without editing `ufw`'s file.
|
|
50
|
+
- Printed `wargline` commands: build confirm, rollback, approve, and wizard commands through one helper that omits `sudo` when run as root without `SUDO_USER`, checks sudo's `secure_path` from `cvtsudoers` JSON, and prints the absolute entry-point path when bare `wargline` would not resolve to the running executable.
|
|
51
|
+
- `system.sysctl_network`: evaluate effective per-interface kernel values (skipping `lo`) using kernel per-key semantics; write per-interface lines to `/etc/sysctl.d/99-wargline.conf` for non-virtual interfaces and apply runtime-only `sysctl -w` with rollback for virtual interfaces; detect non-virtual interfaces at runtime in bash and Ansible exports.
|
|
52
|
+
- MCP server and TUI wizard: refresh `SystemContext` and clear command/network caches before every MCP tool call and every wizard rescan so results always reflect live host state.
|
|
53
|
+
- `system.sudoers_audit`: ignore UID 0 user principals (`root`, `#0`, and other UID 0 users) in sudoers and `docker` group membership while recording them in an `ignored_uid0` note; group principals are never ignored.
|
|
54
|
+
- Rollback timer and `approve`: verify that the resolved interpreter, package directory (or frozen binary), and all parent directories up to `/` are root-owned and not group- or world-writable before arming or applying.
|
|
55
|
+
- `firewall.docker_bypass`: recognize `DOCKER-USER` DROP/REJECT rules using `-m conntrack --ctorigdstport <port>` (for IPv4 and IPv6 separately) and equivalent pre-Docker nftables forward chains as `mitigated` (`info`), and explain why partial rules such as post-DNAT `--dport` do not mitigate exposure.
|
|
56
|
+
- `wargline approve`: add `--timeout N` (default 60, minimum 30), pass it through to the engine, print it in confirmation instructions, and record it on the request state.
|
|
57
|
+
- Redaction: redact non-22 server ports in `SSH_CONNECTION` (`port-2`) while keeping port 22 and all other report ports unchanged.
|
|
58
|
+
- Audit log and request state: update approve-created requests to `confirmed` or `rolled_back` and append an audit log entry with the `request_id` when `confirm` or `rollback` (including timer-driven rollback) completes.
|
|
59
|
+
- `ssh.hardening`: include a preview warning about `IdentitiesOnly yes` and `IdentityFile` when lowering `MaxAuthTries`.
|
|
60
|
+
- Bash export: prefix the printed `systemctl stop` confirm command with `sudo` when `SUDO_USER` is set.
|
|
61
|
+
- CLI help, wizard result footer, integration Dockerfile and sysctl scenario, and agent documentation (`README.md`, `integrations/SKILL.md`, `CONTRIBUTING.md`).
|
|
62
|
+
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Contributing to wargline
|
|
2
|
+
|
|
3
|
+
## Development Setup
|
|
4
|
+
|
|
5
|
+
`wargline` requires Python 3.11 or newer.
|
|
6
|
+
|
|
7
|
+
With `uv`:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
uv sync --extra tui --extra mcp
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
With `pip`:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
python3 -m venv .venv
|
|
17
|
+
. .venv/bin/activate
|
|
18
|
+
pip install --upgrade pip
|
|
19
|
+
pip install -e '.[tui,mcp]' --group dev
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
For full export validation tests, install `shellcheck` (via your OS package manager) and `ansible-core` (`pip install ansible-core`). Those tests skip automatically when the tools are absent.
|
|
23
|
+
|
|
24
|
+
## Running Checks
|
|
25
|
+
|
|
26
|
+
Run the unit test suite:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
pytest -q
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Run lint, format, and static type checks:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
ruff check .
|
|
36
|
+
ruff format --check .
|
|
37
|
+
mypy src/wargline/core src/wargline/mcp
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Run Docker-based systemd integration tests (Linux host with Docker required; skipped by default):
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
WARGLINE_INTEGRATION=1 pytest -q tests/integration
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Commit Messages
|
|
47
|
+
|
|
48
|
+
Use Conventional Commits for small, scoped changes:
|
|
49
|
+
|
|
50
|
+
- `feat(ssh): verify active key auth before apply`
|
|
51
|
+
- `fix(exporter): validate sysctl pre-flight key names`
|
|
52
|
+
- `docs(readme): document scan exit codes`
|
|
53
|
+
- `test(mcp): verify default redaction on server creation`
|
|
54
|
+
|
|
55
|
+
## Privacy and Fixture Rules
|
|
56
|
+
|
|
57
|
+
Never include real hostnames, IP addresses, usernames, email addresses, domains, credentials, or local machine paths anywhere in code, tests, fixtures, or documentation.
|
|
58
|
+
|
|
59
|
+
Use only:
|
|
60
|
+
|
|
61
|
+
- RFC 5737 test IP addresses (`192.0.2.0/24`, `198.51.100.0/24`, `203.0.113.0/24`)
|
|
62
|
+
- RFC 2606 domains (`example.com`, `example.org`)
|
|
63
|
+
- Generic hostnames (`srv01`, `web-node`) and generic usernames (`ops`, `deploy`)
|
|
64
|
+
|
|
65
|
+
Keep code and documentation copy plain ASCII without decorative emojis or promotional phrasing.
|
|
66
|
+
|
|
67
|
+
## Adding a Rule
|
|
68
|
+
|
|
69
|
+
Every security rule lives in a single module under `src/wargline/rules/`.
|
|
70
|
+
|
|
71
|
+
1. **Implement `BaseRule` (`src/wargline/rules/base.py`):**
|
|
72
|
+
- Declare class attributes: `rule_id`, `layer` (`access`, `network`, `services`, or `system`), `severity` (`critical`, `high`, `medium`, `low`, or `info`), `mitre_attack`, `requires_deadman_switch`, and `blast_radius`.
|
|
73
|
+
- Implement the five required methods:
|
|
74
|
+
- `detect(ctx: SystemContext) -> Finding | None`: pure read-only check using `ctx.fs` and `ctx.runner`. Degrade with `permission_notes` when unprivileged instead of failing.
|
|
75
|
+
- `explain(finding: Finding, lang: str = "en") -> Explanation`: load localized strings via `wargline.i18n.t`.
|
|
76
|
+
- `preview(ctx, finding, *, safety=None, watchdog_timeout=None, allow_no_watchdog=False) -> DiffPreview`: build unified diffs and exact command argvs without mutating state.
|
|
77
|
+
- `apply(ctx, finding, safety, *, allow_no_watchdog=False) -> ApplyResult`: snapshot, arm watchdog (when `requires_deadman_switch` is true), write drop-in, validate, verify effective state, and reload.
|
|
78
|
+
- `rollback(snapshot_id: str, safety: SafetyManager) -> RollbackResult`: restore snapshot and reload affected service.
|
|
79
|
+
- Implement `export_plan(lang: str = "en") -> ExportPlan | None` so `wargline export` can emit host-independent automation or manual guidance.
|
|
80
|
+
2. **Registration:**
|
|
81
|
+
- `RuleRegistry.discover()` automatically loads concrete `BaseRule` subclasses from modules under `src/wargline/rules/`. No manual engine wiring is needed.
|
|
82
|
+
- If the rule writes a new drop-in path, explicitly add it to the write allowlist in `src/wargline/core/safety.py`.
|
|
83
|
+
3. **Locale keys:**
|
|
84
|
+
- Add all user-facing strings under `locales/en.yaml`.
|
|
85
|
+
- `tests/unit/test_i18n.py` verifies that every locale key referenced in `src/wargline/` exists in `locales/en.yaml` and that no unused keys remain.
|
|
86
|
+
4. **Tests:**
|
|
87
|
+
- Add unit tests under `tests/unit/` using `FakeCommandRunner`, `FakeFileSystem`, and `FakeSafetyManager` from `tests/conftest.py`. Unit tests must never touch real `/etc`, `/var`, or `/run`.
|
|
88
|
+
- If the rule affects exports, update golden fixtures under `tests/fixtures/export/` and verify `tests/unit/test_export.py`.
|
wargline-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify, defend,
|
|
172
|
+
and hold each Contributor harmless for any liability incurred by, or
|
|
173
|
+
claims asserted against, such Contributor by reason of your accepting
|
|
174
|
+
any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
wargline-0.1.0/NOTICE
ADDED