Skip To Content

INTEGRAL

INTEGRAL Web Server Configuration Keywords

Jump directly to: 

LIMIT_PATH_PREFIX_R

LIMIT_PATH_PREFIX_W

LIMIT_PATH_PREFIX_U

MULTI These three keywords, also known as path access restriction keywords, impose path access restrictions on INTEGRAL DSL programs. LIMIT_PATH_PREFIX_R restricts read access, LIMIT_PATH_PREFIX_W restricts write access and LIMIT_PATH_PREFIX_U restricts update access (i.e. both read and write).

In all three cases, the value of the keyword is a string that represents a mandatory path prefix that a file/directory access operation attempted by the website's INTEGRAL DSL program must match, if that operation is to be allowed. Any time an INTEGRAL DSL program attempts to access a file or directory, INTEGRAL Application Server evaluates its path. Access is allowed only if the leading part of the evaluated path matches precisely the path prefix given by the keyword AND the remaining part of the evaluated path does not contain any "dot-dot (..)" sequences. The first condition ensures that access is restricted either to a specific directory tree or specific set of files, while the second condition ensures that directory traversal (i.e. going "up" a directory) is not possible. Thus, if the leading part of the evaluated path does not match precisely the value given by the keyword, or if there are any dot-dot sequences in the remaining part, the program's file/directory access operation will fail, just as if the file/directory did not exist. Note that directory traversal might still be possible using other means (e.g. via symbolic links that might exist within the directory tree), however, this kind of traversal is not something path access restriction keywords are designed to handle.

All three keywords can be defined multiple times in the same configuration file in order to create a comprehensive path restriction policy. INTEGRAL Application Server checks path access restriction keywords in the same order in which they are defined in the configuration file.

All path prefix comparisons are case sensitive. Note that in INTEGRAL DSL programs relative paths are relative to INTEGRAL Application Server's working directory.

Example 1

!LIMIT_PATH_PREFIX_U=system/tmp/dw00123_
!LIMIT_PATH_PREFIX_R=../integral/websites/002-production/public/../../../docs-basic/
!LIMIT_PATH_PREFIX_R=../integral/websites/002-production/public/../../../common/includes/
!LIMIT_PATH_PREFIX_W=../integral/websites/002-production/public/../private/data/
!LIMIT_PATH_PREFIX_R=../integral/websites/002-production/public/../private/
!LIMIT_PATH_PREFIX_R=../integral/websites/002-production/public/

Example 2

Let's assume that the website's path access restrictions are defined as follows:

!LIMIT_PATH_PREFIX_W=../websites/mysite/../private/data/
!LIMIT_PATH_PREFIX_R=../websites/mysite/../private/

In this case, the following operations will all succeed:

local f = file("../websites/mysite/../private/passwords.txt", "rb");
local f = file("../websites/mysite/../private/stuff/passwords.txt", "rb");
local f = file("../websites/mysite/../private/data/passwords.txt", "wb");
local f = file("../websites/mysite/../private/data/log.txt", "wb");
local f = file("../websites/mysite/../private/data/log.txt", "ab");
local f = file("../websites/mysite/../private/data/logs/log.txt", "ab");
local f = file("../websites/mysite/../private/data/misc/logs/log.txt", "ab");

However, the following operations will all fail:

local f = file("../websites/MySite/../private/passwords.txt", "rb");
local f = file("/websites/mysite/../private/passwords.txt", "rb");
local f = file("../websites/mysite/../private/log.txt", "wb");
local f = file("../websites/mysite/../private/data/../data/log.txt", "wb");
local f = file("websites/mysite/../private/log.txt", "rb");
local f = file("websites/mysite/../private/log.txt", "wb");
local f = file("websites/mysite/../private/log.txt", "ab");

Limiting Access To Temporary Files

INTEGRAL Application Server uses the numeric website prefix to generate the corresponding formatted website prefix — this is simply a string that begins with the letters "dw", followed by the numeric website prefix formatted to be precisely 5 digits in length (the leading zero digits are prepended automatically) and, finally, the underscore (_) character. For example, if the value of the WEBSITE_PREFIX keyword is 123, then the formatted website prefix will be

dw00123_

INTEGRAL Application Server uses the formatted website prefix to create temporary filenames for any files that are owned by the website and its INTEGRAL DSL programs. For example, any temporary files that are owned by the website whose numeric website prefix is 123 will have a filename that always begins with the dw00123_ prefix. This prefix makes it easy to differentiate between the website's temporary files and any other files in the temporary folder.

This fact can be used to limit access to the files in the temporary folder. For example, the following line allows the website whose numeric website prefix is 123 (and its INTEGRAL DSL programs) to update (read and write) its own temporary files, but not any other files:

!LIMIT_PATH_PREFIX_U=system/tmp/dw00123_

Of course, the assumption is that the same numeric website prefix 123 is not assigned to any other website on the same server.