...
One potential drawback of this approach is that effective sanitization methods can be difficult to write. A benefit of this approach is that it works well in combination with taint analysis (see Automated Detection, below). For more information on how to securely validate and sanitize a file, see FIO04-J. Beware of symbolic links and other special files when selecting a file to openDo not open non-regular files when accessing regular files.
Compliant Solution (Built-in File Name and Path)
...