A
DirectoryStream
that defines operations on files that are located relative to an open directory. A
SecureDirectoryStream
is intended for use by sophisticated or security sensitive applications requiring to traverse file trees or otherwise operate on directories in a race-free manner. Race conditions can arise when a sequence of file operations cannot be carried out in isolation. Each of the file operations defined by this interface specify a relative path. All access to the file is relative to the open directory irrespective of if the directory is moved or replaced by an attacker while the directory is open. A
SecureDirectoryStream
may also be used as a virtual
working directory .
A SecureDirectoryStream
requires corresponding support from the underlying operating system. Where an implementation supports this features then the DirectoryStream
returned by the newDirectoryStream
method will be a SecureDirectoryStream
and must be cast to that type in order to invoke the methods defined by this interface.
In the case of the default provider
, and a security manager is set, then the permission checks are performed using the path obtained by resolving the given relative path against the original path of the directory (irrespective of if the directory is moved since it was opened).