Skip to content

fix(platform): close the 2026-09-18 round-J API evaluation findings - #3410

Merged
larryro merged 4 commits into
mainfrom
fix/api-eval-2026-09-18-j
Sep 18, 2026
Merged

larryro merged 4 commits into
mainfrom
fix/api-eval-2026-09-18-j

Conversation

@larryro

@larryro larryro commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Reviews and re-confirms every finding in the round-J external API evaluation (v0.5.32, contract 1.14.0), then fixes the four S2 issues plus the worth-fixing S3/S4. Contract bumps to 1.15.0.

S2 — serious

  • Sentry trace headers leaked from the backend. The empty tracePropagationTargets from round I is correct and present, but the deployment env carries SENTRY_TRACES_SAMPLE_RATE (the CLI writes it, '0' by default), which turns span recording on and registers OpenTelemetry's request instrumentation. Its propagator derives the target URL from the active span; an unsampled span has none, so the empty list is never consulted and the headers go out on every outbound request. Fixed by registering the http and native-fetch integrations with spans: false, so it covers the whole backend, not just the crawler. Proved on the wire with the sample-rate env set.
  • The User-agent: TaleBot robots group was ignored. robots.txt is now parsed for the product token (named group over *, RFC 9309), with Allow longest-match precedence, $ end-anchors and Crawl-delay (capped 60s), honoured on every leg and by the create-time homepage probe.
  • A cross-scope webhook redelivery ran twice silently. A scope-free identity_hash (migration 0107) lets the accept path answer 409 AUTOMATION_DELIVERY_SCOPE_MISMATCH when a delivery crosses the organization/project boundary, while per-project fan-out still runs.
  • A third concurrent scan failed the whole scan. The render-session cap is now a wait: the link polls for a slot and defers the batch to its next continuation instead of ending in error with fetched content discarded.

S3 / S4

failureCode de-duplicated so openapi.json validates as OAS 3.0.3 (with a uniqueItems guard); MCP cancel_run answers RUN_NOT_FOUND for an unknown id; task-create 201 carries Location; host_not_allowed fetch kind for an off-site redirect; non-default port refused; website search total is a real match count; currency accepts any case; /openapi.json carries an ETag and answers 304; plus doc precision for the UTF-16 content cap and system:provisioning.

Verification

  • tsc --noEmit, oxlint --type-aware, oxfmt --check clean; the pre-commit SAST hook passed on every commit.
  • Server vitest: 8776 passed, 5 skipped, 0 failed. Websites UI: 39. lint:manual ok.
  • Migration 0107 proven on real Postgres (applies against the prior table, idempotent, column + index present).
  • backend:integration deferred to CI: it runs destructive probes and no isolated throwaway stack is available locally. The webhook and crawler lanes there cover the migration end to end.

`tracePropagationTargets: []` alone did not stop the leak: the deployment
env carries `SENTRY_TRACES_SAMPLE_RATE` (the CLI writes it, `'0'` by
default), which switches span recording on, and the SDK then registers
OpenTelemetry's http/undici instrumentation. Its propagator derives the
target URL from the active span; an unsampled span records none, so the
empty target list is never consulted and `sentry-trace`/`baggage` — the
release, public key and environment — go out on every request the backend
makes, the website crawler's fetches included.

Register the http and native-fetch integrations with `spans: false` so the
request lanes stay on the Sentry-native hooks, which honour the empty
target list. The wire test now runs with `SENTRY_TRACES_SAMPLE_RATE=0` and
adds a positive control proving the instrumentation is live.
The crawler read only the `*` robots group, so a site that followed our own
documentation and addressed `User-agent: TaleBot` to refuse or throttle the
crawler was crawled under everyone-else's rules. Parse robots.txt for the
product token (named group wins over `*`, RFC 9309), honour `Allow` with
longest-match precedence, `$` end-anchors and `Crawl-delay` (capped at 60s),
and carry the policy on the website row as an object. Both fetch legs pace to
the delay; the create-time homepage metadata probe now reads robots first and
identifies as TaleBot instead of a bare `node`.

Also from the same evaluation: a redirect off the registered site is a new
`host_not_allowed` fetch kind rather than the misleading `private_ip`; a
non-default port is refused, not silently dropped to :443; a fully-disallowed
site ends `error`, not `active` with zero pages; and a third concurrent scan
that meets the render-session cap waits for a slot and defers the batch to its
next link rather than failing the whole scan and discarding what it fetched.
`delivery_key` folds the requested project into its hash, so the same
delivery id at the organization door and at a project door produced two
ledger rows and two runs: an operator who moved an automation between
organization and project scope had the sender's redelivery run a second
time, silently, and the documented `409 AUTOMATION_DELIVERY_SCOPE_MISMATCH`
never fired.

Record a scope-free `identity_hash` beside the per-scope key (migration
0107, nullable and rolling-safe) and, on accept, refuse a live delivery that
first ran under the other side of the organization/project boundary. A
per-project fan-out stays legitimate: the same id still starts one run in
each installed project.
Bump the contract to 1.15.0 and make the published document honest to a
generated client again:

- de-duplicate `budget_exceeded` in the three `failureCode` enums, so
  `openapi.json` validates as OAS 3.0.3 and `openapi-python-client` no longer
  aborts, with a guard that every enum has unique items;
- declare the skills file download's conditional GET (`If-None-Match`,
  `If-Modified-Since`, 304, `ETag`/`Last-Modified`) the door already answers;
- name `host_not_allowed` in `WebsitePage.lastErrorKind`, accept any case in
  `Product.currency`, and describe `WebsiteSearchResults.total` as the match
  count, the chat content cap as UTF-16 units, and `system:provisioning` in
  `createdBy`;
- serve `/openapi.json` with an `ETag` and answer 304 to a matching
  `If-None-Match`.

MCP `cancel_run` on an unknown run now answers `RUN_NOT_FOUND` instead of
"already finished", and a task-create 201 carries `Location`.
@larryro
larryro merged commit 3c02b7b into main Sep 18, 2026
55 checks passed
@larryro
larryro deleted the fix/api-eval-2026-09-18-j branch September 18, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant