diff --git a/common/lib/capa/capa/safe_exec/safe_exec.py b/common/lib/capa/capa/safe_exec/safe_exec.py index 2424fd4dc4..1a33c88bca 100644 --- a/common/lib/capa/capa/safe_exec/safe_exec.py +++ b/common/lib/capa/capa/safe_exec/safe_exec.py @@ -50,9 +50,19 @@ LAZY_IMPORTS = "".join(LAZY_IMPORTS) @statsd.timed('capa.safe_exec.time') def safe_exec(code, globals_dict, random_seed=None, python_path=None, cache=None): """ - Exec python code safely. + Execute python code safely. - `cache` is an object with .get(key) and .set(key, value) methods. + `code` is the Python code to execute. It has access to the globals in `globals_dict`, + and any changes it makes to those globals are visible in `globals_dict` when this + function returns. + + `random_seed` will be used to see the `random` module available to the code. + + `python_path` is a list of directories to add to the Python path before execution. + + `cache` is an object with .get(key) and .set(key, value) methods. It will be used + to cache the execution, taking into account the code, the values of the globals, + and the random seed. """ # Check the cache for a previous result.