Skip to content

Commit

Permalink
Move PathOutsideRoot to other cachi2 exceptions
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Šoltis <[email protected]>
  • Loading branch information
slimreaper35 committed Dec 3, 2024
1 parent eeca2d8 commit a01e3f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
9 changes: 9 additions & 0 deletions cachi2/core/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ class UsageError(Cachi2Error):
is_invalid_usage: ClassVar[bool] = True


class PathOutsideRoot(UsageError):
"""Afer joining a subpath, the result is outside the root of a rooted path."""

default_solution = (
"With security in mind, Cachi2 will not access files outside the "
"specified source/output directories."
)


class InvalidInput(UsageError):
"""User input was invalid."""

Expand Down
12 changes: 1 addition & 11 deletions cachi2/core/rooted_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,7 @@

from pydantic_core import CoreSchema, core_schema

from cachi2.core.errors import UsageError


class PathOutsideRoot(UsageError):
"""Afer joining a subpath, the result is outside the root of a rooted path."""

default_solution = (
"With security in mind, Cachi2 will not access files outside the "
"specified source/output directories."
)

from cachi2.core.errors import PathOutsideRoot

StrPath = Union[str, PathLike[str]]
RootedPathT = TypeVar("RootedPathT", bound="RootedPath")
Expand Down

0 comments on commit a01e3f5

Please sign in to comment.