Skip to content

pkg: HTTPS repositories only; no download follows HTTPS to HTTP - #121

Merged
v3nn7 merged 1 commit into
mainfrom
v3nn7/practical-euler-ot7vt8
Nov 12, 2026
Merged

v3nn7 merged 1 commit into
mainfrom
v3nn7/practical-euler-ot7vt8

Conversation

@v3nn7

@v3nn7 v3nn7 commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

What does this change?

Follow-up to #120.

  • pkg accepts only HTTPS repositories (userspace/web/src/bin/pkg.rs, repository()). A url= in /etc/osyx/packages.conf, or the system update's url= it falls back to, that does not start with https:// is refused: "… is not HTTPS: package repositories must use HTTPS". Over plain HTTP, anyone on the network path can answer with an older signed list and its packages and keep a system from its fixes; signatures prove origin, not freshness.
  • No download follows a redirect from HTTPS to HTTP (userspace/web/src/lib.rs, get and the new redirect). The refusal happens in the redirect loop, before the HTTP connection is opened, so an HTTPS → HTTP → HTTPS chain is refused too. This covers every caller of osyx_web::get and download: pkg, the system updater (osyx-update), firstboot, fetch and get. In desktop: editor, launcher search, light theme, captures, PDF text, packages; USB mouse behind a hub #120 only pkg had this check, through a separate get_no_downgrade, which is gone now.
  • docs/packages.md: describes both rules.

A direct http:// URL still works for fetch and get. Only the step from HTTPS down to HTTP is refused.

How was it tested?

In QEMU (desktop session, QMP input, terminal screenshots):

  • With url=http://10.0.2.2:8765 in packages.conf: pkg list and elevate pkg install hello both stop with "http://10.0.2.2:8765 (from /etc/osyx/packages.conf) is not HTTPS: package repositories must use HTTPS". Nothing was downloaded.
  • With url=https://github.com/OSyxSoftware/OSyx/releases/latest/download: pkg list passes the new check and reaches the TLS layer. In this test environment the proxy replaces GitHub's certificate, so it ends with "TLS: invalid peer certificate: UnknownIssuer". That is expected here and shows the HTTPS path is taken.
  • The user programs build for the target without errors or warnings.

Not tested:

  • A real redirect from HTTPS to HTTP. No server with a certificate the guest trusts was available.
  • A successful HTTPS package installation, for the same reason.
  • A host unit test for redirect: osyx-web does not build for the host.

Limitations or screenshots

  • Package repositories on a local network now need HTTPS with a certificate from the Mozilla roots (webpki-roots). The system has no way to add another root yet, so a private repository needs a publicly trusted certificate.
  • Package installation can no longer be tested end to end in an environment without trusted HTTPS, as the earlier QEMU tests did over HTTP.
  • A server that redirects from HTTPS to HTTP now fails for fetch and get as well.

Labels

Labels: security, update


Generated by Claude Code

- pkg refuses a repository whose url= is not HTTPS. Over plain HTTP
  anyone on the network path can answer with an older signed list and
  its packages, and keep a system from its fixes.
- osyx_web::get refuses a redirect from HTTPS to plain HTTP before the
  HTTP request is made, for every caller: packages, system updates
  (osyx-update), firstboot, fetch and get. pkg's separate
  get_no_downgrade is gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wky8K1hAgSGYFWjvQ1gDqK
@v3nn7 v3nn7 added update Area: system security Area: security labels Nov 12, 2026 — with Claude
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@codspeed

codspeed Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 36 untouched benchmarks


Comparing v3nn7/practical-euler-ot7vt8 (ed24761) with main (2c1f165)

Open in CodSpeed

@v3nn7
v3nn7 marked this pull request as ready for review November 12, 2026 17:46
@v3nn7
v3nn7 merged commit 42de71d into main Nov 12, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Area: security update Area: system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants