-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Is it reproducible with SwiftPM command-line tools: swift build
, swift test
, swift package
etc?
- Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands,
swift build
,swift test
,swift package
etc.
Description
We have several private artifact bundles used that randomly cannot be downloaded and fail with:
error: failed downloading 'https://api.github.com/repos/ordo-one/model/releases/assets/273301740-linux-313.1.0.zip' which is required by binary target 'Ordo': badResponseStatusCode(403)
This started happening frequently this month for some reason, potentially change of handling in Azure storage or caching. When the bundle is cached by the Varnish layer, the downloads succeed. When Varnish cache layer has a cache miss and forwards the request to Azure Storage, downloads fail with 403.
What is happening:
- API request is made to
https://api.github.com/repos/ordo-one/model/releases/assets/273301740
with basicAuthorization
header filled in fromnetrc
- GitHub responds with a 302 redirect to
https://release-assets.githubusercontent.com/github-production-release-asset/[...]
- The same
Authorization
header that authenticatesapi.github.com
is preserved and sent to a different host that doesn't require authentication since the redirect location already has a SAS token, resulting in rejection:
<?xml version="1.0" encoding="utf-8"?>
<Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:9eedc347-101e-0026-1136-f6a94d000000
Time:2025-07-16T09:49:35.6509894Z</Message></Error>
This can be visible in mitmproxy, there are 4 bundles to download: 2 worked and 2 failed:

The ones that are failed have mentioned authentication failure response:
The request that is made includes the original authentication for api.github.com
, but this should not be sent to the redirected domain:

macOS appears to be using some slightly different implementation to fetch the files which is not affected by this (bundle downloads are also not visible in mitmproxy); this affects Linux only.
Expected behavior
Bundle should be downloaded successfully.
Actual behavior
Bundle fails to be downloaded and build process fails.
Steps to reproduce
On a private GitHub repository, attach a artifact bundle to the releases and add URL of it to Package.swift, URL + Checksum can be obtained from:
gh api /repos/owner/package/releases/tags/313.1.0 -q '.assets[] | "\(.url) \(.browser_download_url) \(.digest))"'
Fill in ~/.netrc with gh auth token
:
machine api.github.com login gho_token password x-oauth-basic
Wipe the local cache and try to fetch:
rm -rf .build ~/.cache/org.swift.swiftpm/artifacts ~/.cache/org.swift.foundation.URLCache; ~/swift-package-manager/.build/debug/swift-build
Swift Package Manager version/commit hash
6.2 / 55f0a83
Swift & OS version (output of swift --version ; uname -a
)
swift --version
Swift version 6.2-dev (LLVM 8835b75a8ce3615, Swift 3c98a1e76fae702)
Target: x86_64-unknown-linux-gnu
Build config: +assertions