Skip to content

curl: ask for brotli again where the decoder is pinned (#2211) - #2906

Merged
zackees merged 4 commits into
masterfrom
infra/2211-restore-brotli
Oct 29, 2026
Merged

zackees merged 4 commits into
masterfrom
infra/2211-restore-brotli

Conversation

@zackees

@zackees zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member

Fixes #2211.

What changed

obs_curl_accept_encoding() no longer unconditionally pins Accept-Encoding: gzip, deflate. It returns curl's "" — every coding the linked libcurl decodes, br included — on the platforms whose Brotli this repo pins or does not link, and keeps the stop-gap only where the decoder is not ours to know.

Build libcurl's Brotli Value now
AppImage (manylinux image, deps.lock.json) bundled 1.2.1 (past the 1.0.3–1.2.0 range of CVE-2026-111497) "" → br advertised
Windows package no Brotli import at all "" → no br possible
Apple frontend the OS /usr/lib/libcurl.4.dylib, version not pinned or measured here gzip, deflate (or identity when that libcurl has no zlib)

The three call sites already share the header (shared/file-updater/file-updater/curl-accept-encoding.h, #2213), so this is the header plus its tests. The split is obs_curl_accept_encoding_for(info, macos_libcurl), which lets both branches be unit-tested from a Linux runner; obs_curl_accept_encoding() passes the platform constant.

The other rule from #2453 survives untouched: a libcurl without zlib is never asked for gzip. "" cannot break it — curl advertises only what it was built with — but the Apple branch keeps the explicit identity because that path still names codings by hand.

RED

54a308c65 — test(curl): expect brotli on outgoing calls again (#2211). The two cases in test/cmocka/test_curl_accept_encoding.c and the wire assertion in test/cmocka/test_file_updater_failure.c expect "" / br on a non-Apple build; against the old helper they fail, because it returns gzip, deflate there.

Replayed here without libcurl headers on the host (the shim is <curl/curl.h> with just features, so the header logic compiles and runs):

--- master header, non-Apple ---
zlib + brotli                      -> "gzip, deflate"     <- the wire test's br assertion fails
brotli, no zlib                    -> "identity"
NULL info                          -> "identity"

GREEN

301ff6f50 — curl: ask for brotli again where the decoder is pinned (#2211):

--- this branch, non-Apple ---
zlib + brotli            macos=0 -> ""
brotli, no zlib          macos=0 -> ""
NULL info                macos=0 -> ""
default path: ""

--- this branch, simulated Apple (-D__APPLE__) ---
zlib + brotli            macos=1 -> "gzip, deflate"
brotli, no zlib          macos=1 -> "identity"
NULL info                macos=1 -> "identity"
default path: "gzip, deflate"

clang-format --dry-run --Werror is clean on the three touched C files.

Tests

  • test_curl_accept_encoding — pinned_brotli_asks_for_every_coding, this_platform_asks_for_every_coding (non-Apple), apple_libcurl_keeps_the_stop_gap, no_zlib_without_a_pinned_brotli_asks_for_identity; this_platform_gets_its_coding asserts the value the call sites actually get on the platform the binary was built for.
  • test_file_updater_failure — the wire assertion now reads the linked libcurl's features: br must be offered when this libcurl has Brotli, must not be when it does not, and must never be offered on Apple.

Both run in the Linux Tier 2 lane; the Apple branch of the header is exercised by -D__APPLE__ only in review, since this checkout cannot build for macOS.

Left open, filed as its own issue

The Apple carve-out needs an expiry date: someone with a Mac has to record the system libcurl's Brotli version and the VERSION feature list. I will file that as a follow-up and link it here rather than leaving the carve-out undocumented.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Follow-up filed as #2907 (record the macOS system libcurl's Brotli version, with the acceptance being either dropping the Apple branch or keeping it as the record). The docs/features.md ledger line is in as 9880b0682.

CI: waiting on the PR run; the two cmocka binaries are in the Linux Tier 2 set.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

The first push failed Format 🔍 / checks on test_platform_ifdef_ratchet.py: a host #if defined(__APPLE__) in shared C is exactly what #847 forbids, even when the branch is a build fact. Fixed in 66819ccaf — the Apple half is a build definition now (OS_MACOS adds OBS_CURL_ACCEPT_ENCODING_UNPINNED_BROTLI=1, the header defaults it to 0), so no host conditional remains. Locally: uv run python -m unittest ci/test_platform_ifdef_ratchet.py in ci/ is 38/38 OK, gersemi -c is clean on CMakeLists.txt, clang-format --dry-run --Werror clean on the three C files, and the probe reproduces both branches.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

CI on 66819ccaf: Format 🔍 / checks now passes (the ratchet fix), and test_curl_accept_encoding ran green on both lanes that matter — Linux Tier 2 tests ON 482/602 Passed, Windows 327-test run #16 Passed.

The Windows lane's one red is test_core_setup_rules_steps (test_reset_audio_ticks, obs_free_audio destroying mutexes obs_init_audio never created) — #2910, already being fixed by #2911. Nothing in this PR touches audio; I'll keep it a draft and queue it when that lands so the gate is green.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Rebased onto afeacf4c7 (only #2904, a test-only commit) and pushed as b6704321e; ./lint is green locally (== lane lint: ok).

The single red is the Windows lane, and it is not this diff. Build 🧱 / Rust Tier 2 (windows-2025-vs2026) fails in test_core_setup_rules_steps (the characterization test from #2881) with Test failed with exception: (11) in test_reset_audio_ticks, test_monitoring_device and GROUP TEARDOWN, identically on the pre-rebase run 40875411169 and on 40877717318 at the new head. The crashing binary compiles nothing this PR touches (the diff is CMakeLists.txt, docs/features.md, shared/file-updater/…, plus two test/cmocka curl tests), and the lane is only selected because of the CMakeLists.txt edit, so this is the first time it has run since #2881 landed.

Filed as a P0 with the run/job ids, the passing steps group and the failing callers group: #2912.

Everything else is green: Validate Data, Format 🔍 / checks, CI Mode, Event Data, Fast Gate ⚡, Rust Tests 🦀 (macOS + Windows), Rust Tier 2 Linux 🐧 (all six jobs). Rust Tier 2 (macos-26) is still running.

So: this PR is waiting on #2912, not on its own code. Not marking ready / enabling auto-merge while a required lane is red; the rebase + stamp happen once the Windows lane is green.

@zackees
zackees force-pushed the infra/2211-restore-brotli branch from b670432 to 84b7ea7 Compare October 29, 2026 13:54
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Rebased onto 691a9fbdd and pushed 84b7ea78a, now that #2911 (the audio-mutex fix) has merged — that was the only red left on this PR's Windows lane. The PR run should be green on this head; I'll queue it when it is.

RED: the shared helper still returns "gzip, deflate" on every platform, so
the two cases here and the wire assertion in test_file_updater_failure fail
with the calls not advertising br while the linked Brotli is one this repo
pins (the AppImage's 1.2.1, and Windows links none at all).
GREEN: obs_curl_accept_encoding_for() returns curl's "" (every coding the
linked libcurl decodes) on every platform whose Brotli this repo pins or does
not link -- the AppImage's 1.2.1, and Windows, which links none -- and keeps
gzip/deflate on the Apple frontend, whose OS libcurl carries an unpinned
Brotli. The stop-gap's other rule survives: no gzip on a libcurl without zlib
(#2453).
…al (#2211)

The platform-ifdef ratchet (#847) rejects a host #if in shared C, so the
Apple half of obs_curl_accept_encoding() is a build definition now:
OS_MACOS adds OBS_CURL_ACCEPT_ENCODING_UNPINNED_BROTLI=1 and the header
defaults it to 0. uv run python -m unittest ci/test_platform_ifdef_ratchet.py
is 38/38 OK and gersemi -c is clean on CMakeLists.txt.
@zackees
zackees force-pushed the infra/2211-restore-brotli branch from 84b7ea7 to 5c1f1e6 Compare October 29, 2026 14:18
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Rebased onto master 691a9fbdd and pushed 5c1f1e6ea; ./lint clean (== lane lint: ok).

The Windows Tier 2 red this PR was waiting on is fixed on master: #2910 → #2911 (a32bad067) made obs_free_audio() only destroy the mutexes obs_init_audio() created, and the dispatch run on that branch (40879828636) passed test_core_setup_rules_steps 327/327 on Windows.

This run (40890153423) selects the Windows lane again because of the CMakeLists.txt edit, so it is the check that the curl change coexists with the fix. Stays a draft until that lane is green; then ready + queue.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Green on the rebased head 5c1f1e6ea: Build 🧱 / Rust Tier 2 (windows-2025-vs2026) passes (9m4s), Rust Tier 2 (macos-26) passes (13m29s), and CI Gate ✅ passes — the audio crash that was the only red is gone now that #2911 is on master. Marking ready and queueing.

@zackees
zackees marked this pull request as ready for review October 29, 2026 14:38
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
Merged via the queue into master with commit fbfb963 Oct 29, 2026
38 checks passed
@zackees
zackees deleted the infra/2211-restore-brotli branch October 29, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

restore: brotli back on outgoing calls (CURLOPT_ACCEPT_ENCODING "") once CVE-2026-111497 is fixed

1 participant