Option, um das Scripting via Cloud-Clients einzuschränken
Um beim Zugriff auf lokale Ressourcen des Cloud Hosts via Cloud Clients gewisse Einschränkungen gewährleisten zu können, gibt es die Restrict Scripting Option, um das Scripting einzuschränken. So können Dateizugriffe und das Importieren von Nicht-Vertec-Modulen verhindert werden.
Im Cloud Abo ist diese Option immer aktiviert und kann nicht ausgeschaltet werden.
Das Restrict Scripting hat folgende Konsequenzen:
Die Einstellung wirkt nur für Cloud-Sessions (Cloud Server), nicht in der Vertec Desktop App.
Die Python Sandbox ist eine isolierte, gesicherte Umgebung, in welcher Python Code innerhalb von Vertec im Restricted Modus ausgeführt werden kann.
Darin können folgende Module importiert werden:
Alle Python Module, welche auf der Whitelist stehen
Ab Vertec 6.8.0.17 unterstützt Vertec sowohl Code in Python 2 als auch in Python 3. Je nach Python Version gibt es wenige Unterschiede bei den Modulen auf der Whitelist.
| Python 2 | Python 3 |
|---|---|
| datetime | datetime |
| requests | requests |
| math | math |
| string | string |
| re | re |
| json | json |
| _strptime | _strptime |
| 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 |
| llm_api_adapter | |
| urlparse | urllib.parse |
| HTMLParser | html.parser |
| StringIO | io |
Die drei (fettgedruckten) Python 2 Module urlparse, HTMLParser und StringIO sind mit Python 3 Bestandteil der dort angegebenen Module und müssen entsprechend importiert werden:
| Python 2 | Python 3 |
|---|---|
import urlparse import HTMLParser import StringIO |
from urllib.parse import urlparse from html.parser import HTMLParser from io import StringIO |
Zusätzlich ist die Liste der eingebauten, global verfügbaren Symbole (Funktionen und Konstanten) im Restricted Modus auf folgende beschränkt:
['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", "map", "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', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'super', 'type']
Restrict Scripting funktioniert nicht in der Desktop App. Um auch diese besser zu schützen, befinden sich ab Vertec 6.7.0.7 die riskanten Module ctypes, win32* (sämtliche Module die mit win32 beginnen), win2kras, winsound und winxpgui im Unterordner PythonUnsafe im Vertec Installationsverzeichnis. Dieser Ordner sollte gelöscht werden, falls die Module nicht verwendet werden, um auch die Desktop App besser zu schützen.
Diese Module sowie der PythonUnsafe Ordner werden ab Vertec 6.8.0.17 bei neuen Installationen nicht mehr ausgeliefert.