Explorar el Código

docs: narrow the httplib long-path claim to what was observed

The commit said paths up to 2 MB answer 414. They do not: beyond about 16 KB
the client cannot deliver the request at all, so the 414 observation covers
roughly 10-16 KB and no further. The conclusion is unchanged - the 8192-byte
request-URI limit is enforced before routing in v0.46.0 too, so the regex
stack-overflow fix was never reachable here - but the evidence is now stated
as what was actually seen.

Also recorded: the first run of that test was measuring an unrelated service
that already held the port I picked, which is why the method now proves the
listener's identity (pid and served info.version) before trusting a result.
fszontagh hace 1 mes
padre
commit
e57b7268e1
Se han modificado 2 ficheros con 6 adiciones y 4 borrados
  1. 1 1
      CLAUDE.md
  2. 5 3
      cmake/Dependencies.cmake

+ 1 - 1
CLAUDE.md

@@ -113,7 +113,7 @@ docker run -d --name svapi-dev -p 8080:8080 -e SMARTBOTIC_VECTORAPI_KEY=dev svap
 - **QuickJS's job queue belongs to the `JSRuntime`, not the `JSContext`.** A fresh context per run is therefore *not* enough to isolate tenants: a run that times out mid-microtask leaves its jobs queued, and they would execute inside the next tenant's run. The core flushes them with the deadline forced into the past and marks the runtime `poisoned()` if anything survives; the pool destroys a poisoned runtime instead of leasing it out. An OOM poisons it too.
 - **`/etc/smartbotic-vectorapi` must stay mode 0751, not 0750.** The runner runs as its own user and needs `+x` to traverse the directory to `runner.json`; it still cannot list it, and the server's `0640` files stay unreadable to it. Both `server.postinst` and `runner.postinst` set it, and a server upgrade resetting it to `0750` breaks the runner on its **next restart** - a failure that surfaces weeks later with no obvious cause.
 - **Installing the runner does not enable functions.** `config.json` ships with no `functions.runners` endpoints, and the server disables the function routes when the list is empty (answering 503). An operator has to add the endpoint by hand, and set the same `SVAPI_RUNNER_TOKEN` in both `vectorapi.env` and `runner.env`.
-- **cpp-httplib is pinned (`cmake/Dependencies.cmake`) and the pin carries its reasoning.** Currently v0.59.0. Check for an upgrade periodically: it serves the public HTTP surface AND every outbound call, upstream ships security fixes most releases, and we were 17 releases behind before anyone looked. When evaluating one, judge each fix against **what this service actually reaches** rather than the changelog's severity - `CPPHTTPLIB_REQUEST_URI_MAX_LENGTH` (8192, enforced before routing) means a long-path attack answers 414 and never reaches the regex matcher, so the headline regex stack-overflow fix was never our exposure, while the request-PARSING fixes (chunked transfer-coding matching, Content-Length truncation, chunk-size control characters) are. Deliberately NOT on the newest release when its fixes are for backends or features we do not use.
+- **cpp-httplib is pinned (`cmake/Dependencies.cmake`) and the pin carries its reasoning.** Currently v0.59.0. Check for an upgrade periodically: it serves the public HTTP surface AND every outbound call, upstream ships security fixes most releases, and we were 17 releases behind before anyone looked. When evaluating one, judge each fix against **what this service actually reaches** rather than the changelog's severity - `CPPHTTPLIB_REQUEST_URI_MAX_LENGTH` (8192, enforced before routing) means a long-path attack answers 414 before routing and never reaches the regex matcher, so the headline regex stack-overflow fix was never our exposure (verified against a running server, after first proving which process held the port - an earlier run of this test hit an unrelated service listening on the port I had picked), while the request-PARSING fixes (chunked transfer-coding matching, Content-Length truncation, chunk-size control characters) are. Deliberately NOT on the newest release when its fixes are for backends or features we do not use.
 - **Monaco** is bundled locally (`webui/src/monacoSetup.ts`) so the editor works offline - do not revert to the CDN loader.
 - systemd unit is `Type=notify`; the binary must be built with `libsystemd` (it is, when `libsystemd-dev` is present) or change to `Type=exec`.
 

+ 5 - 3
cmake/Dependencies.cmake

@@ -24,9 +24,11 @@ set(HTTPLIB_USE_OPENSSL_IF_AVAILABLE ON CACHE BOOL "" FORCE)
 # v0.53.1's stack overflow in RegexMatcher::match() is real but was never
 # reachable here. CPPHTTPLIB_REQUEST_URI_MAX_LENGTH is 8192 in v0.46.0 too and
 # is enforced BEFORE routing, so a path long enough to overflow the stack is
-# answered 414 and never reaches the matcher. Measured on both versions rather
-# than taken from the changelog: escalating paths up to 2 MB against /fn/ get
-# 414 and the server stays up.
+# answered 414 and never reaches the matcher. Checked in both headers rather
+# than taken from the changelog, and confirmed against a running server whose
+# identity was verified first: a ~4 KB path on /fn/ routes normally, ~10 KB and
+# ~16 KB are refused 414 before routing, and beyond that the client cannot
+# deliver the request at all. The server stayed up throughout.
 #
 # Other fixes in the range apply to code paths this project does not use -
 # multipart SENDING, chunked response trailers, WebSockets, Mbed TLS - so they