zenodo_release.py: send the API token as a Bearer header, and validate the bucket host

Open
#138 0 comments 0 reactions 0 assignees View on GitHub

@rocklambros is already working on this.

Since Aug 26, 2026.

  • #139 by @rocklambros — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
30/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
release, security

Research direction

Start in .github/scripts/zenodo_release.py at deposit() and list every request call that passes params=params. Read test_zenodo_release.py around line 143 to see the current query-parameter assertion and the example.invalid bucket stub, then update both with the code. Done means those requests use an Authorization: Bearer header, the bucket host is checked against the API base and fails closed, and the tests cover both. Linked pull request #139 is already open, so check it before starting.

Written by the indexing model from the issue text.

Description

Summary

.github/scripts/zenodo_release.py sends the Zenodo API token as an access_token query parameter on every request. It should send Authorization: Bearer <token> instead. A second, smaller issue: the bundle upload attaches that token to a URL taken from the API response without checking the host.

Both are low risk while the script runs by hand from a laptop, as documentation/ZENODO.md describes. They matter more once the deposit runs from CI against a repository secret, which is the direction the doc lays out.

1. Token in the query string

deposit() builds params = {"access_token": token} and passes it to all six request calls.

URLs carrying that parameter get written to places that outlive the request:

  • web server and reverse proxy access logs
  • any intermediary or corporate egress proxy
  • Referer headers on downstream navigations
  • shell history and CI job logs whenever a URL is echoed

Zenodo accepts Authorization: Bearer <token>, which keeps the credential in a header that logging stacks do not record by default.

Fix: replace params=params with headers={"Authorization": f"Bearer {token}"} throughout deposit().

2. Credential attached to an unvalidated host

The bundle upload targets draft["links"]["bucket"], which Zenodo supplies in its response:

requests.put(f"{draft['links']['bucket']}/{bundle.name}", data=handle, params=params, timeout=TIMEOUT)

The API base is hardcoded to zenodo.org or sandbox.zenodo.org, so this rests on trusting Zenodo to return its own bucket rather than on an open redirect. It is still a credential sent to a host the script never checked. A response-shaping bug or a compromised endpoint would leak a token that carries deposit:write and deposit:actions.

Fix: verify the bucket URL's host matches the API base host before the upload, and fail closed if it does not.

Scope

Both changes live in deposit(). test_zenodo_release.py asserts the current query-parameter behavior on line 143 and stubs a bucket on example.invalid, so both need updating alongside.

Dominant language
JavaScript
Stars
177
Forks
57
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GenAI-Security-Project/GenAI-LLM-Top10

All issues in GenAI-Security-Project/GenAI-LLM-Top10

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.