Skip to content

Releases: redirect without downloading the artifact - #75

Merged
adamshiervani merged 1 commit into
devfrom
fix/redirect-no-download
Sep 18, 2026
Merged

adamshiervani merged 1 commit into
devfrom
fix/redirect-no-download

Conversation

@adamshiervani

@adamshiervani adamshiervani commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

/releases/app/latest and /releases/system_recovery/latest downloaded the whole artifact on every cache miss to compare it with its .sha256 sidecar, then redirected.

 list versions → newest → resolveArtifactPath
-  GetObject artifact (tens to hundreds of MB) + GetObject .sha256 → verifyHash
+  HeadObject
   302

Found on staging: four concurrent redirect requests during scripts/compare-releases.sh made the instance download several recovery images at once, the platform marked it unhealthy, and the requests came back as 504 no_healthy_upstream. One at a time they pass.

Verification at request time bought nothing: the sidecar is written by the same release script that uploads the file, and sync-releases.ts verifies hash and GPG signature when it registers a release. The redirect now only checks the object exists.

Tests: the two "hash does not match" cases are gone with the behaviour; the "file missing" cases mock HeadObject instead of GetObject.

Net: +18 / −102.


Note

Medium Risk
Redirect paths no longer detect tampered or corrupt objects at request time; clients rely on publish/sync verification and downstream download checks instead.

Overview
Latest redirect endpoints (/releases/app/latest and /releases/system_recovery/latest) no longer download the full artifact plus its .sha256 sidecar on cache misses to run verifyHash. They now only HeadObject via s3ObjectExists and return a 302 when the object is present.

This avoids concurrent redirect traffic pulling large recovery images through the API (which caused staging 504 / unhealthy upstream). Integrity is documented as enforced at publish (release script writes the sidecar) and sync (sync-releases.ts verifies hash and signature), not on every redirect.

Tests drop the hash mismatch → InternalServerError cases, mock HeadObject for existence in legacy redirect helpers, and assert NotFound when HeadObject returns 404 instead of missing GetObject bodies.

Reviewed by Cursor Bugbot for commit e554314. Bugbot is set up for automated code reviews on this repo. Configure here.

The latest-artifact redirects fetched the whole object on every cache
miss to compare it with its .sha256 sidecar. Several concurrent misses
on staging pulled multiple recovery images at once, the instance was
marked unhealthy and the requests failed with 504.

The sidecar is written by the release script that uploads the file, and
the sync script verifies hash and signature when it registers a
release, so a second check at request time added nothing. Check that
the object exists and redirect.
@adamshiervani

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e554314. Configure here.

@adamshiervani
adamshiervani marked this pull request as ready for review September 18, 2026 20:14
@adamshiervani
adamshiervani merged commit 2dbc67b into dev Sep 18, 2026
3 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-18T20:16:32.501906Z e554314 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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