bugxhunter 0.7.0 → 0.8.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/README.md +5 -0
- package/package.json +1 -1
- package/server/dist/index.js +35 -12
- package/server/dist/opencode.js +77 -0
- package/web/dist/assets/{index-DhmVibNm.js → index-BYyFGDCI.js} +20 -20
- package/web/dist/assets/index-DvIQFEpS.css +1 -0
- package/web/dist/index.html +2 -2
- package/bugxhunter-0.7.0.tgz +0 -0
- package/web/dist/assets/index-BB7aGoAA.css +0 -1
package/README.md
CHANGED
|
@@ -215,6 +215,10 @@ labs, CTFs). Build with `--build-arg SECTOOLS=0` to leave them out.
|
|
|
215
215
|
(passive).
|
|
216
216
|
- **Secrets (local, no network):** `gitleaks` — scan copied-in repos and JS bundles for leaked keys.
|
|
217
217
|
- **Raw-socket:** `nmap`, `ping`, `traceroute`, `dig`/`host` (incl. zone transfer).
|
|
218
|
+
- **Not included — LLM red-teaming:** `promptfoo` (~1.4 GB installed) and `garak` (~2 GB with
|
|
219
|
+
CPU-only PyTorch, 5 GB+ if pip is left to pull the CUDA build) would more than double the image,
|
|
220
|
+
so the agent installs them on demand into the persistent `/workspace/.tools` volume. The recipe,
|
|
221
|
+
including pointing them at the runner's model proxy for grading, is in `docker/agent-AGENTS.md`.
|
|
218
222
|
|
|
219
223
|
All tools run directly against targets. The agent's `AGENTS.md` tells it to confirm authorisation
|
|
220
224
|
before scanning and to scan only hosts you name.
|
|
@@ -271,6 +275,7 @@ GHCR images by digest) and the signed `checksums.txt` that covers them all.
|
|
|
271
275
|
<!-- releases:start -->
|
|
272
276
|
| Release | Published | Checksums | Signature | Signature check | Build |
|
|
273
277
|
| --- | --- | --- | --- | --- | --- |
|
|
278
|
+
| [v0.7.0](https://github.com/cintelis/bugxhunter-runner/releases/tag/v0.7.0) | 2026-10-08 | [checksums.txt](https://github.com/cintelis/bugxhunter-runner/releases/download/v0.7.0/checksums.txt) | [checksums.txt.sig](https://github.com/cintelis/bugxhunter-runner/releases/download/v0.7.0/checksums.txt.sig) | ✅ release key | [workflow run](https://github.com/cintelis/bugxhunter-runner/actions/runs/37718565914) |
|
|
274
279
|
| [v0.6.0](https://github.com/cintelis/bugxhunter-runner/releases/tag/v0.6.0) | 2026-10-08 | [checksums.txt](https://github.com/cintelis/bugxhunter-runner/releases/download/v0.6.0/checksums.txt) | [checksums.txt.sig](https://github.com/cintelis/bugxhunter-runner/releases/download/v0.6.0/checksums.txt.sig) | ✅ release key | [workflow run](https://github.com/cintelis/bugxhunter-runner/actions/runs/37705423314) |
|
|
275
280
|
| [v0.5.0](https://github.com/cintelis/bugxhunter-runner/releases/tag/v0.5.0) | 2026-10-07 | [checksums.txt](https://github.com/cintelis/bugxhunter-runner/releases/download/v0.5.0/checksums.txt) | [checksums.txt.sig](https://github.com/cintelis/bugxhunter-runner/releases/download/v0.5.0/checksums.txt.sig) | ✅ release key | [workflow run](https://github.com/cintelis/bugxhunter-runner/actions/runs/37702342512) |
|
|
276
281
|
| [v0.4.0](https://github.com/cintelis/bugxhunter-runner/releases/tag/v0.4.0) | 2026-10-07 | [checksums.txt](https://github.com/cintelis/bugxhunter-runner/releases/download/v0.4.0/checksums.txt) | [checksums.txt.sig](https://github.com/cintelis/bugxhunter-runner/releases/download/v0.4.0/checksums.txt.sig) | ✅ release key | [workflow run](https://github.com/cintelis/bugxhunter-runner/actions/runs/37640130325) |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bugxhunter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "BugXHunter: an AI security-testing agent with a sandboxed runner, a passkey-sealed key vault and read-only GitHub access. `npx bugxhunter` runs it on your machine.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://bugxhunter.com",
|
package/server/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import path from "node:path";
|
|
|
13
13
|
import { SCXError } from "./scx.js";
|
|
14
14
|
import { PROVIDERS, PROXY_TOKEN, PORT, OPENROUTER_MODELS, apiKey, clients, clientFor, keySource, listModels } from "./providers.js";
|
|
15
15
|
import { KnowledgeBase, buildContextBlock } from "./rag.js";
|
|
16
|
-
import { getClient, serverUrl, resolveDirectory, projectFile, listAgentModels, toUiEvent, toUiMessages, parseModelId, oc, query, httpError, DEFAULT_DIRECTORY, DEFAULT_MODEL, REMOTE_URL, REPO_ROOT, ALLOWED_ROOTS, } from "./opencode.js";
|
|
16
|
+
import { getClient, serverUrl, resolveDirectory, projectFile, listAgentModels, toUiEvent, toUiMessages, parseModelId, oc, query, httpError, SessionFamily, childSessions, DEFAULT_DIRECTORY, DEFAULT_MODEL, REMOTE_URL, REPO_ROOT, ALLOWED_ROOTS, } from "./opencode.js";
|
|
17
17
|
import { mountAuth, authRequired, issueSession } from "./auth.js";
|
|
18
18
|
import { audit, followOpencode, LOG_DIR } from "./audit.js";
|
|
19
19
|
import { saveAttachments } from "./attachments.js";
|
|
@@ -509,9 +509,29 @@ app.get("/api/agent/session/:id/messages", async (req, res) => {
|
|
|
509
509
|
try {
|
|
510
510
|
const directory = await resolveDirectory(req.query.directory);
|
|
511
511
|
const client = await getClient(directory);
|
|
512
|
-
const msgs = unwrap(await client.session.messages({ path: { id: req.params.id }, query: { directory } }));
|
|
512
|
+
const msgs = unwrap(await client.session.messages({ path: { id: req.params.id }, query: { directory } })) ?? [];
|
|
513
513
|
const todos = await oc(`/session/${encodeURIComponent(req.params.id)}/todo${query({ directory })}`).catch(() => []);
|
|
514
|
-
|
|
514
|
+
// Subagent sessions' messages are merged in by creation time and tagged
|
|
515
|
+
// with the subagent's title, so a resumed chat shows what the live stream
|
|
516
|
+
// did. Their user messages (the delegation prompt) are skipped: the parent's
|
|
517
|
+
// task tool call already shows it.
|
|
518
|
+
const stamped = [];
|
|
519
|
+
const stamp = (raw, subagent) => {
|
|
520
|
+
const ui = toUiMessages(raw);
|
|
521
|
+
raw.forEach((m, i) => {
|
|
522
|
+
if (subagent && m?.info?.role === "user")
|
|
523
|
+
return;
|
|
524
|
+
stamped.push({ at: m?.info?.time?.created ?? 0, msg: subagent ? { ...ui[i], subagent } : ui[i] });
|
|
525
|
+
});
|
|
526
|
+
};
|
|
527
|
+
stamp(msgs);
|
|
528
|
+
for (const child of await childSessions(directory, req.params.id)) {
|
|
529
|
+
try {
|
|
530
|
+
stamp(unwrap(await client.session.messages({ path: { id: child.id }, query: { directory } })) ?? [], child.title || "subagent");
|
|
531
|
+
}
|
|
532
|
+
catch { /* a vanished subagent session is not worth failing the resume */ }
|
|
533
|
+
}
|
|
534
|
+
const messages = stamped.sort((a, b) => a.at - b.at).map((s) => s.msg);
|
|
515
535
|
res.json({ messages, todos });
|
|
516
536
|
}
|
|
517
537
|
catch (e) {
|
|
@@ -592,13 +612,16 @@ app.get("/api/agent/pending", async (req, res) => {
|
|
|
592
612
|
try {
|
|
593
613
|
const sessionID = String(req.query.sessionID || "");
|
|
594
614
|
const directory = await resolveDirectory(req.query.directory);
|
|
615
|
+
// A subagent's prompt blocks the chat just like the root session's own.
|
|
616
|
+
const family = sessionID ? new SessionFamily(sessionID, await childSessions(directory, sessionID)) : null;
|
|
617
|
+
const inScope = (sid) => !family || family.has(sid);
|
|
595
618
|
const permsRaw = await oc(`/permission${query({ directory })}`).catch(() => []);
|
|
596
619
|
// GET /question lists every pending question request (same shape as the
|
|
597
620
|
// question.asked event); filter to this session like the permissions.
|
|
598
621
|
const qRaw = await oc(`/question${query({ directory })}`).catch(() => []);
|
|
599
622
|
const pending = {
|
|
600
623
|
permissions: permsRaw
|
|
601
|
-
.filter((p) =>
|
|
624
|
+
.filter((p) => inScope(p.sessionID))
|
|
602
625
|
.map((p) => ({
|
|
603
626
|
kind: "permission",
|
|
604
627
|
sessionID: p.sessionID,
|
|
@@ -607,15 +630,17 @@ app.get("/api/agent/pending", async (req, res) => {
|
|
|
607
630
|
title: p.metadata?.command ?? p.title,
|
|
608
631
|
pattern: p.patterns ?? p.pattern,
|
|
609
632
|
callID: p.callID,
|
|
633
|
+
subagent: family?.subagent(p.sessionID),
|
|
610
634
|
})),
|
|
611
635
|
questions: qRaw
|
|
612
|
-
.filter((q) =>
|
|
636
|
+
.filter((q) => inScope(q.sessionID))
|
|
613
637
|
.map((q) => ({
|
|
614
638
|
kind: "question",
|
|
615
639
|
sessionID: q.sessionID,
|
|
616
640
|
requestID: q.id,
|
|
617
641
|
questions: q.questions ?? [],
|
|
618
642
|
callID: q.tool?.callID,
|
|
643
|
+
subagent: family?.subagent(q.sessionID),
|
|
619
644
|
})),
|
|
620
645
|
};
|
|
621
646
|
res.json(pending);
|
|
@@ -720,16 +745,14 @@ app.get("/api/agent/events", async (req, res) => {
|
|
|
720
745
|
const sub = await client.event.subscribe({ query: { directory } });
|
|
721
746
|
let closed = false;
|
|
722
747
|
req.on("close", () => { closed = true; clearInterval(keepAlive); sub.stream.return?.(undefined); });
|
|
748
|
+
// This session's events plus its subagents' (tagged), seeded with the
|
|
749
|
+
// subagents that already exist; ones spawned later announce themselves on
|
|
750
|
+
// the stream. Without a session id everything is forwarded.
|
|
751
|
+
const family = sessionID ? new SessionFamily(sessionID, await childSessions(directory, sessionID)) : null;
|
|
723
752
|
for await (const evt of sub.stream) {
|
|
724
753
|
if (closed)
|
|
725
754
|
break;
|
|
726
|
-
|
|
727
|
-
const sid = evt?.properties?.part?.sessionID ??
|
|
728
|
-
evt?.properties?.sessionID ??
|
|
729
|
-
evt?.properties?.info?.sessionID;
|
|
730
|
-
if (sessionID && sid && sid !== sessionID)
|
|
731
|
-
continue;
|
|
732
|
-
const ui = toUiEvent(evt);
|
|
755
|
+
const ui = family ? family.relay(evt) : toUiEvent(evt);
|
|
733
756
|
if (ui)
|
|
734
757
|
res.write(`data: ${JSON.stringify(ui)}\n\n`);
|
|
735
758
|
}
|
package/server/dist/opencode.js
CHANGED
|
@@ -399,6 +399,83 @@ export function toUiEvent(evt) {
|
|
|
399
399
|
return null;
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
+
/**
|
|
403
|
+
* One chat's sessions: the root session plus the subagent sessions it spawns
|
|
404
|
+
* (OpenCode's task tool creates a child session per delegation, with
|
|
405
|
+
* `parentID` set). Without this the browser only ever saw the root: a
|
|
406
|
+
* subagent's output was invisible and its approval prompts went unanswered,
|
|
407
|
+
* leaving the chat "spinning" forever.
|
|
408
|
+
*/
|
|
409
|
+
export class SessionFamily {
|
|
410
|
+
rootID;
|
|
411
|
+
titles = new Map();
|
|
412
|
+
constructor(rootID, children = []) {
|
|
413
|
+
this.rootID = rootID;
|
|
414
|
+
// Parents may be listed after their children; a second pass catches grandchildren.
|
|
415
|
+
for (let i = 0; i < 2; i++)
|
|
416
|
+
for (const c of children)
|
|
417
|
+
this.add(c);
|
|
418
|
+
}
|
|
419
|
+
/** Adopt a session if its parent is in the family. Returns true when adopted. */
|
|
420
|
+
add(s) {
|
|
421
|
+
if (!s?.id || !s.parentID)
|
|
422
|
+
return false;
|
|
423
|
+
if (s.parentID !== this.rootID && !this.titles.has(s.parentID))
|
|
424
|
+
return false;
|
|
425
|
+
this.titles.set(s.id, s.title || "subagent");
|
|
426
|
+
return true;
|
|
427
|
+
}
|
|
428
|
+
has(sessionID) {
|
|
429
|
+
return sessionID === this.rootID || this.titles.has(sessionID);
|
|
430
|
+
}
|
|
431
|
+
/** The subagent's title, or undefined for the root session itself. */
|
|
432
|
+
subagent(sessionID) {
|
|
433
|
+
return this.titles.get(sessionID);
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* What the browser gets for a raw OpenCode event: the root's events as they
|
|
437
|
+
* are, a subagent's tagged with its title, everything else dropped. A
|
|
438
|
+
* subagent's idle/error must not end the parent's turn, and its session and
|
|
439
|
+
* todo updates are not the chat's.
|
|
440
|
+
*/
|
|
441
|
+
relay(evt) {
|
|
442
|
+
const p = evt?.properties;
|
|
443
|
+
if ((evt?.type === "session.created" || evt?.type === "session.updated") && p?.info?.id)
|
|
444
|
+
this.add(p.info);
|
|
445
|
+
const ui = toUiEvent(evt);
|
|
446
|
+
if (!ui)
|
|
447
|
+
return null;
|
|
448
|
+
// Events carry the session id in different spots; some (permission.replied
|
|
449
|
+
// on older servers, question.*) carry none and pass through.
|
|
450
|
+
const sid = p?.part?.sessionID ?? p?.sessionID ?? p?.info?.sessionID ?? p?.permission?.sessionID ?? ui.sessionID;
|
|
451
|
+
if (!sid || sid === this.rootID)
|
|
452
|
+
return ui;
|
|
453
|
+
const title = this.titles.get(sid);
|
|
454
|
+
if (!title)
|
|
455
|
+
return null;
|
|
456
|
+
if (ui.kind === "idle" || ui.kind === "error" || ui.kind === "session" || ui.kind === "todo")
|
|
457
|
+
return null;
|
|
458
|
+
return { ...ui, subagent: title };
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Every subagent session under `rootID` (children, grandchildren, …), via
|
|
463
|
+
* OpenCode's children endpoint. Depth-limited; a failure yields an empty list
|
|
464
|
+
* so the chat still works without the subagent view.
|
|
465
|
+
*/
|
|
466
|
+
export async function childSessions(directory, rootID, depth = 3) {
|
|
467
|
+
if (depth <= 0)
|
|
468
|
+
return [];
|
|
469
|
+
const kids = await oc(`/session/${encodeURIComponent(rootID)}/children${query({ directory })}`).catch(() => []);
|
|
470
|
+
const out = [];
|
|
471
|
+
for (const k of kids ?? []) {
|
|
472
|
+
if (!k?.id)
|
|
473
|
+
continue;
|
|
474
|
+
out.push({ id: k.id, parentID: k.parentID ?? rootID, title: k.title });
|
|
475
|
+
out.push(...(await childSessions(directory, k.id, depth - 1)));
|
|
476
|
+
}
|
|
477
|
+
return out;
|
|
478
|
+
}
|
|
402
479
|
/**
|
|
403
480
|
* Stored messages (GET /session/:id/message) -> the same shape the browser
|
|
404
481
|
* builds from live events, so a resumed chat renders like a live one.
|