read()
Usage
read(filepath)
Description
Returns the contents of a file underneath the Structr exchange/
directory. See Anatomy of a Structr application for more information.
Example
${read('helloworld.txt')}
${read('subdir/helloworld.txt')}
results in
Hello, world!
Note
- The
exchange/
directory itself may be a symbolic link - Underneath the
exchange/
the canonical path of a file has to be identical to the provided filepath in order to prevent directory traversal attacks- This means that symbolic links inside the
exchange/
directory are forbidden - Also path traversal is forbidden
- Example 1: Allowed ‘sub/dir/file.txt’
- Example 2: Forbidden ‘../../../../etc/passwd’
- Example 3: Forbidden ‘/etc/passwd’
- This means that symbolic links inside the