Review follow-up:
- formatTokens keeps one decimal and drops a trailing ".0" instead of
dropping the decimal from 10k up, so dashboard axis ticks keep their
.5 steps (12.5M, not 13M) and tooltips show 123.5k, not 123k. From
999,950 it switches to "M" so values never read "1000k".
- transcript.tsx: the UserRow doc comment sat above fmtBytes on main and
was removed with it; it is back above UserRow.
- src/lib/format.test.mjs covers the shared formatters under plain
`node --test` (the "@/i18n" import is stubbed with a fixed locale).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same helpers were copied across the frontend: fmtBytes / fmtSize /
formatArchiveBytes (10 copies, 5 behaviours), fmtTokens (7 copies, 3
behaviours), fmtTime / fmtDateTime (11 copies), fmtDuration and statusTone
(4 identical copies). They now live in one place:
- src/lib/format.ts: formatBytes, formatTokens, formatDurationMs,
formatShortDateTime (with seconds / year / empty options)
- src/lib/status.ts: httpStatusTone
Intentionally distinct formats stay local (ISO log timestamps, full-locale
finding date, the translated seconds-based task duration, unix task times).
Visible changes from using one canonical output each:
- sizes of 1 GiB and up show as GB instead of thousands of MB
- dashboard / intercept token counts show "25k" instead of "25.0k"
- LLM records show "2.5M" instead of "2500.0k"
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
First part of #5: the transport-agnostic bridge core, the Telegram
adapter, the mandatory chat allowlist, storage, API and settings page.
Task commands, main-agent routing and remote approvals follow in
separate PRs on top of this one.
- chatbridge: Transport interface and Router. The router enforces the
allowlist (an unknown chat gets one refusal naming its chat ID, then
silence, bounded memory), drops updates older than two minutes so a
backlog is never executed, ignores bot senders and commands addressed
to another bot, and dispatches commands (/help, /whoami for now).
- Telegram transport: getUpdates long polling (no inbound port),
plain-text sendMessage truncated to the Bot API limit, getMe for the
identity. It reuses notify's dial guard and redirect policy through
small exported wrappers, and its errors never carry the token.
- Storage: migration 0015 adds chat_bridges, one row per kind. config
is sealed at rest (added to secretColumns) and masked in the API with
the notification-channel convention. The update cursor is committed
before a batch is acted on, only moves forward, and is written only
for the config_version the poller read, so a poll of a replaced token
can never move the new bot's cursor. A token change clears it.
- Server: one loop per transport started by server.New; it re-reads its
row each round and Reload interrupts a poll in flight, so saving the
form applies without a restart. Exponential backoff on errors, honours
Telegram's retry_after, logs under [tgbot] without message text.
- API: GET /api/chat-bridges, PUT /api/chat-bridges/{kind},
POST /api/chat-bridges/{kind}/test. A bridge may run with an empty
allowlist: it then serves no chat and only sends the one-time refusal
naming the chat ID, which is how an operator finds the ID to add.
- Web: System -> Chat bot page with live status, zh-CN and tr strings.
- Docs: docs/chat-bridge.md; README lists the token among stored secrets.
The migration test lists 0015; the pre-0012 test rolls it back with the
others and it re-applies (the migration is idempotent).
Co-authored-by: krad <222954346+dar1k0@users.noreply.github.com>
Bug bounty programs write a domain and its subdomains as *.example.com.
ParseScopeLine rejected that line ("not recognizable as a valid
domain/IP/CIDR"), and the web scope editor rejected it before it reached
the server, so every wildcard line had to be rewritten by hand.
Drop a leading "*." label and store the line as the example.com domain
rule. Company and task scope match assets on their registrable domain, so
that rule already covers the subdomains. The wildcard is accepted only on
a registrable domain: *.api.example.com would store a rule that matches
nothing, so it is rejected along with *.co.uk and *.<IP>.
Step 1 of #519.
Reset the stream panel's filter and request state when the exchange changes.
Keep recording-limit warnings visible while reporting only actual messages
in the header, including first-page and warning-only counts.
Add message_total to the stream page without changing raw pagination totals
or existing Go paging signatures. Cover the count and pagination boundaries
in the stream and HTTP route tests.
The isolation self-test stopped every start it failed, so a non-root
server (the systemd unit), dev.sh, Windows and macOS no longer started
without -dev-insecure-no-isolation.
EnforceIsolation now decides from the platform and the privilege drop:
- self-test passed: isolated;
- Linux with the privilege drop on (root, the Docker image): a failure
stops the start, unless -dev-insecure-no-isolation is set;
- elsewhere (not Linux, not root, -exec-uid=-1): the server starts
degraded, without a flag.
A degraded start logs a banner with the self-test failure and what is
exposed, and GET /api/health reports the isolation status to a
signed-in caller; the web UI shows a red banner on every page while it
is degraded. The systemd deployment guide and dev.sh describe the mode.
logo.png was a 1920x1920 RGBA render (492 KB) used as a 40 px sidebar mark, a
160 px login mark, and the favicon. It was the single largest item on the page:
32% of the 1.55 MB asset budget, and incompressible, so it outweighed the entire
gzip saving from the caching work in #404.
- public/logo.png 1920 -> 512 (3x the largest 160 px display) 492 KB -> 71 KB
- public/logo.webp new, same 512 art 492 KB -> 28 KB
- app/icon.png 1920 -> 192 (favicon) 492 KB -> 17 KB
The three <img src=/logo.png> sites sit in a <picture> with a WebP source and the
PNG as fallback. The wrapper needs className="contents": <picture> is
display:block by default, so as a flex item it took over the image's layout slot
and — in the collapsed sidebar, whose button is size-8 with p-2 — the logo came
out at 3.5 px instead of the ~16 px it had. With display:contents the wrapper
generates no box and the <img> is the flex item again; measured in the built
export, an <img width=40> in that button is 16x16 px with the bare-img markup,
3.52x3.52 with a plain <picture> wrapper, and 16x16 with <picture
className="contents">. The login/setup marks measure 160x160 either way.
No component or CSS changes beyond the wrapper; the built CSS contains
.contents{display:contents}.
The open conversation was kept only in the URL (?c=<id>), but the
sidebar links to a bare /chat. Leaving the chat page and coming back
always landed on the empty draft view.
The selected conversation is now also stored in localStorage and
restored on mount when the URL names none. An explicit ?c= still wins.
Starting a new conversation or deleting the open one clears it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Findings with no live asset belong to a company only through their
task's company scope; unknown or non-numeric ids match nothing.
- Filter tasks by company on the server (GET /api/tasks?company=).
- Scope the grouped findings view, the asset tree and the stat cards.
- AND company_id outside the compiled asset DSL so OR cannot escape it.
- Add the 7 company switcher keys to tr.json and zh-CN.json.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BWbhPFZifkVU75uaD5NYj5
The panel had no way to scope it to one target. Companies exist as the
ownership layer, but only the task form offered one, so a second engagement
mixed into every list.
Sidebar header, under the logo: a company picker that defaults to
"All companies" and persists per browser. Every asset-backed view follows
it — findings (all three views plus the asset tree and export), the
dashboard's finding panels, the task list, the traffic list and the assets
tabs.
Server side the switch rides on the existing ownership column: findings and
traffic take a company, and the assets list takes company_id on both the
plain and the DSL path. Findings with no live asset anchor stay visible
under their company, because they belong to no other one; the strict
subtree filter would hide them from every view.
Tests: TestFindingCompanyScopeFilter (own assets, another company, a
company with none, a nonexistent id) and TestPageHostsAllowlist. Full
./db/ ./traffic/ ./server/ pass.
Co-Authored-By: Claude Code <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BWbhPDnkSEFNzBXG4wDvTj
Creating a task left the credential rows in the form, and the password
input was plain text. The rows are cleared after a successful create, and
the password field is masked.
Add rewritten and rewrite_rule_ids provenance columns to traffic_evidence_snapshots (migration 0008), enrich prepared snapshots from traffic.RewriteInfo outside the ReadEvidence callback, exclude both fields from TrafficSnapshotID so snapshot IDs remain compatible with older binaries, and display applied rule IDs in TrafficEvidenceViewer (with tr.json i18n entries).
Note: snapshots created before migration 0008 keep rewritten=false because InsertEvidenceSnapshotTx uses ON CONFLICT DO NOTHING and does not backfill provenance on existing rows; this is accepted and intentionally not backfilled here.