|
|
@@ -169,6 +169,10 @@ 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.
|
|
|
+ **AND `_created_by` IS ADVISORY RATHER THAN AUTHORITATIVE BEFORE DATABASE 2.20.2: AN UPSERT AT AN EVICTED ID RE-STAMPED IT AS IF THE ROW WERE NEW, SINCE 2.12.1.** Told to us by the database owner 2026-10-22 while describing the ghost-document fix, as a second bug found alongside it: at an id absent from MemoryStore the upsert answered `isNew = true`, stamped `createdBy` as if new, and re-encrypted unchanged sensitive fields - and **eviction is an ordinary occurrence, not a pathology like a ghost**. So on any version from 2.12.1 to 2.20.1 the field's real meaning is **"the creator, OR the most recent upserter after an eviction"**, and a collection written by more than one actor across an eviction may carry historical mis-attribution on disk.
|
|
|
+ **This matters precisely because of the consumer dependency recorded below, and the two facts arrived from opposite directions within an hour.** A consumer had just told us they rely on that field to distinguish a chat-mediated write from a direct anonymous one; the database owner then told us the field could have been overwritten by a later writer. Neither party could have seen both halves. Relayed to both rather than left to collide later.
|
|
|
+ **We are immune and it is worth knowing why, because the reason is also why it survived four years of releases: nothing of ours ever READS `_created_by`.** It appears in `dbMetadataFields()` as a name to STRIP from write bodies and nowhere else. We upsert heavily across the whole control plane - `key_store` x4, `settings_store` x3, `function_registry` x3, the run log, the job queue, both registries - so we exercised the bug constantly and could not observe it. A defect in a field everyone writes and nobody reads is invisible by construction.
|
|
|
+ **`isNew` is also safe for us, re-verified rather than asserted when the change was announced:** exactly two call sites destructure the returned pair, `collection_registry.cpp:42` and `function_jobs.cpp:132`, and both discard the flag. That is the whole of our exposure to a semantic the database has now corrected in both directions.
|
|
|
**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.
|