fluidasserts.lang.python module

This module allows to check Python code vulnerabilities.

fluidasserts.lang.python.LANGUAGE_SPECS = {'block_comment_end': None, 'block_comment_start': None, 'extensions': ('py',), 'line_comment': ('#',)}
fluidasserts.lang.python.has_generic_exceptions(py_dest, exclude=None)

Search for generic exceptions in a Python script or package.

Parameters
  • py_dest (str) – Path to a Python script or package.

  • exclude (Optional[list]) – Paths that contains any string from this list are ignored.

Return type

bool

fluidasserts.lang.python.swallows_exceptions(py_dest, exclude=None)

Search for swallowed exceptions.

Identifies except blocks that are either empty or only contain comments or the pass statement.

Parameters
  • py_dest (str) – Path to a Python script or package.

  • exclude (Optional[list]) – Paths that contains any string from this list are ignored.

Return type

bool

fluidasserts.lang.python.uses_insecure_functions(py_dest, exclude=None)

Search for insecure functions in code.

Powered by Bandit.

Parameters
  • py_dest (str) – Path to a Python script or package.

  • exclude (Optional[list]) – Paths that contains any string from this list are ignored.

Return type

bool