Skip to content

Automation: Direction #3

@github-actions

Description

@github-actions

Last generated: 2026-01-22T18:16:33.944Z
Provider: openai
Model: gpt-5.2

Summary

Tighten CI/CD around this Docker-based Tor proxy image: add reproducible builds, basic container smoke tests, vulnerability scanning, and release automation. Keep changes small and focused on reliability and reducing maintainer toil.

Direction (what and why)

This repo is essentially a Docker image definition (Dockerfile, torrc.conf, rules.json). The highest-leverage automation is:

  • Build determinism & security: pin base images, add provenance/labels, and scan.
  • Fast feedback: minimal smoke tests that assert Tor/Privoxy start and ports are reachable.
  • Low-friction releases: auto-tagging and optional container publishing when tags are pushed.

This reduces “it built yesterday but not today” problems and catches breakage from upstream Tor/Privoxy changes.

Plan (next 1–3 steps)

1) Add a container smoke test workflow

Create .github/workflows/smoke.yml that:

  • Builds the Docker image from the repo.
  • Runs the container and verifies:
    • Tor and proxy processes are running.
    • Expected ports are listening (e.g., 9050/8118 if applicable).
    • A simple curl through the proxy works (best-effort; at least ensure the proxy responds).

Concrete implementation:

  • Add scripts/smoke.sh (new) to run locally and in CI:
    • docker build -t tor-proxy:test .
    • docker run -d --name tor-proxy -p 8118:8118 -p 9050:9050 tor-proxy:test
    • Wait loop with timeout for ports to open (nc -z localhost 8118 etc.)
    • docker logs tor-proxy on failure for diagnostics
    • Optional: curl -x http://localhost:8118 https://check.torproject.org/api/ip (allow flaky network by marking as non-fatal; primary test is liveness)

Why this first: it’s the quickest reliability win and prevents broken images from merging.

2) Make builds more reproducible + add metadata

Update Dockerfile to:

  • Pin the base image by digest (not just a moving tag). Example pattern:
    • FROM debian:bookworm-slim@sha256:<digest>
  • Add OCI labels:
    • org.opencontainers.image.source, revision, created
  • Ensure processes run with clear foreground behavior so container health is stable (if not already). If you use supervisord/s6/etc., ensure logs go to stderr (you already fixed logging once).

Also add a lightweight .dockerignore to speed builds and avoid leaking local artifacts:

  • Exclude .git/, .github/, bfg-1.15.0.jar, .bish* unless required.

Files:

  • Dockerfile (edit)
  • .dockerignore (new)

3) Add security scanning + optional release publishing

Add two workflows:

A. PR/merge scanning

  • .github/workflows/security.yml
    • Run aquasecurity/trivy-action on the built image and/or filesystem.
    • Configure to fail only on HIGH/CRITICAL initially to avoid noise.

B. Tag-based release/publish (optional if you publish images)

  • .github/workflows/release.yml
    • On push tags like v*:
      • Build and push image to GHCR (ghcr.io/teamhg-memex/tor-proxy)
      • Use docker/metadata-action to set tags (latest, semver)
      • Generate SBOM (anchore/sbom-action or syft) and attach to release artifacts

If you don’t want to publish images, still keep a release workflow that builds and attaches the image digest and SBOM as artifacts for traceability.

Risks/unknowns

  • What ports/services are actually exposed: repo mentions Tor proxy; may include Privoxy. The smoke test must reflect real listening ports in torrc.conf and the Dockerfile entrypoint.
  • Network-dependent tests can be flaky: any “curl through Tor to external site” should be best-effort. Keep core tests local (process/port checks).
  • Base image pinning requires maintenance: you’ll need periodic digest bumps. Offset this with Dependabot (for GitHub Actions) and a monthly scheduled PR for base digest updates if desired.
  • Large repo artifact: bfg-1.15.0.jar is ~14MB and likely unrelated to runtime; it slows CI and image context unless excluded. Verify it’s truly unnecessary before removing.

Suggested tests

  1. CI smoke test (must-pass)
    • Build image
    • Start container
    • Assert ports are listening within N seconds
    • Assert container stays running for at least ~15–30 seconds
  2. Config validation (cheap)
    • If Tor binary is present in image: run tor --verify-config -f /path/to/torrc.conf as part of the build or test step.
  3. Security
    • Trivy scan for HIGH/CRITICAL vulnerabilities
  4. Manual verification checklist
    • docker build .
    • docker run ...
    • curl -x http://localhost:<proxyport> https://example.com (or equivalent)
    • Confirm logs go to stderr and no crash loops

If you share the current Dockerfile contents and expected exposed ports, I can provide exact scripts/smoke.sh commands and the full YAML workflows tailored to the repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    automationAutomation-generated direction and planning

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions