Repository navigation
Conversation
For the catalogue and updates (next). Android 4.4's Java TLS shares no cipher suite with GitHub, and its MessageDigest SHA-256 can be missing under app_process, so: - core/fetch/fetch.c -> /data/hmgapi/lib/libhmgapi_fetch.so (built like the loader: no libc, dlopen/dlsym only; installed into /data, nothing new on /system). One TLS 1.2 request through the unit's libssl.so; the socket carries home Wi-Fi's mark (SO_MARK 0x2951), so it leaves on home Wi-Fi or not at all. The certificate isn't checked (the unit's 2013 roots and its clock can't be relied on): what's downloaded is trusted only through a SHA-256 and a signature. - NativeFetch (with NativeFetch.Web, files standing in for GitHub off the car), Http (https, GitHub's hosts only, redirects between them, a size cap), DnsLookup (home Wi-Fi's DNS server, asked directly), Sha256 (plain Java). - fetch-test.sh. The same C, built for a computer, fetched catalogue entries and packages from GitHub; first run on an Ioniq 5 US 260507 as a mod. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 26, 2026
…s libc headers) The few JNI pieces it uses are declared at their places in the standard table, checked at compile time; the library is byte-for-byte the same. CI's Linux headers failed for the ARM target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md
fetch.c: every socket gets 20 s send and receive timeouts (connect, the handshake, each read and write), home Wi-Fi's mark and SO_BINDTODEVICE wlan0, or the call fails (E_ROUTE): no unmarked socket on the main table, even before the fwmark rule is in. setsockopt is required. The DNS query goes out through the library too (NativeFetch.dns, UDP, the same socket setup), and the connection only goes to an address (AI_NUMERICHOST: never the system resolver). An answer ends whole only on the server's TLS close; a drop, read error or timeout is E_CUT with what came kept. No static buffer (malloc'd per call); the answer file is opened O_EXCL | O_NOFOLLOW. DnsLookup takes the server from wifi.sh's lease (there only while home Wi-Fi's route is up) instead of dhcp.wlan0.dns1, and asks through an Asker (the library's socket) instead of an unmarked DatagramSocket. Http: one answer file per call (NativeFetch.fresh); a cut answer counts only if its Content-Length is met or its last chunk read; headers cut off are an error; chunk sizes are hex digits only, at most 7 (a negative size passed the cap), each chunk must end in CRLF; a body that fails for any reason leaves no .part. Content-Length must be a number and within the cap. Tests: NativeFetch.Web honours maxBytes and O_EXCL, and serves chunked, no-length, raw and cut answers; FetchTest adds cap, chunked, cut, redirect, lease and eight-threads cases. fetch-test.sh builds the library for the computer (-DHOST) and runs it against a local TLS server: a TLS close, a drop, a quiet server (timeouts), the cap, O_EXCL and O_NOFOLLOW, and the DNS exchange. libhmgapi_fetch.so is in install-test.sh's and zygote-orders.py's MANIFESTs, and install-test checks it lands in /data/hmgapi/lib, 644, nothing on /system. Tested off-car only (fetch-test.sh with Homebrew OpenSSL 3 on macOS, install-test.sh, orders-test.sh; ./build.sh fetchlib links with only dlopen and dlsym undefined). Not yet run on a car. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VysseCodes
reviewed
Nov 30, 2026
VysseCodes
left a comment
Collaborator
There was a problem hiding this comment.
Two things before merging:
- Installer fix: the commit that copies the HTTPS library before the
/systemchanges landed in #424, but it belongs here, with the library. Please move it into this PR. - Thread safety: OpenSSL 1.0.1 isn't thread-safe without locking callbacks, and
fetch.c's comment says calls may come from several threads. Nothing calls it from two threads today, but please add a lock (e.g. synchronizefetch()/dns()inNativeFetch) so later parallel use is safe, and fix the comment to say calls are serialized.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It went into /data after the wrapper and boot hook were written, so a failure there stopped the install with the maps, the app and the records after it skipped. It's now kept right after the backups, before remount rw, and a failure says nothing on /system was changed. Test: a file where its folder goes: refused, /system unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 34b9624)
…llbacks) NativeFetch.fetch and dns are synchronized on one lock, so later parallel use can't run two OpenSSL calls at once; fetch.c's comment now says calls are serialized (review). The installer fix that keeps this library before /system changes moved here from #424 (cherry-picked). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AwsomeFox
added a commit
that referenced
this pull request
Nov 30, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Both done:
|
6 of 67 tasks
The only conflict was tools/test-all.sh: this branch's fetch-test.sh and release/2.0's core/client/test.sh both go in ALL and FAST. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack: 3 of 5, on #420. Foundation for the catalogue (#423): nothing calls it yet.
Why
The engine needs HTTPS to GitHub for the catalogue and updates. Android 4.4's Java TLS shares no cipher suite with GitHub, and under
app_processitsMessageDigestSHA-256 can be missing (Conscrypt's class didn't load in a mod's service on the car).What
core/fetch/fetch.c→/data/hmgapi/lib/libhmgapi_fetch.so. Built like the loader: no libc,dlopen/dlsymonly, against the syslib stubs. Installed into/databyinstall.sh(nothing new on/system, nothing for the uninstaller to restore). It makes one TLS 1.2 request through the unit's ownlibssl.so(OpenSSL 1.0.1, ECDHE + AES-GCM) and writes the raw answer to a file with a cap. The socket getsSO_MARK 0x2951, so its route is table 95: Home Wi-Fi, or unreachable (Home Wi-Fi: mods' connections and their services' lookups get through #420), never mobile data.SHA256SUMS) and then the package signature (Catalogue, dependencies and updates in the engine #423). A hostile network can make a check fail; it can't get code installed.NativeFetch(plusNativeFetch.Web: files standing in for GitHub off the car).Http: https only, GitHub's hosts only (github.com,api.github.com,raw./objects./release-assets.githubusercontent.com,codeload), redirects only between them, Content-Length and chunked, a size cap,.partthen rename.DnsLookup: an A query straight todhcp.wlan0.dns1, since the engine runs outside netd's per-app setup.Sha256: plain Java.Tested
fetch-test.sh(15 checks): redirects, a refused host, the cap, 404, no connection, SHA-256 against the JDK's, the DNS reader../build.sh fetchlib: it imports onlydlopen/dlsym.Review follow-ups (Nov 30)
/systemchanges) is here now, with the library (moved from App: Get mods and Updates in the Mods tab #424).NativeFetch.fetch()anddns()aresynchronizedon one lock: the unit's OpenSSL 1.0.1 has no locking callbacks, so no two calls run at once.fetch.c's comment says calls are serialized.🤖 Generated with Claude Code