Skip to content

Commit

Permalink
Merge pull request #53 from ecmwf/develop
Browse files Browse the repository at this point in the history
preparing release
  • Loading branch information
floriankrb authored Nov 15, 2024
2 parents 5ed47d1 + 809d847 commit 0b465c7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/anemoi/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def load_any_dict_format(path) -> dict:
return tomllib.load(f)
except (json.JSONDecodeError, yaml.YAMLError, tomllib.TOMLDecodeError) as e:
LOG.warning(f"Failed to parse config file {path}", exc_info=e)
return ValueError(f"Failed to parse config file {path} [{e}]")
raise ValueError(f"Failed to parse config file {path} [{e}]")

return open(path).read()

Expand Down
3 changes: 3 additions & 0 deletions src/anemoi/utils/remote/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def _parse_target(self, target):
hostnames = hostname.split("+")
hostname = hostnames[random.randint(0, len(hostnames) - 1)]

if ".." in path.split("/"):
raise Exception("Path contains suspicious '..' : {target}")

return hostname, path

def get_temporary_target(self, target, pattern):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def test_transfer_local_to_s3_to_local(path):


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

0 comments on commit 0b465c7

Please sign in to comment.