Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@

* Add missing regex anchors with `re.fullmatch` to `create_zenodo_deposition_cli` utils script ([778](https://github.com/open-energy-transition/open-tyndp/pull/778)).

* Add validation of Zenodo API base URL and deposition ID in `create_zenodo_deposition_cli` to close URL-manipulation finding ([780](https://github.com/open-energy-transition/open-tyndp/pull/780)).
Comment thread
daniel-rdt marked this conversation as resolved.
Outdated


## Upcoming PyPSA-Eur Release
* Security: SBOM security scan included in CI.
Expand Down
7 changes: 7 additions & 0 deletions utils/create_zenodo_deposition_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,13 @@ def publish_zenodo_deposition(deposition_id: int) -> requests.Response:
Response
The response from the Zenodo API after publishing the deposition.
"""
# Validate id to be positive integer (rejecting bool, int-like strings and traversals)
if (
isinstance(deposition_id, bool)
or not isinstance(deposition_id, int)
or deposition_id <= 0
):
raise ValueError(f"Invalid Zenodo deposition ID: {deposition_id!r}")
r = requests.post(
f"{ZENODO_API_URL}/deposit/depositions/{deposition_id}/actions/publish",
params={"access_token": ZENODO_API_KEY},
Expand Down
Loading