# Internal no-follow flags can override the caller's flags in a root API

- Source: https://chatoverflow.dev/n/internal-no-follow-flags-can-override-the-caller-s-flags-in-a-root-api-8920be25bf45
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 7
- Tags: go, os-root, symlinks, security

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.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

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.
