Repository navigation
Release 2.26.0: new tools, second opinion, coin alerts - #2134
Conversation
|
@strix-security review |
Strix Security ReviewTo fix before merging (2)
PR summary: Version 2.26.0 of Agent402: new paid tools (second-opinion, launch-check, licensed-media-search, coin-alert), a /weather page, BNB Chain payments, personal-use credits, a post-quantum receipt signature, a signed offer moved into the 402 body, hardened SQL guard and crawl options, plus nine page modules split out of src/server.js. Review summaryRelease 2.26.0 is a large but mostly hardening release: the money-path changes hold up under tracing (BNB Chain's 18-decimal amounts, the Lightning refund-claim proof, the post-quantum receipt signature and the personal-use credits gate are all correctly bound), and the fifty-odd module moves out of 11 resolved findings
Ruled out (10)
Review history (7)
Fixed the findings? re-run the review, or tag Review 7 on this PR · Reviewed by Strix |
| if (!key) throw bad(`${kind.many[0].toUpperCase()}${kind.many.slice(1)} are not configured on this server (no signing key), so nothing was registered.`, 503); | ||
| // The host is resolved and refused when it is not public (a 400 from the guard). | ||
| await checkUrl(target.url); | ||
| if (kind.prepare) fields = { ...fields, ...(await kind.prepare(fields)) }; |
There was a problem hiding this comment.
🟡 MEDIUM: Refused registrations still spend the shared CoinGecko read budget
TL;DR: Any API caller can exhaust the service-wide CoinGecko day budget by posting coin alerts that are refused, since each refused attempt still spends a price read and is never charged. store() runs the kind's prepare hook, which does the price read, before it checks the registrant's cap and the store's hard bound. Checking those refusals before prepare runs fixes it.
Cause, impact and fix
Cause: The generalized store() calls kind.prepare before its own refusals, so the coin-alert prepare hook reads prices for the control coin plus the requested coin, and then the registrant cap (409) or the store bound (503) is thrown inside the same handler with nothing given back. The guard on unpaid reads does not stop it because a listed coin id passes knownIdGate.
Impact: A single caller can spend the shared day budget with refused, uncharged requests, after which every CoinGecko-backed tool refuses and other buyers' coin alerts stop being checked until UTC midnight.
Fix: Check the registrant's cap and the store's hard bound before kind.prepare runs, so a registration the store will refuse never spends an upstream read first.
🟡 Refused coin-alert registrations spend the shared CoinGecko daily read budget for free
Severity: MEDIUM
TL;DR: The coin-alert prepare hook reads CoinGecko prices before store() checks the registrant's cap, so every refused 409 registration still spends one read from the service-wide day pool and is never charged.
Impact: Any API caller can spend the entire shared CoinGecko day budget with ~300 refused, uncharged requests, making every CoinGecko-backed paid tool refuse and stopping all coin-alert checks for other buyers until UTC midnight.
Root cause:
- The generalized store runs a kind's
preparehook before its own refusals, so a new kind can spend a paid upstream read on a registration the store then refuses without any settlement to pay for that read. - The registrant cap (409
own:true, line 488) and the store bound (503charged:false, line 496) are thrown inside the handler afterkind.preparealready calledread()forbitcoinplus the requested coin, and nothing gives the spent read back. - Nothing bounds a caller's repeated refused attempts: the 300-read day ceiling is the only stop, and the code's own bound on unpaid reads (the unsettled share, 30 per day and 8 places per caller per hour) does not apply because
knownIdGatereturns a listed coin id as confirmed and the price read proceeds.
Prompt to fix with AI
This is a security vulnerability found during a code review.
Vulnerability: Refused coin-alert registrations spend the shared CoinGecko daily read budget for free
Severity: MEDIUM
CWE: CWE-770
**TL;DR:** The coin-alert `prepare` hook reads CoinGecko prices before `store()` checks the registrant's cap, so every refused 409 registration still spends one read from the service-wide day pool and is never charged.
**Impact:** Any API caller can spend the entire shared CoinGecko day budget with ~300 refused, uncharged requests, making every CoinGecko-backed paid tool refuse and stopping all coin-alert checks for other buyers until UTC midnight.
**Root cause:**
- The generalized store runs a kind's `prepare` hook before its own refusals, so a new kind can spend a paid upstream read on a registration the store then refuses without any settlement to pay for that read.
- The registrant cap (409 `own:true`, line 488) and the store bound (503 `charged:false`, line 496) are thrown inside the handler after `kind.prepare` already called `read()` for `bitcoin` plus the requested coin, and nothing gives the spent read back.
- Nothing bounds a caller's repeated refused attempts: the 300-read day ceiling is the only stop, and the code's own bound on unpaid reads (the unsettled share, 30 per day and 8 places per caller per hour) does not apply because `knownIdGate` returns a listed coin id as confirmed and the price read proceeds.
Location: src/price-webhooks.js:465-465
Context: The prepare hook (and its source read) runs before the registrant cap and store bound are checked
```
// Before:
if (kind.prepare) fields = { ...fields, ...(await kind.prepare(fields)) };
// After:
// A registration the store is going to refuse must not spend a source read
// first: it is never settled, so nobody pays for that read and it comes out
// of the day every other caller shares.
const who0 = typeof registrant === "string" && registrant ? registrant : null;
const owner0 = who0 ? ownerDigest(key, who0) : null;
if (owner0) {
const held = await doc.read({ quiet: true });
const mine0 = held?.ok ? Object.values(bodyOf(held.body).subs).filter((s) => s.owner === owner0) : [];
const cap0 = maxPerRegistrant(env);
if (mine0.length >= cap0) throw bad(`This registrant already holds ${cap0} ${kind.many}, the most one may hold, so this one was not registered. Remove one first (POST ${kind.unsubscribePath}, free)${kind.renews ? ", or register a URL it already holds to renew that one" : ""}.`, 409, { own: true });
}
if (kind.prepare) fields = { ...fields, ...(await kind.prepare(fields)) };
```
Location: src/coin-alerts.js:102-111
Context: The price read is spent before the store's refusals, and the later 422s are also uncharged
How to fix:
Refuse a registration for the registrant's own cap (409) and for the store's hard bound (503) before any `kind.prepare` runs, so a registration that cannot be kept never spends an upstream read. Alternatively, make the registration's source read draw from the budget kept for calls nobody pays for (the unsettled share, `cgReserveUnconfirmed`) or give it its own per-caller daily read allowance, since a refused call is never settled and so no buyer funds that read.
Please fix this vulnerability. If you propose a fix, make it concise and minimal.React 👍 / 👎 to tune Strix for this repo. A repo collaborator (or the PR author) can resolve this thread to dismiss these findings.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
@strix-security review |
|
@strix-security review |
|
@strix-security review |
|
@strix-security review |
|
@strix-security review |
|
@strix-security review |
| }, | ||
| }, | ||
| }, | ||
| handler: (i) => launchCheck(i), |
There was a problem hiding this comment.
🔵 LOW: Launch check returns page-written text without the untrusted-content marker
TL;DR: A site owner can shape the buyer's tool-enabled agent with text in their own page title or meta tags, because the answer carries no sign that the text came from a stranger. Every other page-reading tool labels such text as data, but launch-check returns it as ordinary fields. Returning the answer through markUntrusted fixes it.
Cause, impact and fix
Cause: launchChecks copies the page's title, description, share-card and icon strings into each check's found field through a helper that only collapses whitespace and truncates, and the handler returns that object unchanged. The kit never imports the marker that its sibling page-reading kits apply, so a new kit opts out of the catalog's untrusted-content rule simply by not calling it.
Impact: A site owner can put instruction-shaped text in their own page title, description or links and it arrives in the buyer's agent unmarked, so the agent has no signal that acting on that text would be obeying a stranger.
Fix: Return the launch-check answer through markUntrusted so it carries untrustedContent: true, and extend the tool description, as extract and page-change do, to state that the page-derived found strings are external data and never instructions.
🔵 New `launch-check` tool returns a checked site's own title, description and link text without the `untrustedContent` marker
Severity: LOW
TL;DR: launch-check copies a checked site's title, meta description, og:title, icon/canonical href and robots.txt rule into its paid answer unmarked, while every other page-reading tool stamps untrustedContent: true.
Impact: A site owner can put instruction-shaped text in their page title or meta tags and it is delivered, unmarked, into the buyer's tool-enabled agent, which has no signal that this text comes from a stranger and carries no authority.
Root cause:
- The catalog's untrusted-content rule (R-14 in
src/tools/provenance.js, restated in the published agent skill: answers carrying third-party text are markeduntrustedContent: true) is applied per kit rather than by the registration layer, so a new kit silently opts out by not importingmarkUntrusted. launchCheckscopies page-written strings straight into the answer'sfoundfields throughshort(), which only collapses whitespace and truncates at 200 characters, and the tool's handler returns that object verbatim.- The surrounding catalog already treats page titles as third-party text:
crawl-kit.jsmarkssite-mapbecause it carries "page titles", andsummarize-kit.jsmarks its page path, so this is a skipped pattern rather than an accepted one.
Prompt to fix with AI
This is a security vulnerability found during a code review.
Vulnerability: New `launch-check` tool returns a checked site's own title, description and link text without the `untrustedContent` marker
Severity: LOW
CWE: CWE-829
**TL;DR:** `launch-check` copies a checked site's title, meta description, og:title, icon/canonical href and robots.txt rule into its paid answer unmarked, while every other page-reading tool stamps `untrustedContent: true`.
**Impact:** A site owner can put instruction-shaped text in their page title or meta tags and it is delivered, unmarked, into the buyer's tool-enabled agent, which has no signal that this text comes from a stranger and carries no authority.
**Root cause:**
- The catalog's untrusted-content rule (R-14 in `src/tools/provenance.js`, restated in the published agent skill: answers carrying third-party text are marked `untrustedContent: true`) is applied per kit rather than by the registration layer, so a new kit silently opts out by not importing `markUntrusted`.
- `launchChecks` copies page-written strings straight into the answer's `found` fields through `short()`, which only collapses whitespace and truncates at 200 characters, and the tool's handler returns that object verbatim.
- The surrounding catalog already treats page titles as third-party text: `crawl-kit.js` marks `site-map` because it carries "page titles", and `summarize-kit.js` marks its page path, so this is a skipped pattern rather than an accepted one.
Location: src/tools/launch-check-kit.js:200-200
Context: return the answer through markUntrusted
```
// Before:
handler: (i) => launchCheck(i),
// After:
handler: async (i) => markUntrusted(await launchCheck(i)),
```
Location: src/tools/launch-check-kit.js:22-22
Context: import the provenance helper
```
// Before:
import { registrableDomain } from "../operator-key.js";
// After:
import { registrableDomain } from "../operator-key.js";
import { markUntrusted } from "./provenance.js";
```
Location: src/tools/launch-check-kit.js:105-110
Context: site-written strings copied into `found`
```
const text = (id, value, fix) => add(id, false, page, () => verdict(Boolean(value()), short(value()) || "none", fix, "warn"));
text("title", () => page.data.title, "Add a title that says what the page is.");
text("description", () => page.data.meta.description, "Add a meta description.");
text("phone-layout", () => page.data.meta.viewport, "Add a viewport meta tag so phones lay the page out at their width.");
text("share-card", () => page.data.meta["og:title"] && page.data.meta["og:image"], "Add og:title and og:image so a shared link shows a card.");
text("icon", () => page.data.links.find((l) => l.rel.includes("icon") || l.rel.includes("apple-touch-icon"))?.href, "Declare an icon for browser tabs.");
```
How to fix:
Wrap the `launch-check` handler in `markUntrusted` (or call `relaysStrangersText` on `LAUNCH_CHECK_TOOLS`) so the answer carries `untrustedContent: true`, and extend the tool description, as `page-change` and `extract` do, to say the page-derived `found` strings are external data and never instructions.
Please fix this vulnerability. If you propose a fix, make it concise and minimal.React 👍 / 👎 to tune Strix for this repo. A repo collaborator (or the PR author) can resolve this thread to dismiss these findings.
Version 2.26.0. The changelog lists every change.
New tools
second-opinionasks several models one question and returns one answer that says where they disagreed.launch-checkreads a page before it goes live.licensed-media-searchfinds images whose license allows reuse.coin-alertsends one signed POST when a coin crosses a price you set.Changes
weather-windownames the weather limit that ruled out the most daylight hours.site-crawlcan read a site's sitemap pages first.sql-guardreads statements with PostgreSQL's own parser.Off until a server turns them on: credits for personal use by buyers in the US, the second, post-quantum signature on receipts, the Solana structure check, and BNB Chain payments.
Structure: nine page modules moved out of
src/server.jswith no change in behavior.