Пример #1
0
from fluidasserts.lang import python
from fluidasserts.lang import docker
from fluidasserts.sca import pypi

ASSERTS_DIRS = ['fluidasserts', 'test']
DOCKERFILES = ['Dockerfile.builder', 'Dockerfile.base', 'Dockerfile.runner']
EXCLUDED_DIRS = ['test/static']

for adir in ASSERTS_DIRS:
    python.swallows_exceptions(adir, EXCLUDED_DIRS)
    python.has_generic_exceptions(adir, EXCLUDED_DIRS)

for dockerfile in DOCKERFILES:
    docker.not_pinned(dockerfile)
pypi.project_has_vulnerabilities('.')
Пример #2
0
#!/usr/bin/python3

from fluidasserts.lang import python
from fluidasserts.lang import javascript
from fluidasserts.sca import pypi
from fluidasserts.sca import npm
import os

try:
    project_dir = os.environ["CI_PROJECT_DIR"]
except KeyError:
    project_dir = os.getcwd()

py_dest = project_dir
python.swallows_exceptions(py_dest)
python.has_generic_exceptions(py_dest)

js_dest = project_dir + '/app/assets/app'
javascript.has_switch_without_default(js_dest)
javascript.swallows_exceptions(js_dest)
javascript.has_insecure_randoms(js_dest)
javascript.uses_console_log(js_dest)

dep_cont = project_dir + '/deploy/containers/deps/'
pypi.project_has_vulnerabilities(dep_cont)

front = project_dir + '/front/'
npm.project_has_vulnerabilities(front)
Пример #3
0
def test_swallows_exceptions_in_dir_open():
    """Search switch without default clause."""
    assert python.swallows_exceptions(CODE_DIR)
Пример #4
0
def test_swallows_exceptions_close():
    """Code swallows exceptions."""
    assert not python.swallows_exceptions(SECURE_CODE)
    assert not python.swallows_exceptions(NON_EXISTANT_CODE)
    assert not python.swallows_exceptions(CODE_DIR, exclude=['test'])
Пример #5
0
def test_swallows_exceptions_open():
    """Code swallows exceptions."""
    assert python.swallows_exceptions(INSECURE_CODE)