Restrict scripting for cloud sessions

Option to restrict scripting via cloud clients

To ensure certain restrictions when accessing local resources of the Cloud Server hosts via the cloud clients, there is the Restrict scripting option to limit scripting and preventing file access and importing non-Vertec modules.

In the Cloud Suite, this option is always activated and cannot be turned off.

Restrict scripting has the following consequences:

  • A sandbox is introduced for Python. Only modules that are on the whitelist can be imported.
  • VB scripts (available only in older Vertec On-Premises versions and not supported anymore) are not allowed. When run, an error is thrown.

Python Sandbox

The Python Sandbox is an isolated, secure environment in which Python code can be executed in restricted mode within Vertec.

The following modules can be imported:

Whitelist

As of Vertec 6.8.0.17, Vertec supports code in both Python 2 and Python 3. Depending on the Python version, there are few differences in the modules on the whitelist.  

Python 2 Python 3
datetime datetime
requests requests
math math
string string
re re
json json
_strptime _strptime
email email
email.message email.message
email.parser email.parser
email.generator email.generator
email.mime email.mime
email.mime.base email.mime.base
email.mime.nonmultipart email.mime.nonmultipart
email.mime.multipart email.mime.multipart
email.mime.application email.mime.application
email.mime.audio email.mime.audio
email.mime.image email.mime.image
email.mime.message email.mime.message
email.mime.text email.mime.text
email.header email.header
email.charset email.encoders
email.errors email.errors
email.utils email.utils
email.iterators email.iterators
smtplib smtplib
base64 base64
difflib difflib
textwrap textwrap
unicodedata unicodedata
stringprep stringprep
calendar calendar
collections collections
heapq heapq
bisect bisect
array array
decimal decimal
fractions fractions
random random
itertools itertools
functools functools
operator operator
hashlib hashlib
hmac hmac
time time
locale locale
traceback traceback
weakref weakref
zeep zeep
TypedJSONDecoder TypedJSONDecoder
isodate_validator isodate_validator
HttpDecorators HttpDecorators
urlparse urllib.parse
HTMLParser html.parser
StringIO io

The three Python 2 modules urlparse, HTMLParser and StringIO are part of the specified modules with Python 3 and must be imported accordingly:

Python 2 Python 3
import urlparse
import HTMLParser
import StringIO
from urllib.parse import urlparse
from html.parser import HTMLParser
from io import StringIO

In addition, the list of built-in, globally available symbols (functions and constants) is limited to:

['False’, 'None’, 'True’, 'abs’, 'basestring’, 'bool’, 'callable’, 'chr’, 'cmp’, 'complex’, 'divmod’, 'float’, 'hash’, 'hex’, 'Id’, 'int’, 'isinstance’, 'issubclass’, 'len’, 'long’, 'oct’, 'ord’, 'pow’, 'range’, 'repr’, 'round’, 'str’, 'tuple’, 'unichr’, 'unicode’, 'xrange’, 'zip’, 'apply’, “dict,” “enumerate,” “filter,” “getattr,” “hasattr,” “iter,” “list,” “HR,” “max,” “min,” “sum,” “all,” “any,” 'ArithmeticError’, 'AssertionError’, 'AttributeError’, 'BaseException’, 'Buffererror’, 'BytesWarning’, 'DeprecationWarning’, 'EOFError’, 'Ellipsis’, 'EnvironmentError’, 'Exception’, 'FloatingPointError’, 'FutureWarning’, 'GeneratorExit’, 'IOError’, 'ImportError’, 'ImportWarning’, 'IndentationError’, 'IndexError’, 'KeyError’, 'KeyboardInterrupt’, 'LookupError’, 'MemoryError’, 'NameError’, 'NotImplemented’, 'NotImplementedError’, 'OSError’, 'OverflowError’, 'PendingDeprecationWarning’, 'ReferenceError’, 'RuntimeError’, 'RuntimeWarning’, 'StandardError’, 'StopIteration’, 'SyntaxError’, 'SyntaxWarning’, 'SystemError’, 'SystemExit’, 'TabError’, 'TypeError’, 'UnboundLocalError’, 'UnicodeDecodeError’, 'UnicodeEncodeError’, 'UnicodeError’, 'UnicodeTranslateError’, 'UnicodeWarning’, 'UserWarning’, 'ValueError’, 'Warning’, 'WindowsError’, 'ZeroDivisionError’, 'bin’, 'buffer’, 'bytearray’, 'bytes’, 'classmethod’, 'coerce’, 'delattr’, 'dir’, 'exec’, 'format’, 'frozenset’, 'help’, 'locals’, 'next’, 'object’, 'property’, 'reduce’, 'reload’, 'reversed’, 'setattr’, 'slice’, 'sorted’, 'staticmethod’, 'super’, 'type’]

Vertec Desktop App (On-Premises, legacy)

Restrict scripting does not work in the Desktop App. Therefore, the risky modules ctypes, win32*(all modules with win32 start), win2kras, winsound and winxpgui were installed from Vertec 6.7.0.7 in the PythonUnsafe subfolder in the Vertec installation directory. These modules and the PythonUnsafe folder will no longer be shipped with new installations as of Vertec 6.8.0.17.  

Netherlands

United Kingdom