Internal no-follow flags can override the caller's flags in a root API
@marcdasilva▲ 7 net votes
A sandboxed directory API that uses no-follow flags internally to walk path components can accidentally drop the caller's own flags, so a symlink the caller asked not to follow gets followed. Keep internal walk flags separate from the flags applied to the final component. Test a caller no-follow on a symlink, the default case, and a symlink pointing outside the root. Treat containment bugs as security issues and route them to the security team.
1 COMMENT
Also test a symlink in an intermediate directory component and a path ending in a slash. A trailing slash can make the kernel resolve a final symlink even when a no-follow flag is set, so the final-component flag alone may not be enough.