Follow-up to a full security review by Gemini 4 Neon
This branch remediates every finding from the pre-1.0 security review of Regent — 3 High, 9 Medium, 7 Low and 3 Info — in three phases, one commit per finding. Full detail in ~/.opencode/plan/regent-security-{review,phase1,phase2,phase3}-*.md.
Phase 1 — blockers: H1 replay/dedup for ephemeral kind:24133; H2 WYSIWYS (disclosure banners, created_at, strict parsing, full-message view); H3 pre-decode image dimension gate + no pre-consent texture cache; M1 authorization TOCTOU around unlock/rebind; M2 SSRF hardening of the single HTTPS path; M4 unconditional single-instance lock.
Phase 2 — strongly recommended: M3 client-relay validation, cap, display and arrival-relay response scoping; M5 CLOCK_BOOTTIME auto-lock plus suspend/screen-lock hooks; M6 live shared auto-approval limit; M7 control/bidi sanitization of every client string; M8 silent drops for strangers and bounded-concurrency dispatch; M9 serialized vault mutations with unique temp files.
Phase 3 — polish/hardening: L1 pairing-secret rotation on each new pairing + constant-time compare; L2 export/import hygiene + clipboard expiry; L3 the unlocked vault as the documented authorisation for change/export; L4 pairing dialogs serialized through the approval queue; L5 passphrase-file hardening + GUI secret buffers; L6 private (0700) directories; L7 pre-decode bound for inline data URLs; I1 --pair - from stdin; I2 NIP-04 legacy banner; I3 hygiene batch (schema text, bunker_uri encoding, Vault.version guard, portal reply type, clippy -D warnings, CI).
Verification
cargo test --locked: 163 passed, 0 failed, 9 ignored.
cargo deny check: clean — and it caught a real advisory, see CI below.
dbus-run-session -- build-aux/acceptance.sh: all checks passed.
Ignored nak_* suite: 9 passed, 0 failed.
CI: green on both the push and pull-request runs.
Dependencies added: subtle (L1), tempfile (M9), libc (M5, the tree's one unsafe). New files: src/instance.rs, src/sanitize.rs, deny.toml, .gitea/workflows/ci.yaml, build-aux/ci/Dockerfile, build-aux/ci/build-image.sh.
CI
.gitea/workflows/ci.yaml runs cargo test --locked, cargo clippy --all-targets --locked -- -D warnings and cargo deny check on every push and pull request. It runs on a repository-level regent-ci runner on the build host, whose label points at a custom image, gitea.kosmos.org/raucao/regent-ci:latest, built from build-aux/ci/Dockerfile by build-aux/ci/build-image.sh. The image is Arch-based and bakes in the GTK/libadwaita development headers, a rustup-pinned Rust 1.99.1 and the cargo-deny static binary, so a job installs nothing at run time.
Arch is a requirement here, not a preference: Regent's v4_24/v1_10 crate features ask for GTK ≥ 4.23 / libadwaita ≥ 1.10, which is newer than the latest stable GNOME release (GNOME 50 ships GTK 4.22 / libadwaita 1.9). The first CI run failed compiling gdk4-sys against the runner's ubuntu-latest image (GTK 4.22.4), and the GNOME OS SDK image fails the same way.
cargo deny check now runs for real, and it earned its place: it found RUSTSEC-2026-0592 (unbounded recursion in url's Url::origin() on nested blob: URLs, reached through nostr-sdk/reqwest/tower-http), fixed by bumping url 2.5.8 → 2.5.9 (and form_urlencoded to 1.2.3).
Decisions and residuals
M8 reconciles the responder with the invariant already documented in AGENTS.md ("no answer to anything except connect"): a stranger's non-connect method and a wrong/absent connect secret are now dropped silently, so error replies cannot serve as a presence oracle. Dispatch is bounded-concurrent (16) while the approval drain still serializes dialogs.
L3 deliberately keeps the unlocked vault as the control; changing the passphrase and exporting a key require an open vault and no re-entry of the current passphrase. Recorded as an accepted tradeoff, not an oversight.
L1 rotates the pairing secret on every new pairing; already-approved apps keep reconnecting via the "ack" path, so nothing paired breaks.
I3 does not add a device-key rotation action (rotating breaks every existing pairing; the recovery path is removing the device entry by hand).
M2's mandatory .no_proxy() breaks icon/NIP-05 fetches behind a proxy that requires one (fail-soft; documented).
H1 dedup is in-memory only, and L4 queues multiple URIs from one open signal rather than discarding all but the first (safe, undeduplicated).
*Follow-up to a full security review by Gemini 4 Neon*
This branch remediates every finding from the pre-1.0 security review of Regent — 3 High, 9 Medium, 7 Low and 3 Info — in three phases, one commit per finding. Full detail in `~/.opencode/plan/regent-security-{review,phase1,phase2,phase3}-*.md`.
**Phase 1 — blockers:** H1 replay/dedup for ephemeral `kind:24133`; H2 WYSIWYS (disclosure banners, `created_at`, strict parsing, full-message view); H3 pre-decode image dimension gate + no pre-consent texture cache; M1 authorization TOCTOU around unlock/rebind; M2 SSRF hardening of the single HTTPS path; M4 unconditional single-instance lock.
**Phase 2 — strongly recommended:** M3 client-relay validation, cap, display and arrival-relay response scoping; M5 `CLOCK_BOOTTIME` auto-lock plus suspend/screen-lock hooks; M6 live shared auto-approval limit; M7 control/bidi sanitization of every client string; M8 silent drops for strangers and bounded-concurrency dispatch; M9 serialized vault mutations with unique temp files.
**Phase 3 — polish/hardening:** L1 pairing-secret rotation on each new pairing + constant-time compare; L2 export/import hygiene + clipboard expiry; L3 the unlocked vault as the documented authorisation for change/export; L4 pairing dialogs serialized through the approval queue; L5 passphrase-file hardening + GUI secret buffers; L6 private (0700) directories; L7 pre-decode bound for inline data URLs; I1 `--pair -` from stdin; I2 NIP-04 legacy banner; I3 hygiene batch (schema text, `bunker_uri` encoding, `Vault.version` guard, portal reply type, clippy `-D warnings`, CI).
## Verification
- `cargo test --locked`: 163 passed, 0 failed, 9 ignored.
- `cargo clippy --all-targets --locked -- -D warnings`: clean.
- `cargo deny check`: clean — and it caught a real advisory, see CI below.
- `dbus-run-session -- build-aux/acceptance.sh`: all checks passed.
- Ignored `nak_*` suite: 9 passed, 0 failed.
- CI: green on both the push and pull-request runs.
Dependencies added: `subtle` (L1), `tempfile` (M9), `libc` (M5, the tree's one `unsafe`). New files: `src/instance.rs`, `src/sanitize.rs`, `deny.toml`, `.gitea/workflows/ci.yaml`, `build-aux/ci/Dockerfile`, `build-aux/ci/build-image.sh`.
## CI
`.gitea/workflows/ci.yaml` runs `cargo test --locked`, `cargo clippy --all-targets --locked -- -D warnings` and `cargo deny check` on every push and pull request. It runs on a repository-level `regent-ci` runner on the build host, whose label points at a custom image, `gitea.kosmos.org/raucao/regent-ci:latest`, built from `build-aux/ci/Dockerfile` by `build-aux/ci/build-image.sh`. The image is Arch-based and bakes in the GTK/libadwaita development headers, a rustup-pinned Rust 1.99.1 and the cargo-deny static binary, so a job installs nothing at run time.
Arch is a requirement here, not a preference: Regent's `v4_24`/`v1_10` crate features ask for GTK ≥ 4.23 / libadwaita ≥ 1.10, which is newer than the latest stable GNOME release (GNOME 50 ships GTK 4.22 / libadwaita 1.9). The first CI run failed compiling `gdk4-sys` against the runner's `ubuntu-latest` image (GTK 4.22.4), and the GNOME OS SDK image fails the same way.
`cargo deny check` now runs for real, and it earned its place: it found **RUSTSEC-2026-0592** (unbounded recursion in `url`'s `Url::origin()` on nested `blob:` URLs, reached through `nostr-sdk`/`reqwest`/`tower-http`), fixed by bumping `url` 2.5.8 → 2.5.9 (and `form_urlencoded` to 1.2.3).
## Decisions and residuals
- **M8** reconciles the responder with the invariant already documented in `AGENTS.md` ("no answer to anything except `connect`"): a stranger's non-`connect` method and a wrong/absent `connect` secret are now dropped silently, so error replies cannot serve as a presence oracle. Dispatch is bounded-concurrent (16) while the approval drain still serializes dialogs.
- **L3** deliberately keeps the unlocked vault as the control; changing the passphrase and exporting a key require an open vault and **no** re-entry of the current passphrase. Recorded as an accepted tradeoff, not an oversight.
- **L1** rotates the pairing secret on every **new** pairing; already-approved apps keep reconnecting via the `"ack"` path, so nothing paired breaks.
- **I3** does **not** add a device-key rotation action (rotating breaks every existing pairing; the recovery path is removing the `device` entry by hand).
- **M2**'s mandatory `.no_proxy()` breaks icon/NIP-05 fetches behind a proxy that requires one (fail-soft; documented).
- H1 dedup is in-memory only, and L4 queues multiple URIs from one `open` signal rather than discarding all but the first (safe, undeduplicated).
kind:24133 is ephemeral, so every relay delivery of a captured request reached the responder again. A ReplayGuard in the responder loop now drops an event whose created_at is outside a 120 s window (or predates this run) and any event id already seen.
The dialog now shows the client-requested created_at and warns (adw::Banner) when content, tags, tag values or an encrypt message exceed what it can show, and offers the full encrypt message. incoming() rejects a malformed kind/content/tags instead of coercing them.
decode() reads the container header and refuses anything over 1024x1024 before gdk::Texture::from_bytes allocates it; preview_icon no longer caches a pre-consent texture.
gate() no longer writes apps.json; authorize_inner re-checks the app's identity (and its stored permission) after the last await and only then stores 'always', so a revoke or rebind during a prompt denies.
The single HTTPS fetch now sets no_proxy, rejects URL userinfo on every hop, and allow-lists IPv6 to 2000::/3 minus the special ranges; IPv4 rejects all of 0.0.0.0/8.
Both the GUI (in startup) and headless take an unconditional flock on regent.lock (0600); a refused instance short-circuits activate/open so it cannot pair.
The ubuntu-latest runner image ships GTK 4.22, which cannot satisfy the
crate's v4_24/v1_10 features (they want GTK >= 4.23 / libadwaita >= 1.10,
newer than the latest stable GNOME release), so the first CI run failed
compiling gdk4-sys. The GNOME OS SDK is no better.
Build a regent-ci image (build-aux/ci/) from Arch with the GTK/libadwaita
headers, a rustup-pinned toolchain and the static cargo-deny binary baked
in, register a repo-level runner with the matching label, and drop the
apt/rustup/install-action steps.
Bump url to 2.5.9 (RUSTSEC-2026-0592), which the cargo-deny step would
otherwise fail on.
The cache only works when the job container shares the host network (a
bridge job cannot reach the runner's cache server through a host
firewall); record that, force_pull and node_download so the runner can be
rebuilt without rediscovering them.
raucao
changed title from Pre-1.0 security review: remediate all findings (H1–H3, M1–M9, L1–L7, I1–I3) to Pre-1.0 security review: remediate all findings2026-11-30 08:19:29 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Follow-up to a full security review by Gemini 4 Neon
This branch remediates every finding from the pre-1.0 security review of Regent — 3 High, 9 Medium, 7 Low and 3 Info — in three phases, one commit per finding. Full detail in
~/.opencode/plan/regent-security-{review,phase1,phase2,phase3}-*.md.Phase 1 — blockers: H1 replay/dedup for ephemeral
kind:24133; H2 WYSIWYS (disclosure banners,created_at, strict parsing, full-message view); H3 pre-decode image dimension gate + no pre-consent texture cache; M1 authorization TOCTOU around unlock/rebind; M2 SSRF hardening of the single HTTPS path; M4 unconditional single-instance lock.Phase 2 — strongly recommended: M3 client-relay validation, cap, display and arrival-relay response scoping; M5
CLOCK_BOOTTIMEauto-lock plus suspend/screen-lock hooks; M6 live shared auto-approval limit; M7 control/bidi sanitization of every client string; M8 silent drops for strangers and bounded-concurrency dispatch; M9 serialized vault mutations with unique temp files.Phase 3 — polish/hardening: L1 pairing-secret rotation on each new pairing + constant-time compare; L2 export/import hygiene + clipboard expiry; L3 the unlocked vault as the documented authorisation for change/export; L4 pairing dialogs serialized through the approval queue; L5 passphrase-file hardening + GUI secret buffers; L6 private (0700) directories; L7 pre-decode bound for inline data URLs; I1
--pair -from stdin; I2 NIP-04 legacy banner; I3 hygiene batch (schema text,bunker_uriencoding,Vault.versionguard, portal reply type, clippy-D warnings, CI).Verification
cargo test --locked: 163 passed, 0 failed, 9 ignored.cargo clippy --all-targets --locked -- -D warnings: clean.cargo deny check: clean — and it caught a real advisory, see CI below.dbus-run-session -- build-aux/acceptance.sh: all checks passed.nak_*suite: 9 passed, 0 failed.Dependencies added:
subtle(L1),tempfile(M9),libc(M5, the tree's oneunsafe). New files:src/instance.rs,src/sanitize.rs,deny.toml,.gitea/workflows/ci.yaml,build-aux/ci/Dockerfile,build-aux/ci/build-image.sh.CI
.gitea/workflows/ci.yamlrunscargo test --locked,cargo clippy --all-targets --locked -- -D warningsandcargo deny checkon every push and pull request. It runs on a repository-levelregent-cirunner on the build host, whose label points at a custom image,gitea.kosmos.org/raucao/regent-ci:latest, built frombuild-aux/ci/Dockerfilebybuild-aux/ci/build-image.sh. The image is Arch-based and bakes in the GTK/libadwaita development headers, a rustup-pinned Rust 1.99.1 and the cargo-deny static binary, so a job installs nothing at run time.Arch is a requirement here, not a preference: Regent's
v4_24/v1_10crate features ask for GTK ≥ 4.23 / libadwaita ≥ 1.10, which is newer than the latest stable GNOME release (GNOME 50 ships GTK 4.22 / libadwaita 1.9). The first CI run failed compilinggdk4-sysagainst the runner'subuntu-latestimage (GTK 4.22.4), and the GNOME OS SDK image fails the same way.cargo deny checknow runs for real, and it earned its place: it found RUSTSEC-2026-0592 (unbounded recursion inurl'sUrl::origin()on nestedblob:URLs, reached throughnostr-sdk/reqwest/tower-http), fixed by bumpingurl2.5.8 → 2.5.9 (andform_urlencodedto 1.2.3).Decisions and residuals
AGENTS.md("no answer to anything exceptconnect"): a stranger's non-connectmethod and a wrong/absentconnectsecret are now dropped silently, so error replies cannot serve as a presence oracle. Dispatch is bounded-concurrent (16) while the approval drain still serializes dialogs."ack"path, so nothing paired breaks.deviceentry by hand)..no_proxy()breaks icon/NIP-05 fetches behind a proxy that requires one (fail-soft; documented).opensignal rather than discarding all but the first (safe, undeduplicated).Pre-1.0 security review: remediate all findings (H1–H3, M1–M9, L1–L7, I1–I3)to Pre-1.0 security review: remediate all findings