Skip to content

fix(audit): remediate F-grade audit findings — metrics, security, tests, CI#207

Merged
mvillmow merged 4 commits into
mainfrom
35-auto-impl
May 10, 2026
Merged

fix(audit): remediate F-grade audit findings — metrics, security, tests, CI#207
mvillmow merged 4 commits into
mainfrom
35-auto-impl

Conversation

@mvillmow
Copy link
Copy Markdown
Contributor

@mvillmow mvillmow commented May 4, 2026

Summary

Closes #35. Remediates all high-priority findings from the repo-analyze-strict audit that gave ProjectArgus an F (52%).

Test plan

  • python3 -m pytest tests/ -v — 26 passed, 0 failed
  • All metric names in nats-events.json verified against exporter output (nats_* namespace, no gnatsd_varz_*)
  • docker compose config --quiet passes (no env-var substitution errors)
  • # TYPE duplicate test passes — each metric declared exactly once per collect() call
  • No backup/temp files committed

🤖 Generated with Claude Code

@mvillmow mvillmow enabled auto-merge (squash) May 5, 2026 00:53
@mvillmow mvillmow force-pushed the 35-auto-impl branch 6 times, most recently from fc4cf78 to 0174f70 Compare May 10, 2026 02:53
mvillmow and others added 4 commits May 9, 2026 20:50
…ts, CI

Closes #35

- exporter/exporter.py: fix mutable default arg (labels={} → labels=None)
- exporter/exporter.py: emit each metric's # TYPE line exactly once;
  add # HELP lines for all metrics
- dashboards/nats-events.json: replace all gnatsd_varz_* with actual
  exporter metric names (nats_in_msgs_total, nats_out_msgs_total,
  nats_in_bytes_total, nats_out_bytes_total, nats_jetstream_bytes,
  nats_connections); rename "Active Subscriptions" → "Active Connections"

- docker-compose.yml: externalize GF_SECURITY_ADMIN_PASSWORD, AGAMEMNON_URL,
  NESTOR_URL, NATS_URL via env-var substitution
- docker-compose.yml: add health checks (wget) to all five services
- docker-compose.yml: add resource limits (memory + cpus) to all services
- docker-compose.yml: remove host-level port exposure for loki, promtail,
  argus-exporter (internal services use argus bridge network)
- docker-compose.yml: add GF_ANALYTICS_REPORTING_ENABLED=false to Grafana
- .env.example: update default password from admin to changeme; document all vars
- justfile: fix GRAFANA_PORT 3000 → 3001; GRAFANA_AUTH reads GRAFANA_ADMIN_PASSWORD

- tests/__init__.py, tests/test_exporter.py: 26 unit tests covering
  _fetch(), _health_check(), collect() output correctness, no-duplicate
  # TYPE invariant, # HELP presence, and HTTP handler responses
- pixi.toml: add test/lint/security feature environments and tasks

- .github/workflows/ci.yml: add test, lint, security jobs; expand branch
  trigger to feature/**, fix/**, chore/** branches
- .pre-commit-config.yaml: yamllint, ruff, bandit hooks
- .editorconfig: UTF-8 LF, 4-space Python, 2-space YAML/JSON
- .gitignore: add __pycache__/, *.pyc, .pytest_cache/, .ruff_cache/
- CHANGELOG.md: initial changelog in Keep a Changelog format

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…; regenerate pixi.lock

The PR inserted new jobs between atlas-dashboard's name: line and its
runs-on:/steps: block, leaving atlas-dashboard as an invalid empty job.
The Go build/test steps were also accidentally placed in the lint: job.

Fixes:
- Restore runs-on: and all Go steps to atlas-dashboard job
- Remove duplicate Go steps from lint: job (Python/ruff only)
- Regenerate pixi.lock with pixi v0.67.2 for new test/lint/security envs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The PR appended a duplicate [Unreleased] section to CHANGELOG.md which caused
MD024 (duplicate heading), MD022 (missing blank lines around headings), and
MD013 (line too long) markdownlint errors. Remove the duplicate section.

Also regenerate pixi.lock to pass pixi-check --locked validation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- .gitignore: add secrets/ entry
- .gitleaks.toml: add htpasswd rule and example allowlist; fix path pattern
- docker-compose.yml: bind all host ports to 127.0.0.1; add prometheus host port
- exporter/Dockerfile: use groupadd/useradd -u 1000; USER after COPY
- exporter/exporter.py: fix gauge metric names (remove _total, add _seconds suffix)
- justfile: rename GRAFANA_ADMIN_PASSWORD→GF_ADMIN_PASSWORD, remove GRAFANA_AUTH
- pixi.toml: consolidate to single lint env with pip-audit; remove unused tasks
- pixi.lock: regenerate to match updated pixi.toml
- scripts/import-dashboards.sh: use GF_ADMIN_PASSWORD
- tests/test_alertmanager_config.py: fix :latest check to accept pinned versions
- tests/test_configs.py: fix loki-internal network name, port tests, add ALLOWED_BINDINGS
- tests/test_exporter.py: update scrape_timestamp metric name to _seconds suffix

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mvillmow mvillmow merged commit 23fb357 into main May 10, 2026
15 of 20 checks passed
@mvillmow mvillmow deleted the 35-auto-impl branch May 10, 2026 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Audit] ProjectArgus -- Overall Grade: F (52%)

1 participant