fix(updater): reject non-https GenericProvider origins - #579
Merged
Conversation
GenericProvider accepted any baseUrl with no scheme check, so
GenericProvider("http://updates.example.com") ran the whole update —
manifest, checksums, artifact and .asc — over plaintext, where the SHA-512
in the manifest offers no protection because an on-path attacker controls
the manifest too. GitHubProvider already hardcodes https; only this
extension point was exposed.
The base URL is now validated at construction: https is required, and
plain http is allowed only for loopback hosts (localhost / 127.0.0.0/8 /
::1) so local integration tests such as the delta RangeHttpServer keep
working without TLS.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Security fix — F-5 (audit 2026-08-19)
Severity: Medium · Module:
updater-runtimeProblem
GenericProvider(baseUrl)performed no scheme validation:So
GenericProvider("http://updates.example.com")drives the entire update — metadata manifest, checksums, artifact and the detached.asc— over plaintexthttp. On that channel the SHA-512 recorded inlatest*.ymloffers no protection, because an on-path attacker who can rewrite the artifact can rewrite the manifest that vouches for it.GitHubProvideralready hardcodeshttps://; this was the one origin an application could point anywhere.Fix
The base URL is validated at construction (
init):httpsis required, and plainhttpis permitted only for loopback hosts (localhost,127.0.0.0/8,::1) so local integration tests — e.g. the deltaRangeHttpServer, which serves fixtures overhttp://127.0.0.1— keep working without TLS. Any otherhttp/ftp/… origin throwsIllegalArgumentExceptionimmediately, rather than silently downgrading security at the first network call.Test
GenericProviderTestgains cases: publichttprejected, non-http scheme rejected, loopbackhttpallowed. Existing tests already usehttpsonly.Verified locally:
:updater-runtime:ktlintCheck :updater-runtime:detekt :updater-runtime:testall pass.🤖 Generated with Claude Code