Raku Land

IO::Path::ChildSecure

Build Status

NAME

IO::Path::ChildSecure -Secure version of IO::Path.child

SYNOPSIS

use IO::Path::ChildSecure; # good; you get IO::Path "foo".IO.&child-secure: 'meow'; # still good if 'foo/meow/foo/bar/../' exists; Failure if it doesn't "foo".IO.&child-secure: 'meow/foo/bar/../meow'; # bad; path isn't a child; you get Failure "foo".IO.&child-secure: '../';

DESCRIPTION

In the Raku Programming Language v6.c, IO::Path.child isn't secure, in a sense that it does no checks for whether the resultant path is actually a child of the original path.

EXPORTED SUBROUTINES

&child-secure

"foo".IO.&child-secure: 'meow'; # good; you get IO::Path "foo".IO.&child-secure: 'meow/foo/bar/../meow'; # still good "foo".IO.&child-secure: '../'; # bad; path isn't a child; you get Failure child-secure "foo".IO, '../'; # can also use as a proper sub

Appends the given path chunk to the invocant and ensures the resultant path is, in fact, a child of the invocant, by accessing the filesystem and fully-resolving the path. The last chunk of the resultant path does not have to exist for the resolution to succeed.

Will fail with X::IO::Resolve if failed to fully resolve the resultant path or with X::IO::NotAChild if the resultant path is not a child of the invocant.

SPECIAL NOTES


REPOSITORY

Fork this module on GitHub: https://github.com/raku-community-modules/IO-Path-ChildSecure

BUGS

To report bugs or request features, please use https://github.com/raku-community-modules/IO-Path-ChildSecure/issues

AUTHOR

Zoffix Znet (http://perl6.party/)

LICENSE

You can use and distribute this module under the terms of the The Artistic License 2.0. See the LICENSE file included in this distribution for complete details.

The META6.json file of this distribution may be distributed and modified without restrictions or attribution.