{"action":"created","issue":{"url":"https://api.github.com/repos/dagolden/Path-Tiny/issues/97","labels_url":"https://api.github.com/repos/dagolden/Path-Tiny/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/dagolden/Path-Tiny/issues/97/comments","events_url":"https://api.github.com/repos/dagolden/Path-Tiny/issues/97/events","html_url":"https://github.com/dagolden/Path-Tiny/issues/97","id":33474508,"number":97,"title":"Path traversals inside tempdirs should perhaps keep references to that tempdir","user":{"login":"kentfredric","id":44790,"avatar_url":"https://avatars.githubusercontent.com/u/44790?v=3","gravatar_id":"","url":"https://api.github.com/users/kentfredric","html_url":"https://github.com/kentfredric","followers_url":"https://api.github.com/users/kentfredric/followers","following_url":"https://api.github.com/users/kentfredric/following{/other_user}","gists_url":"https://api.github.com/users/kentfredric/gists{/gist_id}","starred_url":"https://api.github.com/users/kentfredric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kentfredric/subscriptions","organizations_url":"https://api.github.com/users/kentfredric/orgs","repos_url":"https://api.github.com/users/kentfredric/repos","events_url":"https://api.github.com/users/kentfredric/events{/privacy}","received_events_url":"https://api.github.com/users/kentfredric/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dagolden/Path-Tiny/labels/wontfix","name":"wontfix","color":"ffffff"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-05-14T09:10:33Z","updated_at":"2015-03-04T18:30:43Z","closed_at":"2015-03-04T18:30:43Z","body":"I've seen a bunch of problems that occur with code like this:\r\n\r\n```perl\r\nmy $x = Path::Tiny->tempdir();\r\nmy $child = $x->child(\"foo\");\r\n$child->spew(\"content\");\r\nreturn $child;\r\n```\r\n\r\nOr similar. Essentially, you still have an object you're passing around that pertains to a file in a temporary directory, but due to the mechanism of the temporary directory being \"delete on GC\" + child nodes not referring to the temp directory, the child quickly becomes invalid.\r\n\r\nIdeally, the temporary directory should only be GC'd when all the children no longer have anyone using them.\r\n\r\nAnd it seems plausible that `->child` could potentially copy `$_[0]->[TEMP]` around without it having unwanted side effects.\r\n\r\nYou could potentially do that too for `->absolute` and `->relative` , which I've occasionally made the mistake of doing:\r\n\r\n```perl\r\n  my $x = Path::Tiny->tempdir->absolute;\r\n```\r\nWhich of course yields nothing useful. ( It is indeed redundant because `tempdir` is already absolute, but I don't manage to remember this )"},"comment":{"url":"https://api.github.com/repos/dagolden/Path-Tiny/issues/comments/77216168","html_url":"https://github.com/dagolden/Path-Tiny/issues/97#issuecomment-77216168","issue_url":"https://api.github.com/repos/dagolden/Path-Tiny/issues/97","id":77216168,"user":{"login":"dagolden","id":27104,"avatar_url":"https://avatars.githubusercontent.com/u/27104?v=3","gravatar_id":"","url":"https://api.github.com/users/dagolden","html_url":"https://github.com/dagolden","followers_url":"https://api.github.com/users/dagolden/followers","following_url":"https://api.github.com/users/dagolden/following{/other_user}","gists_url":"https://api.github.com/users/dagolden/gists{/gist_id}","starred_url":"https://api.github.com/users/dagolden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dagolden/subscriptions","organizations_url":"https://api.github.com/users/dagolden/orgs","repos_url":"https://api.github.com/users/dagolden/repos","events_url":"https://api.github.com/users/dagolden/events{/privacy}","received_events_url":"https://api.github.com/users/dagolden/received_events","type":"User","site_admin":false},"created_at":"2015-03-04T18:30:43Z","updated_at":"2015-03-04T18:30:43Z","body":"Closing this as \"won't fix\""}}