bugxhunter 0.0.0-stage → 0.4.0

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.
package/.env.example ADDED
@@ -0,0 +1,41 @@
1
+ # BugXHunter — copy to .env (docker/setup.ps1 generates these for you).
2
+ # NEVER commit the real .env.
3
+
4
+ # SCX.ai API key (the model provider). Prefer the key vault: set it up in the
5
+ # sidebar after the first start and the key is sealed at rest (passkey +
6
+ # passphrase) instead of sitting here in the clear. If a vault exists, this
7
+ # line is ignored.
8
+ # SCX_API=sk-scx-...
9
+
10
+ # Optional: OpenRouter (https://openrouter.ai/models) as a second provider.
11
+ # Put the key in the vault as OPENROUTER_API_KEY (keys dialog) rather than here.
12
+ # OPENROUTER_API_KEY=sk-or-...
13
+ # Comma list of OpenRouter model ids the AGENT may use (they appear in the
14
+ # Runner's model picker). The Playground sees the whole catalogue regardless.
15
+ # OPENROUTER_MODELS=anthropic/claude-sonnet-4.5,openai/gpt-5
16
+
17
+ # GitHub needs nothing here: "Connect GitHub" in the sidebar signs in to the
18
+ # public BugXHunter GitHub App (read-only). A fork that registers its own app
19
+ # sets its Client ID and slug:
20
+ # GITHUB_CLIENT_ID=
21
+ # GITHUB_APP_SLUG=
22
+
23
+ # There is no password. Sign-in uses the vault's passkey (set up in the UI);
24
+ # until a vault exists the app is open on localhost.
25
+
26
+ # The vault re-locks after this many minutes without a model call or a write
27
+ # to the API (default 120; 0 = never).
28
+ # OPEN_RUNNER_VAULT_IDLE_MINUTES=120
29
+
30
+ # Secret that signs session cookies. Random per setup; set it to keep sign-ins across restarts.
31
+ OPEN_RUNNER_SECRET=
32
+
33
+ # Shared token the sandboxed agent uses to reach runner's SCX key proxy.
34
+ SCX_PROXY_TOKEN=
35
+
36
+ # Optional: host port for the UI (default 8790).
37
+ # OPEN_RUNNER_PORT=8790
38
+
39
+ # Optional: which published images `docker compose pull` fetches — a signed
40
+ # release tag like v1.2.3 (see SECURITY.md), or latest (default).
41
+ # BXH_VERSION=latest
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cintelis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,346 @@
1
- # Temporary Holding Version
1
+ # BugXHunter
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![CI](https://github.com/cintelis/bugxhunter-runner/actions/workflows/ci.yml/badge.svg)](https://github.com/cintelis/bugxhunter-runner/actions/workflows/ci.yml)
4
+ [![CodeQL](https://github.com/cintelis/bugxhunter-runner/actions/workflows/codeql.yml/badge.svg)](https://github.com/cintelis/bugxhunter-runner/actions/workflows/codeql.yml)
5
+ [![Built with Claude Code](https://img.shields.io/badge/built_with-Claude_Code-0a0e14?logo=anthropic&logoColor=00e5ff)](https://claude.com/claude-code)
6
+ [![Reviewed by Claude Mythos 5.1](https://img.shields.io/badge/reviewed_by-Claude_Mythos_5.1-0a0e14?logo=anthropic&logoColor=faf9f5)](https://www.anthropic.com/claude/mythos)
7
+
8
+ The [BugXHunter](https://bugxhunter.com) security-testing agent runner: a web UI for the
9
+ [OpenCode](https://opencode.ai) coding agent, running on open-weight models (GLM-5.3 by default)
10
+ through [SCX.ai](https://platform.scx.ai). The UI follows bugxhunter.com's design system — a
11
+ macOS-style terminal window, the red-team palette (GitHub-dark surfaces with red, amber, cyan and
12
+ green accents) and Fira Code throughout. Started from the `sovgov-poc` chatbot designer.
13
+
14
+ - **Runner** — point it at a project folder and drive OpenCode's `build` (edits + shell) or
15
+ `plan` (read-only) agent. Every file edit and shell command waits for your approval.
16
+ Markdown replies, collapsible tool calls and reasoning, per-turn token counts, and a
17
+ **Changes** view of what the agent edited (git repos only — OpenCode tracks changes via git).
18
+ - **Playground** — chat with any SCX model directly (no agent), with tool-calling, JSON mode,
19
+ an embeddings-backed knowledge base and browser voice.
20
+
21
+ ## Screenshots
22
+
23
+ The agent working in a project — live tool calls, reasoning, and a markdown summary:
24
+
25
+ ![BugXHunter — the agent reading a project and summarising it](docs/images/runner.jpg)
26
+
27
+ Point it at any folder; resume past sessions; approve edits and commands as they happen. The key
28
+ vault's state and lock live in the sidebar footer:
29
+
30
+ ![BugXHunter — Runner landing view](docs/images/landing.jpg)
31
+
32
+ Playground — compare SCX models directly with full generation controls:
33
+
34
+ ![BugXHunter — Playground](docs/images/playground.jpg)
35
+
36
+ ## Install
37
+
38
+ The quickest way, with Node 22+ installed, is the npm package (OpenCode comes with it):
39
+
40
+ ```bash
41
+ npx bugxhunter # runs the agent on this machine; UI opens at http://localhost:8790
42
+ npx bugxhunter docker # the sandboxed stack instead (needs Docker Desktop): pulls the signed
43
+ # images for this version into ~/.config/bugxhunter/docker and starts them
44
+ ```
45
+
46
+ `npm i -g bugxhunter` makes it a plain `bugxhunter` command; `bugxhunter --help` lists the
47
+ options (`--port`, `--dir`, `--no-open`; `docker down|logs|ps`; `vault reset`). The current
48
+ folder becomes the default project. Then, in the sidebar: set up the [vault](#key-vault) with a
49
+ passkey, add your SCX.ai key as `SCX_API`, and [connect GitHub](#github-repositories-read-only).
50
+ The package is published by the release workflow with npm provenance: `npm audit signatures`
51
+ confirms it was built from this repository.
52
+
53
+ ## Requirements (from source)
54
+
55
+ - Node 22+
56
+ - OpenCode on `PATH`: `npm install` here provides it, or `npm i -g opencode-ai`
57
+ - An SCX.ai key: in the [vault](#key-vault) (preferred), else `opencode auth login` (choose
58
+ **Other**, provider id `scx`) or `SCX_API` in a `.env` here.
59
+
60
+ ## Run from source
61
+
62
+ ```bash
63
+ npm install
64
+ npm run dev # backend :8790 + web :5190, with hot reload
65
+ npm start # or: the compiled app, the same way `npx bugxhunter` runs it (npm run build first)
66
+ ```
67
+
68
+ Open **http://localhost:5190** (dev) or **http://localhost:8790** (`npm start`).
69
+
70
+ The backend starts its own OpenCode server on `127.0.0.1:8791` (it stops a stale one left on
71
+ that port by a previous run). Everything listens on localhost only. There are no passwords:
72
+ until you set up the [vault](#key-vault) the app is open, and from then on you sign in with the
73
+ vault's passkey.
74
+
75
+ ## Docker (sandboxed agent + login)
76
+
77
+ `npx bugxhunter docker` does all of this (any OS). By hand, from a checkout:
78
+
79
+ ```powershell
80
+ powershell -File docker/setup.ps1 # once: writes .env — the secrets the two containers share
81
+ docker compose up -d --build # build locally, or `docker compose pull && docker compose up -d`
82
+ # for the published images (set BXH_VERSION in .env to pin a signed release)
83
+ ```
84
+
85
+ Open **http://localhost:8790** and set up the [vault](#key-vault) in the sidebar: it seals your
86
+ SCX key and turns on passkey sign-in. (`setup.ps1 -CopyScxKey` copies
87
+ the key into `.env` instead, in the clear.)
88
+
89
+ Two containers:
90
+
91
+ | Container | Holds | Network |
92
+ |---|---|---|
93
+ | `runner` | Web UI, login, SCX key, `/scx/v1` key proxy | shared bridge, published on 127.0.0.1 |
94
+ | `agent` | OpenCode, the agent's shell + scan tools, `/workspace` volume | shared bridge — **direct internet** |
95
+
96
+ - The agent's model calls go to `runner`'s proxy with a proxy token; the proxy swaps in the real
97
+ key and only allows `/chat/completions` and `/models`. **The SCX key never enters the agent
98
+ container** — this holds even though the agent has direct internet.
99
+ - Projects live in the `workspace` Docker volume (`/workspace`, a git repo so Changes work). No
100
+ host folders are mounted. Copy a repo in as a snapshot, and results back out:
101
+
102
+ ```powershell
103
+ powershell -File docker/copy-in.ps1 C:\code\my-repo # -> /workspace/my-repo (skips node_modules, .env, …)
104
+ powershell -File docker/copy-out.ps1 my-repo C:\temp\my-repo-out
105
+ ```
106
+
107
+ (Plain `docker compose cp` also copies in, but leaves files owned by root, so the agent can't edit them.)
108
+ - **The agent has direct internet** so scan tools run at full speed (`nmap`/`ping`/raw DNS work
109
+ via `NET_RAW`). Outbound connections are logged, not restricted — **only point the agent at targets you are authorised to test, and run this on a
110
+ trusted machine/VM.**
111
+ - Both containers run as non-root with `no-new-privileges`; the agent drops all capabilities except
112
+ `NET_RAW` and is limited to 2 CPUs, 4 GB RAM, 512 processes. Shell commands and file edits are
113
+ approved in the UI — that, plus the container/VM boundary and the isolated SCX key, is what
114
+ contains the agent.
115
+ - **Logs** (the audit log of prompts, tool calls and approvals, plus the egress log of hosts the
116
+ agent connected to) live in the `logs` volume, which the agent container can't see. Read them with
117
+ `docker compose cp runner:/logs ./logs`.
118
+ - Port 8790 is published on localhost only. Put TLS (a reverse proxy) in front and set
119
+ `COOKIE_SECURE=1`, `TRUST_PROXY=1` and `ALLOWED_HOSTS=<your domain>` before exposing it to anyone else.
120
+
121
+ ## Key vault
122
+
123
+ The SCX key (and any other secret the agent needs) lives in a vault that is **sealed at rest**: on
124
+ disk there is only ciphertext and wrapped keys, so a copied `.env`, volume or container yields
125
+ nothing. Set it up from the sidebar after the first start; it takes a minute:
126
+
127
+ 1. **Passkey** — Windows Hello, Touch ID, Android, or a security key. One touch unlocks the vault
128
+ and signs you in; the authenticator's own biometric or PIN is the second factor. It derives a
129
+ secret (WebAuthn PRF) that never leaves the device. Chrome, Edge and Safari 18+; Firefox can't
130
+ do this yet. Open the app as `http://localhost:…`, not by IP.
131
+ 2. **Recovery code** — shown once, stored nowhere. Keep it offline. It opens the vault if the
132
+ passkey is lost.
133
+ 3. **Backup passphrase** (optional) — a way in on a device without the passkey.
134
+
135
+ The decryption key lives only in the backend's memory, so after every restart, and after
136
+ **2 hours without activity** (`OPEN_RUNNER_VAULT_IDLE_MINUTES`), someone has to unlock it before the
137
+ agent can call a model. **Ctrl+Shift+L** locks it at once. The crypto is symmetric only
138
+ (AES-256-GCM, HKDF-SHA-256, PBKDF2-SHA-256), which keeps it out of reach of a quantum attacker;
139
+ see [SECURITY.md](SECURITY.md#the-key-vault).
140
+
141
+ While the vault is locked, model calls fail with a clear "vault is sealed" message. Without a vault
142
+ the app falls back to `SCX_API` in `.env` or OpenCode's `auth.json`, in the clear.
143
+
144
+ **Sign-in is the same passkey.** Once a vault exists the API needs a session, and the ways in are
145
+ a WebAuthn assertion with one of the vault's passkeys (verified server-side), the backup
146
+ passphrase, or the recovery code. One touch at the sign-in screen signs in and unlocks the vault.
147
+ Keep two passkeys on different devices (keys dialog → add passkey). Lost every factor? Someone with
148
+ access to the server's files runs `npm run vault:reset` (Docker: `docker compose exec runner rm
149
+ /data/vault.json`): the vault and its secrets are gone and the app reopens for a fresh setup.
150
+ Nothing on the network can do that, which is what keeps the lock meaningful.
151
+
152
+ ## Other models via OpenRouter
153
+
154
+ SCX.ai is the default provider. To use anything from [OpenRouter's catalogue](https://openrouter.ai/models)
155
+ as well:
156
+
157
+ 1. Add your OpenRouter key to the vault as `OPENROUTER_API_KEY` (keys dialog in the sidebar). The
158
+ **Playground** then lists OpenRouter's models under their own heading, addressed as
159
+ `openrouter/<id>`.
160
+ 2. For the **agent**, list the ids it may use in `OPENROUTER_MODELS` (comma-separated, e.g.
161
+ `anthropic/claude-sonnet-4.5,openai/gpt-5`), in `.env`. Only those appear in the Runner's model
162
+ picker, as `openrouter/…`. In Docker, both containers read the same variable.
163
+
164
+ The agent never holds the key: its calls go to the runner's `/openrouter/v1` proxy with the proxy
165
+ token, exactly like SCX, in both local and Docker modes. Pricing is OpenRouter's; the Playground
166
+ shows each model's per-token rates.
167
+
168
+ ## GitHub repositories (read-only)
169
+
170
+ To review a repository, clone it into the workspace from the sidebar (**clone from GitHub** under
171
+ the project folder). The first time, click **Connect GitHub**: a short code appears, you enter it
172
+ at github.com/login/device, and the runner is signed in. Then **Choose repositories on GitHub**
173
+ opens the app's install screen, where you pick which repositories it may read; the list in the
174
+ dialog refreshes when you come back. Nothing to register, no token to paste.
175
+
176
+ The sign-in is to the public **BugXHunter** GitHub App, which declares only *Contents: read-only*
177
+ and *Metadata: read-only*, so even GitHub will refuse a push with its token. It reaches only the
178
+ repositories you install it on, and you can change that list or revoke the app on GitHub at any
179
+ time. Its tokens expire after eight hours and are refreshed by the runner; the pair is sealed in
180
+ the vault (or, before a vault exists, kept in memory until the runner restarts).
181
+
182
+ A clone lands in `<workspace>/<owner>/<repo>` (Docker: the shared `workspace` volume; locally
183
+ `~/bugxhunter/repos`, or `OPEN_RUNNER_WORKSPACE`) and becomes the project folder. Cloning again
184
+ fast-forwards it and never resets local edits.
185
+
186
+ **The runner does the cloning, the agent gets a working copy.** The token is passed to git as a
187
+ process-scoped header, so it is in neither the command line nor the clone's `.git/config`. The
188
+ agent can read, grep and scan the code (gitleaks over the history included) and edit it locally,
189
+ but nothing in the sandbox can fetch, push, open issues or see any other repository. Pushing
190
+ results back is deliberately not built: findings leave through the UI, not through your GitHub
191
+ account.
192
+
193
+ A fork that wants its own app registers one (device flow on, *Contents: read-only*, installable
194
+ on any account) and sets `GITHUB_CLIENT_ID` and `GITHUB_APP_SLUG`.
195
+
196
+ ## Security-testing tools (authorised use only)
197
+
198
+ The agent image ships a standard pentest toolchain for **authorised** testing (your own sites,
199
+ labs, CTFs). Build with `--build-arg SECTOOLS=0` to leave them out.
200
+
201
+ - **Vuln / web:** `nuclei` (templates baked in offline), `httpx`, `katana` (SPA/JS crawler),
202
+ `ffuf` (+ SecLists wordlists in `/opt/wordlists`), `testssl`, `curl`, `openssl`, `subfinder`
203
+ (passive).
204
+ - **Secrets (local, no network):** `gitleaks` — scan copied-in repos and JS bundles for leaked keys.
205
+ - **Raw-socket:** `nmap`, `ping`, `traceroute`, `dig`/`host` (incl. zone transfer).
206
+
207
+ All tools run directly against targets. The agent's `AGENTS.md` tells it to confirm authorisation
208
+ before scanning and to scan only hosts you name.
209
+
210
+ **Making scans fast** (they're slow if done naively):
211
+ - **Scope nuclei templates** — the biggest lever. `-tags cve,exposure` or `-severity
212
+ critical,high,medium` instead of all ~14k templates. Fingerprint with httpx first and target the
213
+ detected stack.
214
+ - **Pre-filter** with katana/httpx and feed only live URLs into nuclei/ffuf.
215
+ - **Tune to the target:** `-c 50 -rl 300 -bulk-size 50 -timeout 5` on a tolerant host; *lower* on a
216
+ CDN/WAF target, where aggression trips rate-limits and is slower.
217
+ - **Run long scans detached**, writing to `/workspace` (`-o result.txt`), and poll the file so an
218
+ aborted turn doesn't lose progress.
219
+
220
+ To fence the agent to a specific lab/target range, add firewall rules on the Docker host or the VM
221
+ you run this in — Docker's bridge NAT doesn't restrict outbound on its own.
222
+
223
+ ## Configuration (environment variables)
224
+
225
+ | Variable | Default | Purpose |
226
+ |---|---|---|
227
+ | `OPEN_RUNNER_MODEL` | `scx/GLM-5.3` | Default model for both agents |
228
+ | `OPEN_RUNNER_DIR` | this folder | Default project folder |
229
+ | `OPEN_RUNNER_AGENT_PORT` | `8791` | Port for the OpenCode server |
230
+ | `PORT` | `8790` | Backend port |
231
+ | `SCX_API` | the vault, else `opencode auth login` | SCX key in the clear; ignored once a vault exists (preferred) |
232
+ | `OPENROUTER_API_KEY` | the vault, else unset | OpenRouter key in the clear; prefer the vault item of the same name |
233
+ | `OPENROUTER_MODELS` | unset | Comma list of OpenRouter model ids the agent may use; becomes an OpenCode provider through the proxy |
234
+ | `OPENROUTER_BASE_URL` | `https://openrouter.ai/api/v1` | OpenRouter endpoint |
235
+ | `GITHUB_CLIENT_ID` | the BugXHunter app | A fork's own GitHub App (device flow); `GITHUB_APP_SLUG` names its install page |
236
+ | `OPEN_RUNNER_VAULT_FILE` | `~/.config/bugxhunter/vault.json` | The sealed vault (Docker: `/data/vault.json` on the `runner-data` volume) |
237
+ | `OPEN_RUNNER_VAULT_IDLE_MINUTES` | `120` | Auto-lock after this long without a model call or API write; `0` = never |
238
+ | `OPEN_RUNNER_SECRET` | random per start | Signs session cookies; set it to keep sign-ins across restarts |
239
+ | `COOKIE_SECURE` | unset | `1` marks the session cookie `Secure` (behind TLS) |
240
+ | `TRUST_PROXY` | unset | Behind a reverse proxy: `1` (hop count), `loopback`, or a CIDR list — so the cookie's `Secure` flag and client IPs are right |
241
+ | `OPEN_RUNNER_LOG_DIR` | unset (off) | Folder for the JSONL audit log (Docker sets `/logs`) |
242
+ | `ALLOWED_HOSTS` | localhost only | Extra `Host` header values to accept (comma list), e.g. the domain a reverse proxy serves. Everything else gets 403, which blocks DNS-rebinding attacks |
243
+ | `OPEN_RUNNER_ALLOWED_ROOTS` | any folder | Local mode: folders the UI may open, PATH-style list (`;` on Windows, `:` elsewhere). Set it before sharing the app |
244
+ | `OPENCODE_URL` | unset (spawn locally) | Use a remote OpenCode server (Docker sets `http://agent:4096`) |
245
+ | `OPEN_RUNNER_WORKSPACE` | `/workspace` (local: `~/bugxhunter/repos`) | Remote mode: projects must live under this folder. Both modes: where GitHub clones land |
246
+ | `SCX_PROXY_TOKEN` | unset | Enables the `/scx/v1` key proxy for the sandboxed agent |
247
+
248
+ Releases are on the [releases page](https://github.com/cintelis/bugxhunter-runner/releases).
249
+ See [SECURITY.md](SECURITY.md) to verify one by hand, or to report a vulnerability.
250
+
251
+ ## Releases
252
+
253
+ Every published release, newest first. Each is signed with the Cintelis release key;
254
+ `scripts/verify-release.sh` refuses anything that isn't. A release ships an **app** archive (the
255
+ compiled server and web app, runnable with Node and no Docker), a **deploy** archive
256
+ (`docker-compose.yml` and the setup scripts, pinned to that version's images), `images.txt` (both
257
+ GHCR images by digest) and the signed `checksums.txt` that covers them all.
258
+
259
+ <!-- releases:start -->
260
+ | Release | Published | Checksums | Signature | Signature check | Build |
261
+ | --- | --- | --- | --- | --- | --- |
262
+ | [v0.3.0](https://github.com/cintelis/bugxhunter-runner/releases/tag/v0.3.0) | 2026-10-07 | [checksums.txt](https://github.com/cintelis/bugxhunter-runner/releases/download/v0.3.0/checksums.txt) | [checksums.txt.sig](https://github.com/cintelis/bugxhunter-runner/releases/download/v0.3.0/checksums.txt.sig) | ✅ release key | [workflow run](https://github.com/cintelis/bugxhunter-runner/actions/runs/37636400569) |
263
+ | [v0.2.0](https://github.com/cintelis/bugxhunter-runner/releases/tag/v0.2.0) | 2026-10-07 | [checksums.txt](https://github.com/cintelis/bugxhunter-runner/releases/download/v0.2.0/checksums.txt) | [checksums.txt.sig](https://github.com/cintelis/bugxhunter-runner/releases/download/v0.2.0/checksums.txt.sig) | ✅ release key | [workflow run](https://github.com/cintelis/bugxhunter-runner/actions/runs/37618237000) |
264
+ | [v0.1.0](https://github.com/cintelis/bugxhunter-runner/releases/tag/v0.1.0) | 2026-10-07 | [checksums.txt](https://github.com/cintelis/bugxhunter-runner/releases/download/v0.1.0/checksums.txt) | [checksums.txt.sig](https://github.com/cintelis/bugxhunter-runner/releases/download/v0.1.0/checksums.txt.sig) | ✅ release key | [workflow run](https://github.com/cintelis/bugxhunter-runner/actions/runs/37597898761) |
265
+
266
+ Signature check: `checksums.txt.sig` verified against the release key (`SHA256:RY9yd61LBZCa5WrzSkEet+1Dnt2zVu9zpMRbZMWIV+I`)
267
+ when this table was generated by `scripts/release-table.sh`. To check a download
268
+ yourself, see [SECURITY.md](SECURITY.md#verifying-a-release-yourself).
269
+ <!-- releases:end -->
270
+
271
+ To use a release, verify it first (`scripts/verify-release.sh vX.Y.Z`, see
272
+ [SECURITY.md](SECURITY.md)), then either unpack the deploy archive and run `docker compose pull
273
+ && docker compose up -d` (its `VERSION` file pins the images), or unpack the app archive and run
274
+ `npm ci --omit=dev && NODE_ENV=production node server/dist/index.js`.
275
+
276
+ ## Development
277
+
278
+ ```bash
279
+ npm run check # typecheck + lint + unit tests (what CI runs)
280
+ npm run typecheck # tsc, both workspaces
281
+ npm run lint # eslint (typescript-eslint + react-hooks), warnings fail
282
+ npm test # vitest: the pure logic in server/src and web/src
283
+ npm run build # web -> web/dist, server -> server/dist (what the Docker image ships)
284
+ ```
285
+
286
+ GitHub Actions: `ci.yml` runs the checks and builds both Docker images on every push and PR,
287
+ `codeql.yml` scans for security issues weekly and on PRs, `docker-publish.yml` pushes the images to
288
+ GHCR (`ghcr.io/cintelis/bugxhunter-runner` and `bugxhunter-agent`) on `master` and on `v*` tags, and Dependabot
289
+ keeps npm, Actions and base images current.
290
+
291
+ Server and browser share one type contract in `shared/` (`agent.d.ts`, `scx.d.ts`): the server's
292
+ event mapping must produce those shapes and the client consumes them, so a change on either side
293
+ fails the other's type-check.
294
+
295
+ ## Releasing
296
+
297
+ Bump `version` in `package.json`, then tag and push; the release workflow checks, builds the
298
+ archives and the versioned images with provenance attestations, and creates a **draft**. Then sign
299
+ it with the offline release key, which verifies the draft's attestations and checksums first and
300
+ publishes it:
301
+
302
+ ```sh
303
+ git tag -a v1.0.0 -m "BugXHunter v1.0.0"
304
+ git push origin v1.0.0
305
+ # once the workflow finishes (10-15 minutes, the agent image is large):
306
+ scripts/sign-release.sh v1.0.0
307
+ ```
308
+
309
+ On Windows, run the signing script from PowerShell through Git Bash:
310
+ `& 'C:\Program Files\Git\bin\bash.exe' scripts/sign-release.sh v1.0.0`.
311
+ It asks for the key's passphrase once. Only admins can push `v*` tags.
312
+
313
+ After publishing, the script regenerates the release table above (`scripts/release-table.sh`)
314
+ and opens a pull request for it that merges itself once CI passes.
315
+
316
+ The tag also publishes the npm package (`npm run pack:npm` assembles it from the same build;
317
+ the workflow's `npm` job publishes it with provenance). That needs the package's **trusted
318
+ publisher** on npmjs.com set to this repository and `release.yml`, once; no npm token is stored.
319
+
320
+ ## Layout
321
+
322
+ | Path | Role |
323
+ |---|---|
324
+ | `server/src/opencode.ts` | Starts/stops the OpenCode server, one SDK client per project folder, event mapping |
325
+ | `server/src/index.ts` | Express: `/api/agent/*` (OpenCode) and `/api/chat`, `/api/models`, `/api/kb` (SCX) |
326
+ | `server/src/scx.ts`, `rag.ts` | SCX client and in-memory knowledge base (Playground) |
327
+ | `shared/` | Type contract between server and browser |
328
+ | `scripts/` | `sign-release.sh` (maintainer, offline key), `verify-release.sh` (users), `release-table.sh`, the release public key |
329
+ | `web/src/AgentPanel.tsx` | Runner transcript, approvals and session flow; `DiffModal.tsx` and `QuestionCard.tsx` hold the Changes view and agent questions |
330
+ | `web/src/Sidebar.tsx` | Project folder picker (Runner) and model/prompt settings (Playground) |
331
+ | `web/src/styles.css`, `brand.tsx`, `Terminal.tsx` | bugxhunter.com theme tokens, the `>_ BugXHunter` wordmark, terminal title bar and typed boot sequence |
332
+
333
+ ## AI assistance
334
+
335
+ BugXHunter was built with [Claude Code](https://claude.com/claude-code), and the codebase was
336
+ reviewed and hardened by [Claude Mythos 5.1](https://www.anthropic.com/claude/mythos) (bug fixes,
337
+ the security hardening, tests and CI). The app shows this with Anthropic's Claude wordmark, used
338
+ as published. It is a model credit, not an endorsement by Anthropic; the maintainers are
339
+ responsible for the code.
340
+
341
+ ## License
342
+
343
+ [MIT](LICENSE) © Cintelis.
344
+
345
+ > BugXHunter ships a security-testing toolchain for **authorised** testing only (your own
346
+ > systems, labs, CTFs). You are responsible for how you use it.
package/SECURITY.md ADDED
@@ -0,0 +1,121 @@
1
+ # Security
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ Please report privately through GitHub:
6
+ **[Report a vulnerability](https://github.com/cintelis/bugxhunter-runner/security/advisories/new)**.
7
+ Don't open a public issue for security problems.
8
+
9
+ ## How releases are protected
10
+
11
+ - **Signed.** Every release's `checksums.txt` is signed with the Cintelis
12
+ release key, an Ed25519 key kept offline by the maintainer and never
13
+ stored on GitHub. It covers the release archives and `images.txt`, which
14
+ pins both container images by digest. `scripts/verify-release.sh` refuses
15
+ any release whose signature doesn't verify.
16
+ - **Built by CI, with provenance.** Release archives and images are built by
17
+ this repository's release workflow and carry a signed build-provenance
18
+ attestation. The workflow produces a *draft*; the maintainer checks the
19
+ attestations and checksums before signing and publishing it
20
+ (`scripts/sign-release.sh`).
21
+ - **Protected tags.** Only repository admins can create, move or delete
22
+ `v*` tags.
23
+ - **Pinned dependencies.** npm packages are pinned by hash in the lockfile;
24
+ the release workflow's GitHub Actions are pinned to commits; the agent
25
+ image's security tools are pinned to specific versions. CodeQL scans every
26
+ change and weekly, and Dependabot tracks updates.
27
+
28
+ ## The key vault
29
+
30
+ API keys and other secrets the app holds are sealed at rest in `vault.json`
31
+ (`shared/vault.d.ts` is the format). What an attacker who copies the file, the
32
+ `runner-data` volume or the whole container gets is ciphertext and wrapped keys.
33
+
34
+ - **One touch, two factors.** The passkey's key-encryption key is HKDF-SHA-256
35
+ over its WebAuthn PRF output (an HMAC computed inside the authenticator; the
36
+ seed never leaves it), and every PRF evaluation requires user verification
37
+ (biometric or PIN) on the device: possession plus something you know or are.
38
+ A recovery code (128 random bits, shown once) and an optional backup
39
+ passphrase (PBKDF2-SHA-256, 600k iterations) are separate ways in, each
40
+ wrapping the same data key.
41
+ - **Symmetric only.** AES-256-GCM, HKDF-SHA-256, PBKDF2-SHA-256 (600k iterations)
42
+ and the PRF. No RSA or elliptic-curve step protects the data, so the design does
43
+ not depend on anything a quantum computer is expected to break; 256-bit
44
+ symmetric keys keep their margin against Grover's algorithm.
45
+ - **The server never sees a factor.** The browser derives the key-encryption key,
46
+ unwraps the data key and hands only that to the backend, which keeps it in memory
47
+ until the vault is locked, the process exits, or `OPEN_RUNNER_VAULT_IDLE_MINUTES`
48
+ (default 120) pass without a model call or an API write. Items are bound to their
49
+ names (AES-GCM additional data), so a ciphertext can't be moved between names.
50
+ - **The agent never sees the key.** In Docker it talks to a key-injecting proxy.
51
+ In local mode the backend removes every secret from its environment before
52
+ OpenCode is spawned, since the agent's shell inherits that environment.
53
+ - **Sign-in is the passkey.** No passwords exist. With a vault present, every API
54
+ call needs a session issued for a WebAuthn assertion the server verified:
55
+ single-use challenge, allowed origin, relying-party hash, user-presence and
56
+ user-verification flags, signature against the public key captured at
57
+ enrolment, and a monotonic counter where the authenticator keeps one. The
58
+ backup passphrase and the recovery code sign in by proving possession of the
59
+ vault key. Without a vault the app is open, on localhost only, behind the
60
+ Host-header guard.
61
+ - **Break-glass is on the server only.** Losing the passkey and the recovery
62
+ code means the secrets are gone; `npm run vault:reset` deletes the vault from
63
+ the server's files and reopens the app for a new setup. No network request
64
+ can do that.
65
+ - **Not covered.** A compromise of the running backend while unlocked exposes
66
+ what it holds in memory; that is inherent to a server that uses the key. Model
67
+ inputs and tool output go to the model provider in plaintext; the vault seals
68
+ secrets, not engagements.
69
+
70
+ ## The GitHub sign-in
71
+
72
+ The GitHub integration is read-only on both sides. On GitHub's side, the runner signs in to the
73
+ public BugXHunter GitHub App with the device flow (no client secret exists, so there is nothing to
74
+ leak from an open-source build). The app declares only **Contents: read-only** and **Metadata:
75
+ read-only**, and a user token reaches only the repositories the app was installed on, so GitHub
76
+ itself refuses anything beyond reading those. Revoke it any time under *Settings → Applications*.
77
+ On the runner's side, the token pair lives in the vault like the model keys (in memory until a
78
+ vault exists), is handed to git through a process-scoped config entry (`GIT_CONFIG_*`, so it is
79
+ not on a command line and not in the clone's `.git/config`; credential helpers are disabled so
80
+ nothing caches it), and never reaches the agent. The agent container receives a plain working copy
81
+ in the shared workspace with an `https://github.com/...` origin and no credentials: it can read
82
+ and scan the code, and cannot fetch, push or reach any other repository.
83
+
84
+ ## Verifying a release yourself
85
+
86
+ The release public key:
87
+
88
+ ```
89
+ ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOCB3IaMc3Lc4JvPv6rWCVLpTjmvvPrhFFPST0NSsypP cintelis-release
90
+ ```
91
+
92
+ Fingerprint: `SHA256:RY9yd61LBZCa5WrzSkEet+1Dnt2zVu9zpMRbZMWIV+I`
93
+
94
+ It is also published on our domain, so you can cross-check it through a
95
+ second channel: <https://cintelis.ai/.well-known/cintelis-release.pub>
96
+
97
+ The quick way, from a folder holding whatever you downloaded:
98
+
99
+ ```sh
100
+ scripts/verify-release.sh v1.2.3
101
+ ```
102
+
103
+ By hand:
104
+
105
+ ```sh
106
+ # 1. the checksums are signed by the release key
107
+ echo 'bugxhunter-release namespaces="bugxhunter-release" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOCB3IaMc3Lc4JvPv6rWCVLpTjmvvPrhFFPST0NSsypP' > allowed_signers
108
+ ssh-keygen -Y verify -f allowed_signers -I bugxhunter-release -n bugxhunter-release \
109
+ -s checksums.txt.sig < checksums.txt
110
+
111
+ # 2. your archives (and images.txt) match the signed checksums
112
+ sha256sum --ignore-missing -c checksums.txt
113
+
114
+ # 3. pull the images by the digests in the signed images.txt, not by tag
115
+ docker pull "$(sed -n 1p images.txt)"
116
+ docker pull "$(sed -n 2p images.txt)"
117
+
118
+ # 4. optionally, they were built by this repository's release workflow
119
+ gh attestation verify bugxhunter-runner_<version>_app.tar.gz --repo cintelis/bugxhunter-runner
120
+ gh attestation verify oci://ghcr.io/cintelis/bugxhunter-runner:v<version> --repo cintelis/bugxhunter-runner
121
+ ```