Skip to content

CI and branch protection

What the GitHub workflows check, and the branch protection the maintainer should turn on for main. This repository does not change those settings itself.

The git history uses SHA-256 object IDs. actions/checkout creates a SHA-1 repository and cannot fetch it, so every job checks out with plain git instead.

Third-party actions are pinned to a full commit SHA. A comment on the same line names the version that commit was. Dependabot's github-actions updates keep those pins current.

Checks

Workflow When What it does Fails the run when
EVE Nexus CI / SPDX headers pull request and push to main scripts/check_spdx.py a first-party source file has no AGPL header
EVE Nexus CI / Frontend pull request and push to main. A docs-only diff exits 0 without building npm ci, npm audit --audit-level=high, npm run build a high or critical npm advisory, or a type or build error
EVE Nexus CI / cargo-deny pull request and push to main. A diff that does not touch Rust or Cargo.lock exits 0 cargo deny check (deny.toml): vulnerabilities, licenses, bans, sources. The 0.22.2 musl binary is checksum-pinned into CARGO_HOME/bin a vulnerability, a disallowed license, or a crate that is not from crates.io
EVE Nexus CI / Backend pull request and push to main. A docs-only diff exits 0 Rust 1.100.1 (must be 1.94 or newer), cargo fmt, Clippy -D warnings, cargo test against Postgres 17. Self-hosted uses the compose service postgres on the ci network. GitHub-hosted starts Postgres with Docker format, lint, or test failure
CodeQL push to main, nightly, and pull requests that touch dependencies or Dockerfiles. Other pull requests exit 0 Rust and JavaScript/TypeScript, build-mode: none the analysis itself fails
Gitleaks pull request and push to main open-source gitleaks CLI, checksum-pinned, scans the checked-out tree a secret finding
Trivy push to main, nightly, and pull requests that touch dependencies or Dockerfiles. Other pull requests exit 0 trivy fs on the repository. No image build a CRITICAL or HIGH vulnerability that has a fix
API scan pull request, push to main, weekly, and by hand. A diff without Rust, migration or web changes exits 0 Starts Nexus with an empty database inside the job, checks that every /api/v1 route refuses a request without a session, then fuzzes the API as a superadmin with Schemathesis a route answers without a session, any 5xx, or the scan session stops working
OpenSSF Scorecard pull request, push to main, and weekly, only while the repository is public Scorecard. Results are published only when the repository is public. SCORECARD_TOKEN, when set, is the repo_token the Scorecard action itself fails
Release tag v* only multi-arch image (linux/amd64, linux/arm64) to ghcr.io/<owner>/eve-nexus, keyless cosign signature, Buildx SBOM and provenance, GitHub release draft the build, push, sign, or draft fails

A push to main does not run the release workflow.

cargo-deny

The job installs cargo-deny 0.22.2 (musl, checksum-pinned) into /opt/cargo/bin on the self-hosted runner, or CARGO_HOME/bin on GitHub-hosted. It does not use the Docker action. cargo deny runs cargo metadata, so it needs Rust: the image toolchain on the self-hosted runner, and a 1.100.1 install on GitHub-hosted. The entrypoint writes the runner .env so later jobs see /opt/cargo/bin. That file is picked up on the next image rebuild.

deny.toml denies vulnerability advisories. cargo-deny 0.22 has no warn level for unmaintained advisories (a matched scope is an error). The scope is all. chrono 0.4 is ignored as RUSTSEC-2026-0543 because it has no patched release and replacing it is a separate dependency change. The ignore still prints a note on each run.

RUSTSEC-2023-0071 (rsa) is not ignored. An earlier change removed rsa 0.9.10. The remaining rsa 0.10.0, from jsonwebtoken, is not flagged.

Duplicate crate versions are warnings (bans.multiple-versions = "warn"), so they show up and do not fail the job. Licenses are an allowlist of terms compatible with AGPL-3.0-only that this tree actually uses. Sources are crates.io only.

npm audit

npm audit --audit-level=high runs in the frontend job, after npm ci. Moderate findings do not fail it.

CodeQL, Trivy SARIF, Scorecard

SARIF upload is best-effort (continue-on-error). Trivy still fails the job on a fixable CRITICAL or HIGH finding even when the upload is skipped. After code scanning is enabled, the same upload steps start filing results without a workflow change.

Scorecard calls GitHub's GraphQL API. The default GITHUB_TOKEN cannot do that on a private repository (ListCommits: githubv4.Query: Resource not accessible by integration), so the job is skipped while this repository is private (if: github.event.repository.private == false). It turns on by itself when the repository is made public. Results are published only then. A read-only fine-grained PAT stored as SCORECARD_TOKEN is passed as repo_token when it is set. A job condition cannot read secrets, so that token does not start the job on a private repository; remove the condition to run it there, and leave publish_results tied to the repository being public. Do not require the Scorecard check while the repository is private: a skipped job is not a passing required check.

API scan

.github/workflows/api-scan.yml and scripts/api_scan.py. Nothing outside the job is scanned: the job builds the API, starts it on 127.0.0.1:8080 against the CI Postgres (emptied first), and stops it at the end.

  • Description of the API. Nexus has no hand-written OpenAPI file. api_scan.py spec reads the .route(...) calls and how main.rs nests the routers, so the list of paths and methods comes from the code on every run. Bodies and query strings are not described; write endpoints get random JSON objects.
  • Sign-in sweep. api_scan.py sweep calls every /api/v1 route without a session. Each must answer 4xx. A 2xx or 3xx, a 5xx, or no answer fails the job. The few public routes are listed in PUBLIC in the script.
  • Fuzzing. A superadmin account and session are inserted into the throwaway database (the app has no test-only sign-in). Schemathesis then runs the coverage and fuzzing phases, 20 examples per operation, one worker, at most 20 minutes, without following redirects. The only check is not_a_server_error. Afterwards the session must still work, so a run that signed itself out halfway fails instead of passing on 401s.
  • Left out of the fuzzing (EXCLUDED in the script): routes that reach EVE SSO or ESI, Discord, Cloudflare or an outside URL, the emergency routes (the maintenance gate would stop the scan), erasing the account and OIDC sign-out. The sweep still checks them without a session, which stops at the sign-in check.
  • Pinning. uv is checksum-pinned. Schemathesis and its dependencies are pinned by hash in scripts/api-scan-requirements.txt; the regenerate command is at the top of that file.
  • On the self-hosted runner it needs no Docker: Python 3 and psql from the image, and the compose Postgres. On GitHub-hosted runners Postgres is a container, as in the backend job.
  • The start-up still downloads CCP's public SDE, as any install does. No ESI token exists in the throwaway database, so nothing calls ESI on a pilot's behalf.

Gitleaks

gitleaks-action v3 is distributed under a separate commercial license, so CI runs the open-source CLI. The checkout is one commit deep, and the scan reads that tree.

Release image

The tag is the image tag (ghcr.io/<owner>/eve-nexus:v1.2.3). The owner is lowercased. cosign signs the digest with GitHub's OIDC token (no stored key). Buildx attaches the SBOM and the provenance attestation. The GitHub release is a draft.

Rust

CI installs Rust 1.100.1, the same toolchain as docker/ci-runner, and refuses a compiler older than 1.94, the MSRV of SQLx 0.9. The image build uses the rust tag already in the Dockerfile, which is newer than 1.94.

Branch protection for main

Turn these on in the repository settings. This change does not set them.

  1. Require a pull request before merging. Do not allow direct pushes to main.
  2. Require status checks to pass before merging. After the first run, select:
  3. SPDX headers
  4. Frontend (React + TypeScript)
  5. cargo-deny
  6. Backend (Rust + Postgres 17)
  7. Analyze (rust)
  8. Analyze (javascript-typescript)
  9. gitleaks
  10. trivy

Leave OpenSSF Scorecard off this list while the repository is private. The job does not run, so GitHub would wait on a check that never reports. Add it after the repository is public and the job is running. 3. Require CodeQL. Enable code scanning for the repository (GitHub Advanced Security on a private repository), then require the two Analyze checks above. Until code scanning is on, those jobs still run the analysis, and the SARIF upload is skipped. 4. Do not allow force pushes. 5. Do not allow the branch to be deleted.

Optional, and worth turning on with the rest: require the branch to be up to date before merging, and do not allow administrators to bypass the rules.

CodeQL and Trivy still report a check on every pull request. When the diff has no dependency or Dockerfile change, that check succeeds without scanning, so a required check does not sit pending.

Self-hosted runner

This is for private forks whose GitHub-hosted minutes run out. The runner in docker/ci-runner/ is for the always-on Ubuntu server. That machine already runs other containers. This stack does not join those networks and does not mount a Docker socket. While the server or this stack is down, jobs wait.

Never attach this runner to a public repository. A self-hosted runner on a public repository will execute other people's pull requests on the server. The workflow guard is not a substitute for deleting the runner.

Disk

Put the checkout and the cache directory on a filesystem with room to spare. Plan for about 15–25 GB: the Rust toolchain, the Cargo registry, the npm cache, and one job's build directory. The work directory is deleted after each job; the registry is what grows.

Docker Desktop for Linux only file-shares $HOME by default. CI_DATA_DIR=/srv/ci-runner fails with mounts denied: path is not shared. Use a directory under the home directory, for example ~/ci-runner-data, or add the path in Docker Desktop → Settings → Resources → File sharing. docker-ce has no such limit, so /srv/ci-runner is fine on that engine.

CI_DATA_DIR is that path. The default ./data sits next to the compose file, which works when the checkout itself is under $HOME. Prefer an absolute path so df -h shows it clearly. In Compose, write the home path expanded (/home/you/ci-runner-data); a bare ~ is not expanded inside .env.

df -h ~/ci-runner-data
du -sh ~/ci-runner-data/*

docker/ci-runner/cleanup.sh deletes job leftovers older than a day, the npm cache, and Cargo git checkouts. It does not delete the Cargo registry or the toolchain, and it does not talk to Docker. Cron:

15 5 * * * CI_DATA_DIR=/home/you/ci-runner-data /home/you/ci-runner/Eve-Nexus/docker/ci-runner/cleanup.sh

The script exits 1 above 25 GB. Cap the build cache on the engine that built this stack, not the PaaS engine. Check docker context show first:

docker builder prune --keep-storage 8gb

What runs in Compose

The project name is nexus-ci. The network name is nexus-ci. Nothing is published on the host. There is no named volume.

Service Role
runner Ephemeral runner, uid 1001. One job, then it exits and Compose starts it again. The work directory is wiped first. Read-only root, cap_drop: ALL, no-new-privileges. Hard cap 6 GB and 4 CPUs (RUNNER_MEMORY, RUNNER_CPUS). CPU share 256, against the default 1024, so production wins when the host is busy. $HOME is a 1 GB tmpfs, so large caches are bind mounts: Cargo and the cargo-deny advisory DB (/opt/cargo), rustup (/opt/rustup), npm (/opt/npm), Trivy DB (/opt/trivy, about 1 GB), and the CodeQL bundle (/opt/toolcache). Gitleaks is only its CLI and stays under $HOME.
postgres Postgres 17 for cargo test, uid 70, 1 GB, 1 CPU, CPU share 128. Not published. The backend job reaches it as host postgres on the ci network. GitHub-hosted jobs do not use this container; they start Postgres with Docker.

Trivy uses the CLI (trivy fs). It does not build images. That misses packages that exist only inside a built image. The release workflow still builds images on GitHub-hosted runners.

Labels: self-hosted, linux, x64, nexus. Registration is the repository https://github.com/your-org/Eve-Nexus, not an organisation runner. Each start registers a new name, nexus-ci plus a short random suffix (RUNNER_NAME overrides the prefix). Reusing one name while the previous ephemeral runner is still connected sticks on a connect conflict. GitHub removes stale ephemeral entries on its own. You can also delete them under Settings → Actions → Runners.

Turn it on

  1. df -h the filesystem. Leave room for 15–25 GB plus the rest of the server.

  2. Create the directories. 1001 is the runner. 70 is Postgres in the Alpine image.

sudo install -d -o 1001 -g 1001 -m 0750 \
  ~/ci-runner-data/cargo ~/ci-runner-data/rustup ~/ci-runner-data/npm \
  ~/ci-runner-data/trivy ~/ci-runner-data/toolcache ~/ci-runner-data/work
sudo install -d -o 70 -g 70 -m 0700 ~/ci-runner-data/postgres

On docker-ce, /srv/ci-runner can replace ~/ci-runner-data. On Docker Desktop, that path has to be added under Settings → Resources → File sharing first, or the mount is denied.

  1. Create a registration token: GitHub → the repository → Settings → Actions → Runners → New self-hosted runner. It expires in about an hour.

For a server that stays on, create a fine-grained personal access token instead, this repository only, Administration: Read and write. The entrypoint uses it only to mint a registration token each start.

  1. From the checkout:
cd ~/ci-runner/Eve-Nexus/docker/ci-runner
cp .env.example .env

Set GITHUB_REPOSITORY to your-org/Eve-Nexus, set RUNNER_PAT (or RUNNER_TOKEN for a short test), and set CI_DATA_DIR to the expanded home path, for example /home/you/ci-runner-data. Do not commit .env.

  1. Start it:
docker compose up -d --build
docker compose ps
docker compose logs runner --tail 40

The log must not print the token. It prints registering nexus-ci- and eight hex digits. GitHub → Settings → Actions → Runners should show that name idle with those four labels. A previous name left behind after a restart is a stale ephemeral entry: GitHub cleans those up, and you can remove one there.

  1. Repository → Settings → Secrets and variables → Actions → Variables. Name CI_RUNS_ON. Value, including the brackets:
["self-hosted","linux","x64","nexus"]

Workflows use runs-on: ${{ fromJSON(vars.CI_RUNS_ON || '"ubuntu-latest"') }}. Delete the variable, or set it to "ubuntu-latest" with the quotes, to go back to GitHub-hosted runners.

  1. Open a pull request that changes crates/ or web/. A docs-only pull request still reports the required checks as success.

Forks and Dependabot

Jobs on the self-hosted labels run only for push, schedule, workflow_dispatch, or a pull request whose head repository is this repository. Dependabot opens pull requests from this repository, so they run. A fork does not, and its required checks will not go green. Deleting CI_RUNS_ON allows fork pull requests on ubuntu-latest again.

Before the repository is public

  1. GitHub → Settings → Actions → Runners → remove the nexus-ci-… entries. GitHub also drops stale ephemeral runners on its own.
  2. docker compose down in docker/ci-runner. Delete ~/ci-runner-data if you do not want the caches.
  3. Delete CI_RUNS_ON.
  4. Revoke RUNNER_PAT.
  5. Then make the repository public. Scorecard starts on GitHub-hosted runners.

Windows, if you have to

The same compose file runs on Docker Desktop with WSL2. C: is the wrong disk. Docker Desktop keeps its WSL2 disk under %LOCALAPPDATA%\Docker. Move it in Settings → Resources → Advanced → Disk image location, for example F:\docker\wsl, before the first docker compose up. Dump the Nexus database first, from the checkout that has docker-compose.yml:

New-Item -ItemType Directory -Force F:\docker\backups
docker compose exec -T postgres pg_dump -U nexus_owner -d nexus -Fc > F:\docker\backups\nexus.dump

Stop the stack, then move the disk. docker system df shows usage. docker builder prune drops unused build cache and does not delete the Postgres volume. Docker Desktop on Windows only file-shares %USERPROFILE% by default, same as on Linux. Set CI_DATA_DIR to a folder under that profile, for example %USERPROFILE%\ci-runner-data, or add F:\docker under Settings → Resources → File sharing and then use F:/docker/nexus-ci. Create the cache directories inside WSL.