Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Files::isAbsolutePath and Files::isRealPath #3235

Draft
wants to merge 2 commits into
base: 9.0
Choose a base branch
from

Conversation

mhsdesign
Copy link
Member

These new utility methods are needed by neos. And its best to place them into the utility with additional tests.

See

Upgrade instructions

Review instructions

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked with !!! and have upgrade-instructions

@mhsdesign mhsdesign changed the title FEATURE: Files::isAbsolute and Files::isRealPath FEATURE: Files::isAbsolutePath and Files::isRealPath Nov 13, 2023
@mhsdesign mhsdesign added the 9.0 label Nov 13, 2023
* That means its absolute and has no directory traversal.
* {@see realpath()}
*/
public static function isRealPath(string $path): bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be misleading as the linux realpath has another important function, which is to resolve symlinks, and we do not know if this path contains symlinks. As in /var/www/app/current/Web vs /var/www/app/20231219/Web

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes maybe isAbsoluteUnixStyleFilePathWithoutDirectoryTraversal ?

This might still be useful just to be able to do a simple optional assertion, so we notice more quickly if something is wrong.

neos/neos-development-collection#4838

Copy link
Member Author

@mhsdesign mhsdesign Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or isSimpleAbsoluteUnixPath isPureUnixPath or isCleanUnixPath? idk

-> isFullyQualified

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and the symlinking thing is exactly what lead to this bug rendering the helper obsolete.

So I guess we only need the first helper

@mhsdesign mhsdesign marked this pull request as draft April 2, 2024 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Under Review 👀
Development

Successfully merging this pull request may close these issues.

None yet

2 participants