Selaa lähdekoodia

docs: record the over-correction shape - a false CONSTRAINT is a spec somebody may implement refs SV-48

fszontagh 6 päivää sitten
vanhempi
sitoutus
4a5de6a3b7
1 muutettua tiedostoa jossa 9 lisäystä ja 0 poistoa
  1. 9 0
      CLAUDE.md

+ 9 - 0
CLAUDE.md

@@ -213,6 +213,15 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
 - **A project can be denied the network outright, and ONE setting covers both outbound surfaces.** `network_egress` on `PUT /projects/{p}/settings/functions` (admin only, stored as `function_network_egress`) gates `ctx.fetch` AND `ctx.mail` through one `requireNetworkEgress()`, checked **before the SSRF classifier and before any resolution** - a denied project must not emit a DNS query either, since a lookup is an observable side effect and a channel of its own. Gating one surface and not the other would let an operator believe a tenant was offline while the other stayed open, and mail is the one carrying credentials. **It is NOT a `_network` pseudo-collection scope rule**: a scope rule answers "may this principal touch that data of ours", which is why `_files` is one, whereas reaching a third party the tenant already has credentials for is a capability rather than an access decision - and a pseudo-collection would put it in range of a `*` rule, exactly the widening that had to be fixed once already. **The default is ALLOW** (`kFunctionNetworkEgressDefault`, pinned by a test): `ctx.fetch` shipped ungated, so a default of deny would break every deployed function that fetches the moment the setting appeared, which is an outage caused by ADDING a control. The control that was missing is the ability to revoke. Note the runner needs its own test seam (`HostContextConfig::networkEgress`) rather than riding on `egressPolicy`, because that one means "there is no database to read" and a test setting it would skip the gate while appearing to exercise it.
 - **`ctx.fetch` egress goes through the SSRF guard** (`functions/net_guard.hpp`): fail closed on anything unparseable, and classify **every** address a name resolves to, not the first. A settings blocklist is **UNIONED** with the built-in defaults by `SsrfPolicy::fromSettings()`, never substituted for them - an operator adding one CIDR must not silently reopen loopback, RFC1918 and the metadata endpoint. `function_egress_allow_private` is the explicit opt-out and relaxes **only** `privateBlockedCidrs()`; 169.254.0.0/16, link-local, multicast, reserved space and the IPv6 spellings of an IPv4 destination (NAT64, 6to4, `::/96`) stay blocked whatever it is set to. Note the opt-out does expose loopback, where our own API listens.
 
+- **AN OVER-CORRECTION READS AS DILIGENCE AND INHERITS THE CREDIBILITY OF THE REAL ERROR IT IS FIXING, AND IT IS HARDER TO DOUBT THAN THE ORIGINAL MISTAKE WAS.** 2026-11-21, and it is a new shape for this file rather than another instance of the uncited claim. `api/llms.txt` carried "THE FUNCTION BUILDER ASSIGNS DOCUMENT IDS. A function CANNOT choose one" for a release. It is FALSE: `insert()` reads `payload.doc.id` and passes it as the document id (`runner/src/host_context.cpp:1851-1880`), in code whose `git log -L` bottoms out at `fc63a26`, the commit that created the runner - so the behaviour never changed and only the documentation moved.
+  **What produced it was a correction, not a guess.** A consumer had reported the capability absent after measuring the `_id` form and the option form; both measurements were right. I then wrote a retraction into a reference document without opening the implementing function, and corrected PAST the truth. The sentence read as the most trustworthy kind this file knows how to produce - a named retraction of a specific earlier error, with the earlier error genuinely real - which is exactly why nobody doubted it, me least of all.
+  **THE COST WAS NEARLY A CUSTOMER-FACING OUTAGE, AND BY A ROUTE THE USUAL FAILURE DOES NOT TAKE: NOT SOMEBODY ACTING ON THE WRONG SENTENCE, BUT SOMEBODY MAKING THE SERVER MATCH IT.** A consumer's live reviewer registration keys rows on a normalised e-mail address, which is how it guarantees one person is one row. A release "fixing" the server to agree with the doc would have locked out every new reviewer. **So a wrong line in an API reference is not only a thing callers believe - it is a specification somebody may implement**, which makes a false constraint more dangerous than a false capability. A false capability fails loudly the first time it is called; a false constraint waits to be enforced.
+  **The tell, for next time: a retraction is a claim, and the measurement that supports the retraction is NOT the one that supported the thing being retracted.** Three separate rules here would each have caught it - say so in the same sentence when a claim has no file or line behind it; if the upstream source of an error is also the source of its correction, the correction needs its own evidence; and `documentFrom()`'s `out.erase("id")` is a line I DID read and misread, because I went to it for the strip and not for the identity, which is this file's "a citation gets read for the clause it was fetched to support" in its purest form. The erase is there precisely BECAUSE the id was taken as the identity, and it reads at a glance as the id being thrown away.
+  **AND THE FIX OVER-CORRECTED TWICE MORE, IN THE SAME PARAGRAPH, INSIDE AN HOUR.** An independent re-verification against source - asked for by the owner, on the grounds that this area had already been wrong once - found that my correction claimed `.insert()` accepts `ifVersion` (it accepts `ttl_seconds` ONLY, and a test at `runner/tests/host_prelude_test.cpp:483` already pinned that refusal) and stated the 409 slug as absolute when `duplicate_id` depends on the server being 2.12.1 or newer. **A second pass over the same paragraph by the same reader is not an independent check**, however carefully it is done; the errors were found by someone reading the source without my conclusion in hand.
+  **WHAT IS WORTH KEEPING IS THE ASYMMETRY, WHICH IS A BETTER THING TO HAVE WRITTEN DOWN THAN EITHER VERSION OF THE LIMITATION. `id` IS HONOURED, `_id` IS SILENTLY IGNORED, AND THE IGNORED ONE STILL RETURNS `{id}` AND STILL REPORTS SUCCESS.** `documentFrom()` erases both from the stored body, so the two leave no distinguishable trace: one spelling becomes the row's name, the other vanishes. A non-string `id` is likewise unhonoured and still erased, so `{id: 123}` loses the field AND gets a server id; and `.store()` puts the id in the call object rather than in a document, where an id nested in `metadata` is discarded. That also explains the symptom the retraction was written over - a consumer's throttle admitting **six of six calls against a limit of three** - without the capability being absent at all: no collision, so the `AlreadyExists` branch is unreachable and every window row sits at `1`. The counter pattern taken from `client.hpp:567-570` was transplantable after all; what failed was the spelling.
+  **NOTHING PINNED ANY OF IT, WHICH IS WHY THE WRONG SENTENCE WAS UNFALSIFIABLE FROM INSIDE THE REPO.** No test reached the id branch, so the suite was equally consistent with both stories. `chosenInsertId()` is now a pure seam with tests falsified BOTH ways - implementing the documented-but-false behaviour turns the "honours" test red while the "ignores" test stays green, and honouring `_id` as a fallback does the reverse - so neither can be the vacuous one. The coverage boundary is written into the test file rather than implied: they pin the IDENTITY decision, not that the id reaches the database.
+  **A side finding worth not re-deriving: the existence oracle SV-43 weighed as the price of a change is LIVE and always was.** A function holding only the `insert` grant can learn whether a row exists at a chosen id by reading `duplicate_id` off a failed insert. Narrow - tenant code, in its own project, needing a guessable id - and it matters exactly where ids are meaningful, which on a collection keyed by e-mail address means an insert-only function can test whether a given person is registered. **A risk analysis of a proposed feature is worthless if nobody checks whether the feature already ships**, and it reads as rigorous either way; both parties deliberated in the future tense about a present capability.
+
 ## Mail surface (`ctx.mail`, IMAP + SMTP)
 
 - **Scope is IMAP read + SMTP send, deliberately.** No FTP, FTPS, POP3 or WebDAV/CalDAV. SFTP was dropped by the owner, which is what keeps vendoring to ONE upstream - SFTP needs libssh2, which is far less watched than curl while having had remotely reachable issues. **WebDAV is out because it is HTTP**, and curl's HTTP is compiled OUT: `ctx.fetch` is cpp-httplib with its own guard, its own pinning and its own outbound defaults, and two HTTP clients with two sets of defaults is exactly how the two drift. Re-enabling it also brings redirects back, which then need `CURLOPT_REDIR_PROTOCOLS_STR` set separately and `FOLLOWLOCATION` off.