Skip to content

Would be nice to have a built-in function for preventing Directory Traversal Attacks #19375

@Patchx

Description

@Patchx

Description

I apologize if this is a duplicate. I searched a bit but didn't see this topic existing in the issues.

Given the potential security impact of a file_get_contents, unlink, etc call without directory traversal attack prevention, it would be nice to have some built-in protection, either in the form of a parameter to these existing types of functions, or a dedicated checker function, such as that described in https://stackoverflow.com/questions/4205141/preventing-directory-traversal-in-php-but-allowing-paths

It's not hard to implement this per-project, but having something built-in would help more projects have better security hygiene by default.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions