Skip to content

Commit 0b465c7

Browse files
authored
Merge pull request #53 from ecmwf/develop
preparing release
2 parents 5ed47d1 + 809d847 commit 0b465c7

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Diff for: src/anemoi/utils/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def load_any_dict_format(path) -> dict:
207207
return tomllib.load(f)
208208
except (json.JSONDecodeError, yaml.YAMLError, tomllib.TOMLDecodeError) as e:
209209
LOG.warning(f"Failed to parse config file {path}", exc_info=e)
210-
return ValueError(f"Failed to parse config file {path} [{e}]")
210+
raise ValueError(f"Failed to parse config file {path} [{e}]")
211211

212212
return open(path).read()
213213

Diff for: src/anemoi/utils/remote/ssh.py

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ def _parse_target(self, target):
4444
hostnames = hostname.split("+")
4545
hostname = hostnames[random.randint(0, len(hostnames) - 1)]
4646

47+
if ".." in path.split("/"):
48+
raise Exception("Path contains suspicious '..' : {target}")
49+
4750
return hostname, path
4851

4952
def get_temporary_target(self, target, pattern):

Diff for: tests/test_remote.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def test_transfer_local_to_s3_to_local(path):
151151

152152

153153
@pytest.mark.skipif(IN_CI, reason="Test requires ssh access to localhost")
154-
@pytest.mark.parametrize("path", ["directory", "directory/", "file"])
154+
@pytest.mark.parametrize("path", ["directory", "file"])
155155
@pytest.mark.parametrize("temporary_target", [True, False])
156156
def test_transfer_local_to_ssh(path, temporary_target):
157157
local = LOCAL_TEST_DATA + "/" + path

0 commit comments

Comments
 (0)