فهرست منبع

docs: a consumer depends on _created_by naming the writing function, not the project

Flagged by novitax while checking whether the unauthenticated /fn exposure had
been used. They could distinguish a chat-mediated write from a direct
anonymous one only because _created_by reads fn:novitax/aliz-chat rather than
fn:novitax - a direct call to the request-taking function would read
fn:novitax/aliz-take-request. All 29 rows named the chat function, which is
what established nothing had exploited it.

So granularity we added as an event loop guard is the only after-the-fact
attribution available for an authentication gap. A refactor keeping the
project and dropping the function id would look lossless and would silently
remove it.

Also re-ranked SV-19 on their risk statement, which is better than mine. I had
it as cost and principle; take-request writes an arbitrary phone number into a
collection a human actions, so the harm is Novitax staff ringing a stranger.

And a measurement that corrects my own recommendation: I presented
throttle-plus-key as a package, but the throttle is nearly irrelevant to this
risk. On 0.13.0 the policy's 120/min is charged only on data access, so an
anonymous caller can create 120 callback rows a minute; after 0.16.0 the /fn
call is charged too and still permits 120 a minute. Where one row is the harm,
a volume ceiling is not a control. auth: 'key' is the load-bearing half, so
deploying 0.16.0 does not close this by itself - it makes the gate available.
fszontagh 1 ماه پیش
والد
کامیت
158d046f00
1فایلهای تغییر یافته به همراه1 افزوده شده و 0 حذف شده
  1. 1 0
      CLAUDE.md

+ 1 - 0
CLAUDE.md

@@ -169,6 +169,7 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
 - **Wall time has TWO ceilings** (`functions/wall_budget.hpp`): an HTTP one (~2 s, which `RunnerPool::readTimeoutSec` must exceed) and a JOB one, which is exempt because a queue-claimed run holds no socket. `RunService::run` takes the kind as a PARAMETER, never inferred from the descriptor, and defaults to Http - the narrow budget - so a caller that forgets is slow rather than dangerous. Precedence: `min(descriptor timeoutMs or default, project max or kind ceiling, hard ceiling)`, resolved by the pure `resolveWallBudget()`. **The project cap is per kind** (`{http, job}` on `PUT /projects/{p}/settings/functions`): one number could not express "10 s for routes, 60 s for jobs", so capping a project's routes also cut its cron work and the only safe setting was no cap. `FunctionView` carries BOTH and `RunService::run` selects, because `lookup()` does not know how a run was triggered. The engine's `JsLimits::wall_time_ms` is raised to the highest ceiling at construction, or the clamp inside `JsRuntime::run` would kill every job at the HTTP value.
 - **Job runs draw from their OWN pool lane.** A lease is held for a run's whole duration, every `ctx.fetch` included, so without a lane N slow jobs leave one runtime for every interactive route and the second overlapping HTTP run blocks until the read timeout fires - a 503 from a healthy runner. Worst-case memory is `(pool + job_pool) x memory_limit_bytes`, so the two lanes ADD.
 - **The database-event loop guard reads the event's actor** (client 2.12.0). Every write a function makes is stamped `fn:<project>/<id>:<depth>` via the `actor` parameter, and `Event::actor` carries it back - so provenance costs nothing and lives in the audit trail, NOT in a field inside user documents (which would travel into every export forever). A chain is refused past `events.max_depth` generations and logged at error.
+  **A CONSUMER NOW DEPENDS ON THAT STAMP AS A SECURITY ATTRIBUTION CHANNEL, WHICH IS NOT WHAT IT WAS BUILT FOR: `_created_by` MUST KEEP NAMING THE WRITING FUNCTION AND MUST NOT BE COLLAPSED TO THE PROJECT.** Flagged by novitax 2026-10-22, deliberately, as a dependency rather than left to be discovered by breaking it. Assessing whether the unauthenticated `/fn` exposure (SV-19) had been used, they could tell a chat-mediated write from a direct anonymous one ONLY because `_created_by` reads `fn:novitax/aliz-chat` rather than `fn:novitax`: a direct call to the request-taking function would read `fn:novitax/aliz-take-request` and be distinguishable. All 29 rows named the chat function, which is what established that nothing had exploited it. **Granularity we added for a loop guard turned out to be the only after-the-fact attribution available for an authentication gap**, so a refactor that kept the project and dropped the function id would look lossless and would silently remove it. Their discipline is worth copying too: they turned the finding into a one-command check and **proved its control fires** (an empty expected-writer set flags all 29 rows and exits 1), because "probably unused" written in a document decays into an assumption while a script does not.
 - **Delivery is at-least-once.** A claim that goes stale is reclaimed and the job runs again, so cron and db functions must be idempotent. `singleFlight` (default true for cron) skips a tick while the previous run is still going, which bounds stacking but is not exactly-once.
 - **`jobs.enabled` is OFF by default in the runner**, so a runner upgrade never starts draining a queue in a deployment whose server has no scheduler. On a host that wants cron it MUST be turned on, or the scheduler enqueues work nothing ever runs - the most confusing possible way for cron to look broken.
 - **Project files** are small named binary assets per project (`file_store.hpp`), so everything customer-specific - a logo, a signature image - is tenant DATA rather than something bundled into a function's source. **PROJECT ISOLATION IS OURS, NOT THE DATABASE'S:** the database namespaces files by `Client::Config::project`, this service runs ONE client configured for `default` (collections are qualified per call instead), and the file API has no per-call project argument - so every project's files share one database namespace and are separated only by the `related_id` we stamp and filter on. Every lookup must therefore filter on BOTH project and name, and nothing outside `file_store.cpp` may address a file by its database id. A bug there is a cross-tenant leak, not a mis-sorted list.