Skip to content

fix: use content-disposition filename for fetched keys#2283

Open
arpitjain099 wants to merge 1 commit into
chainguard-dev:mainfrom
arpitjain099:fix/key-content-disposition
Open

fix: use content-disposition filename for fetched keys#2283
arpitjain099 wants to merge 1 commit into
chainguard-dev:mainfrom
arpitjain099:fix/key-content-disposition

Conversation

@arpitjain099

Copy link
Copy Markdown

When a key URL does not include the real key filename in its path (for example /key on Forgejo/Gitea), apko currently writes the fetched key to that path basename. That breaks signature verification because APKINDEX signatures reference the actual key filename.

This change uses the response Content-Disposition filename (including filename* values) when it is present, and falls back to the URL basename otherwise.

I also added a regression test that serves a key from /key with a Content-Disposition filename and verifies the key is written under the header-provided name.

Fixes #2252

Verification:

  • go test ./pkg/apk/apk -run TestInitKeyring
  • go test ./pkg/apk/apk -run "TestInitKeyring|TestGetRepositoryIndexes"
  • go test ./pkg/apk/apk

@arpitjain099 arpitjain099 force-pushed the fix/key-content-disposition branch 3 times, most recently from 08a7380 to 58b9e85 Compare June 18, 2026 13:34
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
@arpitjain099 arpitjain099 force-pushed the fix/key-content-disposition branch from 58b9e85 to 6a41700 Compare June 18, 2026 13:36
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.

apko does not follow content-disposition headers when fetching key files

1 participant