Skip to content

fix: make installs atomic with their metadata; safer asset matching and launch paths - #32

Merged
MotherSphere merged 1 commit into
mainfrom
fix/install-pipeline
Jul 20, 2026
Merged

MotherSphere merged 1 commit into
mainfrom
fix/install-pipeline

Conversation

@MotherSphere

Copy link
Copy Markdown
Member

Contexte (audit 2026-07-20, vague B - lot 2)

  1. Cancel pendant verify/extract = état installé désynchronisé à vie - l'abort détache la tâche bloquante (elle va au bout : le binaire s'installe) mais le message de complétion est perdu, donc .colony_version/.colony_asset - écrits jusqu'ici dans le handler UI - ne l'étaient jamais. Résultat : app exclue des checks d'update pour toujours, ou binaire orphelin invisible. Les enregistrements sont maintenant écrits dans l'étape bloquante, atomiquement avec la promotion, par download_release_asset lui-même (paramètres regroupés dans une struct AssetInstall au passage).
  2. find_asset_by_pattern : match exact d'abord + filtrage des jumeaux non-installables (.sig, .sha256, .yml...) - le jour où une app de l'écosystème signe ses releases comme Colony le fait, chaque pattern substring devenait ambigu et cassait les installs. Le match exact règle aussi le recouvrement app-macos / app-macos-x86.
  3. installed_app_path applique le même garde anti-traversal que l'install au nom venant du manifest - un manifest hostile pouvait pointer le bouton Launch vers un exécutable arbitraire hors du dossier de l'app.

Validation

Build + clippy 0 warning, 90 tests verts (2 nouveaux : exact-match et jumeaux .sig), smoke test de boot OK.

…nd launch paths

Three audit findings on the install pipeline:

- Cancelling a download during verify/extract detached the blocking
  install task (it runs to completion) while dropping the completion
  message, so the version/asset records - previously written in the UI
  handler - were never saved: an installed binary with no version file
  is silently excluded from every future update check, and a
  filePattern install became an orphaned binary the app no longer saw
  as installed. The records are now written inside the blocking step,
  atomically with the promotion, by download_release_asset itself (the
  parameters moved into an AssetInstall struct while touching the
  signature).
- find_asset_by_pattern now prefers an exact name match (so
  'app-macos' resolves even though 'app-macos-x86' contains it) and
  ignores non-installable siblings (.sig/.sha256/.yml/...): the day a
  repo signs its releases the way Colony itself does, every substring
  pattern would otherwise turn ambiguous and break installs.
- installed_app_path now applies the same traversal guard as the
  install path to the manifest-supplied binary/file name: a hostile
  manifest could otherwise point the Launch button at an arbitrary
  executable outside the app's install dir.

Two new tests cover the exact-match and signature-sibling cases.
@MotherSphere
MotherSphere merged commit d4159b1 into main Jul 20, 2026
3 checks passed
@MotherSphere
MotherSphere deleted the fix/install-pipeline branch July 20, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant