fix: pin DNS resolution against SSRF rebinding; enforce reviewer independence; bound caches and logs

- web.ts: outbound downloads resolve DNS once, validate the address, and
  connect to the validated IP directly, closing the DNS-rebinding TOCTOU
  window; malformed SearXNG result URLs are skipped instead of failing the
  whole search; web cache is bounded (evicts oldest past 500 entries).
- experiment.ts: reviewer must not be a descendant of the experiment author
  (tool-level lineage check on top of the author-id check); stdout/stderr
  buffers capped at 512 KB.
- Confirmed Pi's extension tool registry is per-extension-instance, so
  reload re-registration is safe; no change needed there.
- Adds a lineage-independence test (39 tests passing, tsc clean).
This commit is contained in:
Emil
2026-07-31 23:03:49 +03:00
parent 18b8a3247d
commit 4039f7c8f3
5 changed files with 83 additions and 14 deletions
+11
View File
@@ -15,6 +15,17 @@
- Full-text search now prefix-matches tokens (tolerates Russian/English
inflections without stemming) and safely handles punctuation and FTS5
metacharacters instead of throwing or returning false negatives.
- Hardened the web gateway against SSRF TOCTOU: outbound downloads now resolve
DNS once, validate the address, and connect to the validated IP directly
(pinned resolution), so DNS rebinding cannot redirect the connection to a
private target; malformed search results no longer break the whole query;
the web cache is bounded (oldest entries evicted past 500 files).
- Experiment review is now truly independent: the reviewer must not be a
descendant of the experiment author (in addition to not being the author).
- Experiment stdout/stderr are capped at 512 KB so runaway container output
cannot exhaust memory or disk.
- Verified that Pi's extension tool registry is per-extension-instance, so
reload re-registration is safe (no fix required).
## 0.1.1 — 2026-07-31