Skip to content

Validate downloaded assets are real archives before publishing#3

Open
lcatlett wants to merge 2 commits intoadwinying:masterfrom
lcatlett:fix/validate-download-assets
Open

Validate downloaded assets are real archives before publishing#3
lcatlett wants to merge 2 commits intoadwinying:masterfrom
lcatlett:fix/validate-download-assets

Conversation

@lcatlett
Copy link
Copy Markdown

@lcatlett lcatlett commented Apr 6, 2026

Summary

  • The upstream dl.static-php.dev/static-php-cli/bulk/ endpoint has been returning 404 HTML pages since ~Feb 2026
  • Without validation, the workflow silently published 2KB HTML error pages as .tar.gz release assets
  • All assets from v8.4.18+ are broken (2,278 bytes each), causing mise install and other consumers to fail with "invalid gzip header"

Changes

  • Add --fail (-f) flag to all curl calls so HTTP 4xx/5xx responses cause immediate failure instead of writing error pages to disk
  • After each download, validate the file type using file — confirm .tar.gz files are gzip compressed and .zip files are Zip archive
  • If validation fails, the workflow exits with a clear ::error:: message identifying the bad file and likely cause

Test plan

  • Trigger the workflow with a known-good version (e.g., 8.4.17) against a working upstream — should succeed as before
  • Trigger the workflow when upstream returns 404 — should now fail loudly instead of publishing broken assets
  • Verify the ::error:: annotation appears in the GitHub Actions UI on failure

lcatlett added 2 commits April 5, 2026 21:01
The upstream dl.static-php.dev/static-php-cli/bulk/ endpoint has been
returning 404 HTML pages since ~Feb 2026. Without validation, these
2KB HTML error pages were silently uploaded as release assets, breaking
all consumers (e.g. mise install).

Changes:
- Add --fail flag to curl calls so HTTP errors cause immediate failure
- Validate each downloaded file with `file` to confirm it's actually a
  gzip archive (.tar.gz) or Zip archive (.zip) before proceeding
- Fail the workflow with clear error messages if validation fails
The JSON API returns full_path with a leading slash (e.g.
/static-php-cli/bulk/php-8.4.19-cli-linux-x86_64.tar.gz).
Concatenating this with the base URL using "$base/$path" produced
a double-slash URL (https://dl.static-php.dev//static-php-cli/...).

The server previously normalized double slashes, but stopped doing
so around Feb/March 2026, causing all downloads to return 404 HTML
pages. This is the actual root cause of the broken release assets.

Fix: use "${base}${path}" instead of "${base}/${path}" since
full_path already includes the leading slash.
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