Skip to content
rj-karanPublic

About

Secure CI/CD for GitHub repos: analyze, recommend scanners with reasons, compile hardened Actions pipelines, and repair failures without ever weakening security. Go + Next.js.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

AegisFlow

Secure CI/CD for GitHub repositories, generated, validated and kept safe by policy.

Connect a repo. AegisFlow reads the code, recommends the right scanners with reasons, compiles a hardened GitHub Actions pipeline, and opens a pull request. When CI breaks later, it diagnoses the failure and proposes a repair that cannot weaken security, because every change passes a deterministic policy gate before a human merges it.

CI License: Apache-2.0 Go Next.js Project board


Why

Most small teams either have no CI security at all, or have workflows that quietly drift into an unsafe state: unpinned third-party Actions, write-all tokens, unsafe pull_request_target triggers, jobs running in the wrong folder of a monorepo.

AI "fix my CI" bots can make it worse. Told only to "make CI green", an AI will happily delete the failing scanner or add continue-on-error: true.

In March 2026 the popular aquasecurity/trivy-action was compromised and exfiltrated runner secrets. One organisation spent 48 hours SHA-pinning Actions across 68 repos. AegisFlow exists to make that kind of hardening the default, and to keep it that way.

What it does

 connect ─▶ analyze ─▶ recommend ─▶ plan ─▶ compile ─▶ gate ─▶ validate ─▶ PR ─▶ monitor ─▶ repair ─┐
                                      ▲                                                             │
                                      └─────────────── a repair edits the plan, never the YAML ◀────┘
Stage What happens
Analyze Parsers read package.json, pyproject.toml, go.mod, Dockerfiles, Terraform and existing workflows. Every detected fact points at the file that proves it. The repo's code is never executed here.
Recommend A rule-based ranker over a tool catalog (license, stacks, runtime cost, credentials) picks tests, lint, SAST, dependency, secret and container scanners. AI only writes the plain-English why.
Plan and compile Recommendations become a provider-neutral pipeline plan. A deterministic compiler turns it into GitHub Actions YAML: read-only permissions, every uses: pinned to a full commit SHA, each job in the right folder.
Gate The gate-weakening detector diffs old plan vs new plan and blocks anything that makes CI less safe: stage removed, continue-on-error, tests narrowed, permissions widened, Action unpinned, unsafe trigger, threshold lowered, secret exposed.
Validate Lint (actionlint, zizmor) and a sandboxed run with no secrets and restricted network. Jobs that need real credentials are marked not validated, never "passing".
Install Everything arrives as a pull request. AegisFlow never pushes to the default branch and never merges its own PRs.
Monitor and repair workflow_run webhooks feed a classifier (missing_dependency, runtime_version, deprecated_action, secret_missing, ...). A fix is proposed against the plan, re-gated, re-validated, and opened as a small repair PR with logs and rollback notes. Real test_failures go back to the developer.

Architecture

┌──────────────────────── control plane ────────────────────────┐
│  Next.js dashboard  ──▶  Go API (chi)  ──▶  PostgreSQL         │
│                               │                                │
│                               ▼                                │
│                        Redis + asynq queue                     │
└───────────────────────────────┬────────────────────────────────┘
                                │ jobs
┌───────────────────────────────▼─── worker plane (Docker) ─────┐
│   analyzer     ·     validator (sandbox)     ·     repair      │
│   Go binaries; untrusted repo code is only ever touched here   │
└────────────────────────────────────────────────────────────────┘
Layer Choice
Dashboard Next.js, TypeScript, Tailwind
API Go, chi router, sqlc typed queries, goose migrations
Database PostgreSQL, workspace-scoped on every table
Queue Redis + asynq (retries, dead-letter, scheduling)
Workers Go binaries in disposable, resource-limited containers
Policy OPA embedded as a Go library, actionlint, zizmor
LLM Pluggable (Claude, OpenAI, local). Bring your own key. Works without AI.
Local dev Docker Compose, one command
Operations Terraform, Helm, Argo CD, Prometheus, Loki, Grafana, GoReleaser + cosign

Status

Early development, built in the open. Follow the project board.

Milestone State
M1 Foundation In progress: Go API skeleton and hardened CI merged; database, queue, dashboard and GitHub App next
M2 to M6 Planned, issues written
M7 Operate Planned, runs alongside M1 to M6

Quickstart

What runs today is the API with health and readiness endpoints:

git clone https://github.com/rj-karan/AegisFlow.git
cd AegisFlow
make test            # go test -race with coverage
make lint            # golangci-lint, installs into ./bin on first run
make run             # API on :8080
curl localhost:8080/healthz

Once #3 lands, the whole system starts with one command:

cp .env.example .env
docker compose up --build

Dashboard on http://localhost:3000, API on http://localhost:8080.

See docs/development.md for running each service on its own. Why Go instead of the Python in the original design: ADR-0001.

Roadmap

Built in vertical slices. Each milestone ships backend, UI, tests and docs together and is done only when its exit test passes on real repositories.

Milestone Scope Exit test
M1 Foundation Monorepo, auth, workspaces, GitHub App read access Lists a test org's repos
M2 Analyzer Detectors for Python, JS/TS, Go, Java; profiles with evidence 8 fixture repos detected correctly
M3 Recommend + plan Tool catalog, ranking, plan IR, Actions compiler Generated YAML passes actionlint
M4 Gate + validate OPA rules, gate-weakening detector, sandbox runner Every bad fixture blocked
M5 PR + monitor Branch, commit, open PR; webhooks and run history A real PR merged
M6 Repair + eval Failure classifier, repair PRs, 30-repo benchmark Evaluation vs template-only and LLM-only
M7 Operate Terraform, Kubernetes (kind, then k3s on a free arm64 VM), Helm, Argo CD GitOps, Prometheus, Loki, Grafana, signed releases A merge to main goes live on the cluster with no manual kubectl, verified by gh attestation verify

Progress is tracked on the project board and in issues. Everything runs for free on a student budget: see docs/operations/free-tier-plan.md. Learning DevOps along the way? Follow docs/learning-path.md.

Security model

AegisFlow holds write access to other people's repositories, so it is itself a target. All repo content, logs and AI output are treated as untrusted data, never as instructions. Secrets never enter prompts. Webhooks are HMAC-verified and deduplicated. Every API call and every query is workspace-scoped. High-risk actions require explicit human approval and land in an append-only audit log. Full threat model: docs/design.md.

Found a vulnerability? See SECURITY.md.

How this repo is run

Every change starts as an issue, lands as a squash-merged pull request, and moves across the board. main is protected: no direct pushes, linear history, CI required. The CI workflow follows the same rules AegisFlow enforces on generated pipelines: no default permissions, every Action pinned to a commit SHA, timeouts everywhere, audited by actionlint and zizmor.

Contributing

Issues and pull requests are welcome. Read CONTRIBUTING.md for the branch, commit and review conventions, and pick an issue labelled good first issue.

License

Apache-2.0

About

Secure CI/CD for GitHub repos: analyze, recommend scanners with reasons, compile hardened Actions pipelines, and repair failures without ever weakening security. Go + Next.js.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages