Skip to content

Commit 06b480e

Browse files
committed
Merge branch 'master' into fix/security-fix-9
2 parents 51b6594 + 5d135f2 commit 06b480e

3 files changed

Lines changed: 34 additions & 5 deletions

File tree

doc/release_notes.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,27 @@
3131

3232
**Bugfixes and Compatibility**
3333

34+
* Rename bus for `t339` project (Tyrrhenian) from ITSI to ITVI ([#751](https://github.com/open-energy-transition/open-tyndp/pull/751)).
35+
3436
**Documentation**
3537

3638
* Update benchmarking documentation tables and figures for v0.7.1 ([#711](https://github.com/open-energy-transition/open-tyndp/pull/711)).
3739

38-
* Migrate the Sphinx/RST-based documentation to MkDocs/Markdown, as a follow-up to the [upstream migration](https://github.com/PyPSA/pypsa-eur/pull/2162) ([754](https://github.com/open-energy-transition/open-tyndp/pull/754)).
40+
* Migrate the Sphinx/RST-based documentation to MkDocs/Markdown, as a follow-up to the [upstream migration](https://github.com/PyPSA/pypsa-eur/pull/2162) ([#754](https://github.com/open-energy-transition/open-tyndp/pull/754)).
3941

4042
**Developers Note**
4143

4244
* Change GitHub issue templates to comply with ISO security checks ([#714](https://github.com/open-energy-transition/open-tyndp/pull/714), [#730](https://github.com/open-energy-transition/open-tyndp/pull/730)).
4345

44-
* Introduce SBOM/Grype vulnerability scanning workflow, as a follow-up to the [upstream addition](https://github.com/PyPSA/pypsa-eur/pull/2164) ([754](https://github.com/open-energy-transition/open-tyndp/pull/754)).
46+
* Introduce SBOM/Grype vulnerability scanning workflow, as a follow-up to the [upstream addition](https://github.com/PyPSA/pypsa-eur/pull/2164) ([#754](https://github.com/open-energy-transition/open-tyndp/pull/754)).
47+
48+
* Ensure `inflow_t` is always defined in `attach_hydro`, resolving a pylint use-before-assignment issue ([#777](https://github.com/open-energy-transition/open-tyndp/pull/777)).
49+
50+
* 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)).
4551

46-
* Ensure `inflow_t` is always defined in `attach_hydro`, resolving a pylint use-before-assignment issue ([777](https://github.com/open-energy-transition/open-tyndp/pull/777)).
52+
* Add validation of Zenodo deposition ID in `create_zenodo_deposition_cli` to close URL-manipulation finding ([#780](https://github.com/open-energy-transition/open-tyndp/pull/780)).
4753

48-
* 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)).
54+
* Prevent `create_zenodo_deposition_cli` from leaking secrets in logs under `--debug` by scoping debug logging to the local logger instead of the root logger ([#781](https://github.com/open-energy-transition/open-tyndp/pull/781)).
4955

5056
* Add sanitization of CLI inputs passed to `launch_explorer` ([#776](https://github.com/open-energy-transition/open-tyndp/pull/776)).
5157

scripts/cba/clean_projects.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,18 @@ def extract_transmission_projects(
131131
.str.extract(r"(?P<bus0>[A-Za-z0-9]{4,}) ?- ?(?P<bus1>[A-Za-z0-9]{4,})$")
132132
)
133133

134+
# For project t339, the border is given as ITCS-ITSI and ITSA-ITSI, when it should be connected to the virtual node ITVI instead: ITCS-ITVI and ITSA-ITVI
135+
# Manually fixing this here (changing the border and bus1 columns)
136+
t339_mask = projects.loc[projects["project_id"] == 339].index
137+
projects.loc[t339_mask, ["border", "bus1"]] = projects.loc[
138+
t339_mask, ["border", "bus1"]
139+
].replace(
140+
{
141+
"border": {"ITCS-ITSI": "ITCS-ITVI", "ITSA-ITSI": "ITSA-ITVI"},
142+
"bus1": {"ITSI": "ITVI"},
143+
}
144+
)
145+
134146
unclear_border = ~(
135147
projects["bus0"].isin(existing_buses) & projects["bus1"].isin(existing_buses)
136148
)

utils/create_zenodo_deposition_cli.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,13 @@ def publish_zenodo_deposition(deposition_id: int) -> requests.Response:
310310
Response
311311
The response from the Zenodo API after publishing the deposition.
312312
"""
313+
# Validate id to be positive integer (rejecting bool, int-like strings and traversals)
314+
if (
315+
isinstance(deposition_id, bool)
316+
or not isinstance(deposition_id, int)
317+
or deposition_id <= 0
318+
):
319+
raise ValueError(f"Invalid Zenodo deposition ID: {deposition_id!r}")
313320
r = requests.post(
314321
f"{ZENODO_API_URL}/deposit/depositions/{deposition_id}/actions/publish",
315322
params={"access_token": ZENODO_API_KEY},
@@ -451,6 +458,9 @@ def main(
451458
"""
452459
Guide the user through creating a new Zenodo deposition or version.
453460
"""
461+
# Set the global logging level
462+
logging.basicConfig(level=logging.INFO)
463+
454464
global ZENODO_API_URL
455465
ZENODO_API_URL = API_URLS["sandbox"] if sandbox else API_URLS["production"]
456466

@@ -462,7 +472,8 @@ def main(
462472
fg=typer.colors.YELLOW,
463473
)
464474
if debug:
465-
logging.basicConfig(level=logging.DEBUG)
475+
# change local logger level to debug
476+
logger.setLevel(logging.DEBUG)
466477
typer.secho("Debug mode enabled.", fg=typer.colors.YELLOW)
467478

468479
typer.secho("=" * 80, fg=typer.colors.CYAN)

0 commit comments

Comments
 (0)