├── docs ├── _static │ ├── logo.png │ └── logo-small.png ├── source │ ├── index.rst │ └── conf.py └── Makefile ├── master ├── requirements.txt ├── Dockerfile ├── buildbot.tac ├── templates │ └── home.jade ├── README.rst └── master.cfg ├── worker └── Dockerfile ├── plugins ├── trufflehog │ ├── Dockerfile │ └── tasks.py ├── gittyleaks │ ├── Dockerfile │ └── tasks.py ├── api-key-detect │ ├── Dockerfile │ └── tasks.py ├── git-secrets │ ├── Dockerfile │ └── tasks.py ├── git-hound │ ├── Dockerfile │ └── tasks.py └── README.rst ├── .gitignore ├── README.rst └── LICENSE /docs/_static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BBVA/gitsec/HEAD/docs/_static/logo.png -------------------------------------------------------------------------------- /docs/_static/logo-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BBVA/gitsec/HEAD/docs/_static/logo-small.png -------------------------------------------------------------------------------- /master/requirements.txt: -------------------------------------------------------------------------------- 1 | buildbot 2 | buildbot-washer==0.0.6 3 | buildbot-www 4 | environconfig 5 | pyyaml 6 | docker 7 | pyjade 8 | -------------------------------------------------------------------------------- /worker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM bbvalabsci/buildbot-washer-worker:latest 2 | RUN apk update && apk upgrade && apk add --no-cache git 3 | RUN touch notasks.py 4 | CMD ["/washer/entrypoint.sh", "notasks.py"] 5 | -------------------------------------------------------------------------------- /plugins/trufflehog/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM andmyhacks/trufflehog 2 | 3 | COPY --from=bbvalabsci/buildbot-washer-worker:latest /washer /washer 4 | COPY tasks.py /washer/ 5 | ENTRYPOINT ["/washer/entrypoint.sh"] 6 | CMD ["/washer/tasks.py"] 7 | -------------------------------------------------------------------------------- /plugins/gittyleaks/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.6 2 | RUN pip install gittyleaks 3 | 4 | COPY --from=bbvalabsci/buildbot-washer-worker:latest /washer /washer 5 | COPY tasks.py /washer/ 6 | ENTRYPOINT ["/washer/entrypoint.sh"] 7 | CMD ["/washer/tasks.py"] 8 | -------------------------------------------------------------------------------- /master/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.6 2 | RUN mkdir /gitsec 3 | WORKDIR /gitsec 4 | COPY requirements.txt ./ 5 | RUN pip install -r requirements.txt 6 | COPY master.cfg buildbot.tac ./ 7 | COPY templates ./templates 8 | CMD ["buildbot", "start", "--nodaemon"] 9 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../README.rst 2 | 3 | .. toctree:: 4 | :maxdepth: 2 5 | :caption: Contents: 6 | 7 | 8 | 9 | Indices and tables 10 | ================== 11 | 12 | * :ref:`genindex` 13 | * :ref:`modindex` 14 | * :ref:`search` 15 | -------------------------------------------------------------------------------- /plugins/api-key-detect/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:2.7 2 | RUN git clone https://github.com/daylen/api-key-detect.git 3 | 4 | COPY --from=bbvalabsci/buildbot-washer-worker:latest /washer /washer 5 | COPY tasks.py /washer/ 6 | 7 | ENTRYPOINT ["/washer/entrypoint.sh"] 8 | CMD ["/washer/tasks.py"] 9 | -------------------------------------------------------------------------------- /plugins/git-secrets/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.6 2 | RUN git clone https://github.com/awslabs/git-secrets 3 | RUN cd git-secrets && make install 4 | 5 | COPY --from=bbvalabsci/buildbot-washer-worker:latest /washer /washer 6 | COPY tasks.py /washer/ 7 | 8 | ENTRYPOINT ["/washer/entrypoint.sh"] 9 | CMD ["/washer/tasks.py"] 10 | -------------------------------------------------------------------------------- /plugins/git-hound/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.6 2 | RUN wget -O git-hound https://github.com/ezekg/git-hound/releases/download/0.6.2/git-hound_linux_amd64 && chmod +x git-hound 3 | 4 | COPY --from=bbvalabsci/buildbot-washer-worker:latest /washer /washer 5 | COPY tasks.py /washer/ 6 | 7 | ENTRYPOINT ["/washer/entrypoint.sh"] 8 | CMD ["/washer/tasks.py"] 9 | -------------------------------------------------------------------------------- /master/buildbot.tac: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | from twisted.application import service 5 | from twisted.python import log 6 | from buildbot.master import BuildMaster 7 | 8 | configfile = 'master.cfg' 9 | umask = None 10 | basedir = os.path.abspath(os.path.dirname(__file__)) 11 | application = service.Application('buildmaster') 12 | log.startLogging(sys.stderr) 13 | 14 | m = BuildMaster(basedir, configfile, umask) 15 | m.setServiceParent(application) 16 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = gitsec 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /plugins/trufflehog/tasks.py: -------------------------------------------------------------------------------- 1 | from washer.worker.actions import AppendStdout, AppendStderr 2 | from washer.worker.actions import CreateNamedLog, AppendToLog 3 | from washer.worker.commands import washertask 4 | 5 | 6 | @washertask 7 | def main(repopath, **kwargs): 8 | import invoke 9 | c = invoke.Context() 10 | 11 | res = c.run("trufflehog --json %r" % repopath, warn=True) 12 | 13 | yield AppendStdout(res.stdout) 14 | yield AppendStderr(res.stderr) 15 | 16 | if res.stdout: 17 | # We found something 18 | yield CreateNamedLog("secrets") 19 | yield AppendToLog("secrets", res.stdout) 20 | # Repo has suspicious data FAILURE! 21 | return False 22 | else: 23 | # Repo is clear SUCCESS! 24 | return True 25 | -------------------------------------------------------------------------------- /plugins/gittyleaks/tasks.py: -------------------------------------------------------------------------------- 1 | from washer.worker.actions import AppendStdout, AppendStderr 2 | from washer.worker.actions import CreateNamedLog, AppendToLog 3 | from washer.worker.commands import washertask 4 | 5 | 6 | @washertask 7 | def main(repopath, **kwargs): 8 | import invoke 9 | c = invoke.Context() 10 | 11 | with c.cd(repopath): 12 | res = c.run("gittyleaks --find-anything", warn=True) 13 | 14 | yield AppendStdout(res.stdout) 15 | yield AppendStderr(res.stderr) 16 | 17 | lines = res.stdout.splitlines() 18 | if lines: 19 | matches = not (lines[-1] == "No matches.") 20 | if matches: 21 | yield CreateNamedLog("secrets") 22 | yield AppendToLog("secrets", "\n".join(lines[3:])) 23 | return False 24 | 25 | return True 26 | -------------------------------------------------------------------------------- /plugins/api-key-detect/tasks.py: -------------------------------------------------------------------------------- 1 | from washer.worker.actions import AppendStdout, AppendStderr 2 | from washer.worker.actions import CreateNamedLog, AppendToLog 3 | from washer.worker.commands import washertask 4 | 5 | 6 | @washertask 7 | def main(repopath, **kwargs): 8 | import invoke 9 | c = invoke.Context() 10 | 11 | res = c.run("python /api-key-detect/api_key_detect.py %r" % repopath, 12 | warn=True) 13 | 14 | yield AppendStdout(res.stdout) 15 | yield AppendStderr(res.stderr) 16 | 17 | found = "Line" in res.stdout and "Entropy" in res.stdout 18 | if found: 19 | # We found something 20 | yield CreateNamedLog("secrets") 21 | yield AppendToLog( 22 | "secrets", 23 | "\n".join(res.stdout.splitlines()[3:])) 24 | # Repo has suspicious data FAILURE! 25 | return False 26 | else: 27 | # Repo is clear SUCCESS! 28 | return True 29 | -------------------------------------------------------------------------------- /master/templates/home.jade: -------------------------------------------------------------------------------- 1 | style(type='text/css'). 2 | .custom-block { 3 | display: none; 4 | } 5 | .custom-block[id*='/'] { 6 | display: block; 7 | } 8 | .custom-block[id*='['] { 9 | display: none; 10 | } 11 | 12 | .container 13 | .row(ng-if="config.buildbotURL != baseurl") 14 | .alert.alert-danger Warning: 15 | | c['buildbotURL'] is misconfigured to 16 | pre {{config.buildbotURL}} 17 | | Should be: 18 | pre {{baseurl}} 19 | .row 20 | .col-sm-12 21 | .well 22 | h2 Welcome to gitsec! 23 | h4 {{ buildsRunning.length }} build{{ buildsRunning.length == 1 ? '' : 's' }} running currently 24 | ul 25 | li.unstyled(ng-repeat="build in buildsRunning | filter:complete:false") 26 | buildsticker(build="build") 27 | h4 {{ recentBuilds.length }} recent builds 28 | .row 29 | .col-md-4.custom-block( 30 | id="{{ builder.name }}" 31 | ng-repeat="builder in builders | filter:hasBuilds") 32 | .panel.panel-primary 33 | .panel-heading 34 | h4.panel-title 35 | a(ui-sref="builder({builder: builder.builderid})") {{ builder.name }} 36 | .panel-body 37 | span(ng-repeat="build in builder.builds | orderBy:'-number'") 38 | buildsticker(build="build", builder="builder") 39 | -------------------------------------------------------------------------------- /plugins/git-hound/tasks.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from washer.worker.actions import AppendStdout, AppendStderr 4 | from washer.worker.actions import CreateNamedLog, AppendToLog 5 | from washer.worker.actions import AppendHeader 6 | from washer.worker.commands import washertask 7 | 8 | 9 | @washertask 10 | def main(repopath, prohibited=None, allowed=None, **kwargs): 11 | import invoke 12 | c = invoke.Context() 13 | 14 | if prohibited is None: 15 | prohibited = dict() 16 | 17 | if allowed is None: 18 | allowed = dict() 19 | 20 | with open(os.path.join(repopath, ".githound.yml"), "w") as config: 21 | for section, values in [("fail", prohibited), 22 | ("skip", allowed)]: 23 | 24 | config.write(f"{section}:\n") 25 | for name, value in values.items(): 26 | if value.get("type", "regex") == "regex": 27 | pattern = value.get("value", None) 28 | if pattern: 29 | config.write(f" - {pattern!r}\n") 30 | 31 | with c.cd(repopath): 32 | res = c.run("git log -p | /git-hound sniff", warn=True) 33 | 34 | yield AppendStdout(res.stdout) 35 | yield AppendStderr(res.stderr) 36 | 37 | secrets = "\n".join([l for l in res.stdout.splitlines() 38 | if l.startswith("failure: ")]) 39 | if secrets: 40 | # We found something 41 | yield CreateNamedLog("secrets") 42 | yield AppendToLog("secrets", secrets) 43 | # Repo has suspicious data FAILURE! 44 | return False 45 | else: 46 | # Repo is clear SUCCESS! 47 | return True 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | -------------------------------------------------------------------------------- /plugins/git-secrets/tasks.py: -------------------------------------------------------------------------------- 1 | from washer.worker.actions import AppendStdout, AppendStderr 2 | from washer.worker.actions import CreateNamedLog, AppendToLog, AppendHeader 3 | from washer.worker.commands import washertask 4 | 5 | 6 | @washertask 7 | def main(repopath, prohibited=None, allowed=None, **kwargs): 8 | import invoke 9 | c = invoke.Context() 10 | 11 | def add_patterns(patterns, isallowed): 12 | isallowed = "--allowed" if isallowed else "" 13 | for name, extra in patterns.items(): 14 | isliteral = "-l" if extra.get("type", "regex") == "literal" else "" 15 | pattern = extra.get("value", None) 16 | if pattern is None: 17 | yield AppendStderr(f"Invalid pattern {name!r}\n") 18 | else: 19 | cmd = f"git secrets --add --global {isallowed} {isliteral} {pattern!r}" 20 | yield AppendHeader(cmd + "\n") 21 | 22 | res = c.run(cmd, warn=True) 23 | if res.exited != 0: 24 | yield AppendStderr(f"Error adding pattern {name!r}\n") 25 | else: 26 | yield AppendStdout(f"Added pattern {name!r}\n") 27 | 28 | if prohibited is not None: 29 | yield from add_patterns(prohibited, False) 30 | 31 | if allowed is not None: 32 | yield from add_patterns(allowed, True) 33 | 34 | with c.cd(repopath): 35 | res = c.run(f"git secrets --scan-history {repopath!r}", 36 | warn=True) 37 | 38 | yield AppendStdout(res.stdout) 39 | yield AppendStderr(res.stderr) 40 | 41 | found = res.stderr 42 | if found: 43 | # We found something 44 | yield CreateNamedLog("secrets") 45 | yield AppendToLog("secrets", res.stderr) 46 | # Repo has suspicious data FAILURE! 47 | return False 48 | else: 49 | # Repo is clear SUCCESS! 50 | return True 51 | -------------------------------------------------------------------------------- /plugins/README.rst: -------------------------------------------------------------------------------- 1 | Create a New Plugin 2 | =================== 3 | 4 | A plugin is a *docker image* containing three things: 5 | 6 | #. The buildbot worker. 7 | 8 | #. The tool to run for detecting secrets. 9 | 10 | #. The washer task. A python function to be executed by the worker in order to 11 | run the tool and translate the results. 12 | 13 | The typical procedure to create a new plugin is the following. 14 | 15 | #. Create a **Dockerfile** to build an image with the tool installed. Maybe the 16 | tool creator already provides one, if this is the case we only need to start 17 | from it. 18 | 19 | .. code-block:: dockerfile 20 | 21 | FROM myawesometool 22 | 23 | #. Copy the buildbot-washer worker. 24 | 25 | .. code-block:: dockerfile 26 | 27 | FROM myawesometool 28 | COPY --from=bbvalabsci/buildbot-washer-worker:latest /washer /washer 29 | ENTRYPOINT ["/washer/entrypoint.sh"] 30 | 31 | #. Create the tasks.py file and add it to the *docker image*. 32 | 33 | .. code-block:: python 34 | 35 | from subprocess import check_output 36 | from washer.worker.actions import CreateNamedLog, AppendToLog 37 | from washer.worker.commands import washertask 38 | 39 | @washertask 40 | def main(repopath, **kwargs): 41 | output = check_output(f"myawesometool {repopath}") 42 | if output: 43 | # Something found! 44 | yield CreateNamedLog("secrets") 45 | yield AppendToLog("secrets", output) 46 | return False # Make the build FAIL 47 | else: 48 | # Nothing found, return SUCCESS 49 | return True 50 | 51 | 52 | Finally add the tasks file to the *Dockerfile* and set it as the 53 | default command. 54 | 55 | .. code-block:: dockerfile 56 | 57 | FROM myawesometool 58 | COPY --from=bbvalabsci/buildbot-washer-worker:latest /washer /washer 59 | COPY tasks.py /washer/ 60 | ENTRYPOINT ["/washer/entrypoint.sh"] 61 | CMD ["/washer/tasks.py"] 62 | 63 | 64 | At this point your plugin is ready to be build: 65 | 66 | .. code-block:: bash 67 | 68 | docker build . -t myawesomeplugin 69 | 70 | 71 | You can publish the image in your docker registry of preference. 72 | 73 | After the plugin is published you can include it in the configuration file as 74 | any other plugin. 75 | 76 | You can check some examples in this directory. 77 | 78 | If you build a plugin for a public tool don't hesitate to send a **pull request**. 79 | -------------------------------------------------------------------------------- /master/README.rst: -------------------------------------------------------------------------------- 1 | Master Configuration 2 | ==================== 3 | 4 | Master is configured with environment variables only. This is a list of 5 | variables you can customize to fit your needs. 6 | 7 | ========================= ============================= ===================================== 8 | Variable Default Description 9 | ========================= ============================= ===================================== 10 | DOCKER_HOST "unix://var/run/docker.sock" URI of the docker 11 | daemon gitsec shall use to spawn new 12 | workers. 13 | WORKER_IMAGE_AUTOPULL "on" Pull the docker images 14 | of defined plugins at runtime when 15 | if needed. 16 | WORKER_INSTANCES 16 Maximum number of parallel tasks. 17 | WORKER_IMAGE_WHITELIST "*" Comma separated list of shell-like 18 | expressions defining the allowed 19 | docker images. 20 | BUILDBOT_WORKER_PORT 9989 Port used for master<->worker 21 | communication. 22 | BUILDBOT_WEB_URL "http://localhost:8010/" Web UI absolute URL. 23 | BUILDBOT_WEB_PORT 8010 Port the webserver to bind to. 24 | BUILDBOT_WEB_HOST "localhost" Address the webserver to bind to. 25 | BUILDBOT_DB_URL "sqlite://" Database URI in SQLAlchemy format. 26 | ENABLE_GITHUB_HOOK "on" Enable Github webhook integration. 27 | GITHUB_HOOK_SECRET Github webhook secret token. 28 | ENABLE_BITBUCKET_HOOK "on" Enable Bitbucket webhook integration. 29 | GITSEC_SERVER_CONFIG When this file is 30 | provided the server will run the set 31 | of defined plugins independently of the 32 | user config. 33 | GITSEC_WORKER_IMAGE bbvalabsci/gitsec-worker Worker image used to basic bootstrapping. 34 | ========================= ============================= ===================================== 35 | 36 | 37 | -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Configuration file for the Sphinx documentation builder. 4 | # 5 | # This file does only contain a selection of the most common options. For a 6 | # full list see the documentation: 7 | # http://www.sphinx-doc.org/en/master/config 8 | 9 | # -- Path setup -------------------------------------------------------------- 10 | 11 | # If extensions (or modules to document with autodoc) are in another directory, 12 | # add these directories to sys.path here. If the directory is relative to the 13 | # documentation root, use os.path.abspath to make it absolute, like shown here. 14 | # 15 | # import os 16 | # import sys 17 | # sys.path.insert(0, os.path.abspath('.')) 18 | 19 | 20 | # -- Project information ----------------------------------------------------- 21 | 22 | project = 'gitsec' 23 | copyright = '2018, Roberto Abdelkader Martínez Pérez' 24 | author = 'Roberto Abdelkader Martínez Pérez' 25 | 26 | # The short X.Y version 27 | version = '' 28 | # The full version, including alpha/beta/rc tags 29 | release = '' 30 | 31 | 32 | # -- General configuration --------------------------------------------------- 33 | 34 | # If your documentation needs a minimal Sphinx version, state it here. 35 | # 36 | # needs_sphinx = '1.0' 37 | 38 | # Add any Sphinx extension module names here, as strings. They can be 39 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 40 | # ones. 41 | extensions = [ 42 | 'sphinx.ext.autodoc', 43 | 'sphinx.ext.doctest', 44 | 'sphinx.ext.viewcode', 45 | ] 46 | 47 | # Add any paths that contain templates here, relative to this directory. 48 | templates_path = ['_templates'] 49 | 50 | # The suffix(es) of source filenames. 51 | # You can specify multiple suffix as a list of string: 52 | # 53 | # source_suffix = ['.rst', '.md'] 54 | source_suffix = '.rst' 55 | 56 | # The master toctree document. 57 | master_doc = 'index' 58 | 59 | # The language for content autogenerated by Sphinx. Refer to documentation 60 | # for a list of supported languages. 61 | # 62 | # This is also used if you do content translation via gettext catalogs. 63 | # Usually you set "language" from the command line for these cases. 64 | language = None 65 | 66 | # List of patterns, relative to source directory, that match files and 67 | # directories to ignore when looking for source files. 68 | # This pattern also affects html_static_path and html_extra_path . 69 | exclude_patterns = [] 70 | 71 | # The name of the Pygments (syntax highlighting) style to use. 72 | pygments_style = 'sphinx' 73 | 74 | 75 | # -- Options for HTML output ------------------------------------------------- 76 | 77 | # The theme to use for HTML and HTML Help pages. See the documentation for 78 | # a list of builtin themes. 79 | # 80 | html_theme = 'alabaster' 81 | 82 | # Theme options are theme-specific and customize the look and feel of a theme 83 | # further. For a list of options available for each theme, see the 84 | # documentation. 85 | # 86 | # html_theme_options = {} 87 | 88 | # Add any paths that contain custom static files (such as style sheets) here, 89 | # relative to this directory. They are copied after the builtin static files, 90 | # so a file named "default.css" will overwrite the builtin "default.css". 91 | html_static_path = ['_static'] 92 | 93 | # Custom sidebar templates, must be a dictionary that maps document names 94 | # to template names. 95 | # 96 | # The default sidebars (for documents that don't match any pattern) are 97 | # defined by theme itself. Builtin themes are using these templates by 98 | # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', 99 | # 'searchbox.html']``. 100 | # 101 | # html_sidebars = {} 102 | 103 | 104 | # -- Options for HTMLHelp output --------------------------------------------- 105 | 106 | # Output file base name for HTML help builder. 107 | htmlhelp_basename = 'gitsecdoc' 108 | 109 | 110 | # -- Options for LaTeX output ------------------------------------------------ 111 | 112 | latex_elements = { 113 | # The paper size ('letterpaper' or 'a4paper'). 114 | # 115 | # 'papersize': 'letterpaper', 116 | 117 | # The font size ('10pt', '11pt' or '12pt'). 118 | # 119 | # 'pointsize': '10pt', 120 | 121 | # Additional stuff for the LaTeX preamble. 122 | # 123 | # 'preamble': '', 124 | 125 | # Latex figure (float) alignment 126 | # 127 | # 'figure_align': 'htbp', 128 | } 129 | 130 | # Grouping the document tree into LaTeX files. List of tuples 131 | # (source start file, target name, title, 132 | # author, documentclass [howto, manual, or own class]). 133 | latex_documents = [ 134 | (master_doc, 'gitsec.tex', 'gitsec Documentation', 135 | 'Roberto Abdelkader Martínez Pérez', 'manual'), 136 | ] 137 | 138 | 139 | # -- Options for manual page output ------------------------------------------ 140 | 141 | # One entry per manual page. List of tuples 142 | # (source start file, name, description, authors, manual section). 143 | man_pages = [ 144 | (master_doc, 'gitsec', 'gitsec Documentation', 145 | [author], 1) 146 | ] 147 | 148 | 149 | # -- Options for Texinfo output ---------------------------------------------- 150 | 151 | # Grouping the document tree into Texinfo files. List of tuples 152 | # (source start file, target name, title, author, 153 | # dir menu entry, description, category) 154 | texinfo_documents = [ 155 | (master_doc, 'gitsec', 'gitsec Documentation', 156 | author, 'gitsec', 'One line description of project.', 157 | 'Miscellaneous'), 158 | ] 159 | 160 | 161 | # -- Extension configuration ------------------------------------------------- -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | gitsec 2 | ====== 3 | 4 | gitsec is an *automated secret discovery service* for **git** that helps you 5 | detect sensitive data leaks. 6 | 7 | gitsec doesn't directly detect sensitive data but uses already available open 8 | source tools with this purpose and provides a framework to run them as one. 9 | 10 | .. image:: https://raw.githubusercontent.com/BBVA/gitsec/develop/docs/_static/logo-small.png 11 | :target: http://gitsec.readthedocs.org/ 12 | 13 | 14 | Architecture 15 | ------------ 16 | 17 | gitsec is build upon buildbot_ and buildbot-washer_ therefore inheriting their 18 | architecture. 19 | 20 | Master processes receive code changes from git repositories. 21 | When a change is detected, workers are spawned to run the defined plugins on 22 | the configuration file(s). 23 | 24 | The **master** process runs on a *docker* container and spawns **workers** in 25 | new containers as needed. The master process is a regular *buildbot* master 26 | with gitsec's specific configuration. Worker processes are *buildbot* worker 27 | processes with an specific *buildbot-washer* task registered. 28 | 29 | 30 | Plugins 31 | ------- 32 | 33 | =============== =================================== =========================================== 34 | Project Image Summary 35 | =============== =================================== =========================================== 36 | api-key-detect_ `bbvalabsci/gitsec-api-key-detect`_ Scan a codebase for API keys and passwords 37 | git-hound_ `bbvalabsci/gitsec-git-hound`_ Git plugin that prevents sensitive data 38 | from being committed 39 | git-secrets_ `bbvalabsci/gitsec-git-secrets`_ Prevents you from committing secrets and 40 | credentials into git repositories 41 | gittyleaks_ `bbvalabsci/gitsec-gittyleaks`_ Find sensitive information for a git repo 42 | trufflehog_ `bbvalabsci/gitsec-trufflehog`_ Searches through git repositories for 43 | high entropy strings and secrets, digging 44 | deep into commit history 45 | =============== =================================== =========================================== 46 | 47 | 48 | Usage 49 | ----- 50 | 51 | In order to use **gitsec** you must follow these steps: 52 | 53 | #. Configure and deploy a master. 54 | #. Configure your GitHub repository or organization webhooks. 55 | #. (Optional) Add a *.gitsec.yml* configuration file to your project. 56 | 57 | 58 | Master Deployment 59 | ~~~~~~~~~~~~~~~~~ 60 | 61 | You can run the gitsec master process with docker this way: 62 | 63 | .. code-block:: bash 64 | 65 | docker run -ti -v/var/run/docker.sock:/var/run/docker.sock -p8010:8010 -p9989:9989 bbvalabsci/gitsec 66 | 67 | Master configuration documentation `is available here`_. 68 | 69 | 70 | Github Webhook Integration 71 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ 72 | 73 | You can set a Github webhook to trigger a *gitsec* analysis for a particular 74 | repository or for all the repositories in an organization. 75 | 76 | Follow `this guide`_ to add the webhook. 77 | 78 | You should set a strong *secret* to the webhook, remember to pass the secret to 79 | your master using the **GITHUB_HOOK_SECRET** variable. 80 | 81 | The endpoint to point to shall be "http://YOUR-HOST-AND-POR-HERE/change_hook/github". 82 | 83 | 84 | 85 | Configuration File Format 86 | ------------------------- 87 | 88 | gitsec configuration is at least one YAML file defining the list of plugins to 89 | run for each source code change. 90 | 91 | Two configuration files may be defined: one in the server, another in the 92 | user's repository. The former, if present, is managed by the owner of the 93 | gitsec service and contains the list of plugins that must always run for a code 94 | change. The latter is managed by the source code repository owners and contains 95 | an extra list of plugins and configuration for that specific repository. 96 | 97 | This way a list of plugins may be enforced by the gitsec service owner and, at 98 | the same time, maintains flexibility for the developers to add their own checks. 99 | 100 | The configuration file format is YAML. 101 | 102 | This is an example of configuration file: 103 | 104 | 105 | .. code-block:: yaml 106 | 107 | plugins: 108 | bbvalabsci/gitsec-git-secrets: 109 | options: 110 | prohibited: 111 | password: 112 | value: '^password:' 113 | type: regex 114 | bbvalabsci/gitsec-api-key-detect: 115 | unimportant: yes 116 | bbvalabsci/gitsec-trufflehog: 117 | bbvalabsci/gitsec-gittyleaks: 118 | 119 | 120 | - The *plugins* key contains the list of plugins. In the example 4 plugins are defined. 121 | 122 | - Each plugin section is defined by the name of the **docker image to run**. 123 | 124 | - The plugin section may contain the following keys: 125 | 126 | - *unimportant* (yes|no): If **yes** the failure of this plugin will not 127 | make the whole check to fail. 128 | 129 | - *options*: The parameter passed to the plugin. Depends on the 130 | plugin. 131 | 132 | 133 | Create a New Plugin 134 | ------------------- 135 | 136 | If you want to create a gitsec plugin for a tool of yours, or for any other 137 | already available tool, follow the instructions `given here`_. 138 | 139 | If you want your plugin to be part of gitsec distribution, please send a **pull 140 | request** adding the plugin files in a directory under the `plugins` directory. 141 | 142 | 143 | I've just committed a secret! How I fix it?? 144 | -------------------------------------------- 145 | 146 | https://help.github.com/articles/removing-sensitive-data-from-a-repository/ 147 | 148 | 149 | .. _api-key-detect: https://github.com/daylen/api-key-detect 150 | .. _git-hound: https://github.com/ezekg/git-hound 151 | .. _git-secrets: https://github.com/awslabs/git-secrets 152 | .. _gittyleaks: https://hub.docker.com/r/bbvalabsci/gitsec-gittyleaks/ 153 | .. _trufflehog: https://github.com/dxa4481/truffleHog 154 | .. _buildbot: https://buildbot.net 155 | .. _buildbot-washer: https://github.com/BBVA/buildbot-washer/ 156 | .. _`bbvalabsci/gitsec-api-key-detect`: https://hub.docker.com/r/bbvalabsci/gitsec-api-key-detect/ 157 | .. _`bbvalabsci/gitsec-git-hound`: https://hub.docker.com/r/bbvalabsci/gitsec-git-hound/ 158 | .. _`bbvalabsci/gitsec-git-secrets`: https://hub.docker.com/r/bbvalabsci/gitsec-git-secrets/ 159 | .. _`bbvalabsci/gitsec-gittyleaks`: https://hub.docker.com/r/bbvalabsci/gitsec-gittyleaks/ 160 | .. _`bbvalabsci/gitsec-trufflehog`: https://hub.docker.com/r/bbvalabsci/gitsec-trufflehog/ 161 | .. _`this guide`: https://developer.github.com/webhooks/creating/#setting-up-a-webhook 162 | .. _`given here`: https://github.com/BBVA/gitsec/tree/develop/plugins 163 | .. _`is available here`: https://github.com/BBVA/gitsec/tree/develop/master 164 | -------------------------------------------------------------------------------- /master/master.cfg: -------------------------------------------------------------------------------- 1 | # -*- python -*- 2 | # ex: set syntax=python: 3 | """ 4 | This is a sample buildmaster config file. It must be installed as 5 | 'master.cfg' in your buildmaster's base directory. 6 | """ 7 | 8 | from fnmatch import fnmatch 9 | import os 10 | import yaml 11 | 12 | from twisted.python import log 13 | from buildbot.plugins import * 14 | from environconfig import EnvironConfig 15 | from environconfig import (StringVar, IntVar, BooleanVar, CustomVar, MethodVar, 16 | ListVar, PathVar) 17 | 18 | # This is the dictionary that the buildmaster pays attention to. We also use 19 | # a shorter alias to save typing. 20 | c = BuildmasterConfig = {} 21 | 22 | 23 | ####### ENVIRONMENT 24 | 25 | @CustomVar.new 26 | def ImagePatternVar(patternstr): 27 | patterns = patternstr.split(',') 28 | return (lambda name: any(fnmatch(name, p) for p in patterns)) 29 | 30 | 31 | class Config(EnvironConfig): 32 | DOCKER_HOST = StringVar(default="unix://var/run/docker.sock") 33 | WORKER_IMAGE_AUTOPULL = BooleanVar(default=True) 34 | WORKER_INSTANCES = IntVar(default=16) 35 | 36 | # Comma separated list of allowed image shell-like patterns. By default '*' 37 | WORKER_IMAGE_WHITELIST = ImagePatternVar(default=lambda name: True) 38 | 39 | @MethodVar 40 | def WASHER_FORCE_GATEWAY(env): 41 | if (env.DOCKER_HOST.startswith('unix://') 42 | or "localhost" in env.DOCKER_HOST): 43 | return "1" 44 | else: 45 | return "0" 46 | 47 | BUILDBOT_MQ_URL = StringVar(default=None) 48 | BUILDBOT_MQ_REALM = StringVar(default="buildbot") 49 | BUILDBOT_MQ_DEBUG = BooleanVar(default=False) 50 | 51 | BUILDBOT_WORKER_PORT = IntVar(default=9989) 52 | 53 | BUILDBOT_WEB_URL = StringVar(default="http://localhost:8010/") 54 | BUILDBOT_WEB_PORT = IntVar(default=8010) 55 | BUILDBOT_WEB_HOST = StringVar(default="localhost") 56 | 57 | # This specifies what database buildbot uses to store its state. You can leave 58 | # this at its default for all but the largest installations. 59 | BUILDBOT_DB_URL = StringVar(default="sqlite://") 60 | 61 | ENABLE_GITHUB_HOOK = BooleanVar(default=True) 62 | GITHUB_HOOK_SECRET = StringVar(default=None) 63 | ENABLE_BITBUCKET_HOOK = BooleanVar(default=True) 64 | 65 | @MethodVar 66 | def CHANGE_HOOK_CONFIG(env): 67 | changehook = dict() 68 | 69 | if env.ENABLE_GITHUB_HOOK: 70 | changehook["github"] = {} 71 | if env.GITHUB_HOOK_SECRET is not None: 72 | changehook["github"]["secret"] = env.GITHUB_HOOK_SECRET 73 | changehook["github"]["strict"] = True 74 | 75 | if env.ENABLE_BITBUCKET_HOOK: 76 | changehook["bitbucketcloud"] = True 77 | 78 | return changehook 79 | 80 | GITSEC_SERVER_CONFIG = PathVar(default=None) 81 | GITSEC_WORKER_IMAGE = StringVar(default="bbvalabsci/gitsec-worker") 82 | 83 | 84 | ####### WORKERS 85 | 86 | docker_workers = ["docker-%d" % i for i in range(Config.WORKER_INSTANCES)] 87 | 88 | c['workers'] = [] 89 | c['workers'] += [worker.WasherDockerLatentWorker( 90 | name, 91 | None, 92 | docker_host=Config.DOCKER_HOST, 93 | environment={"WASHER_FORCE_GATEWAY": Config.WASHER_FORCE_GATEWAY}, 94 | image=util.Property("task_image", default=Config.GITSEC_WORKER_IMAGE), 95 | autopull=Config.WORKER_IMAGE_AUTOPULL, 96 | followStartupLogs=True) 97 | for name in docker_workers] 98 | 99 | if Config.BUILDBOT_MQ_URL is not None: 100 | c['mq'] = { 101 | 'type': 'wamp', 102 | 'router_url': Config.BUILDBOT_MQ_URL, 103 | 'realm': Config.BUILDBOT_MQ_REALM, 104 | 'debug': Config.BUILDBOT_MQ_DEBUG, 105 | 'debug_websockets': Config.BUILDBOT_MQ_DEBUG, 106 | 'debug_lowlevel': Config.BUILDBOT_MQ_DEBUG} 107 | 108 | c['protocols'] = {'pb': {'port': Config.BUILDBOT_WORKER_PORT}} 109 | 110 | 111 | ####### CHANGESOURCES 112 | 113 | c['change_source'] = [] 114 | 115 | 116 | ####### SCHEDULERS 117 | 118 | c['schedulers'] = [ 119 | schedulers.AnyBranchScheduler( 120 | name="launch", 121 | treeStableTimer=1, 122 | builderNames=["launch"]), 123 | schedulers.Triggerable( 124 | name="bootstrap", 125 | builderNames=["bootstrap"]), 126 | schedulers.Triggerable( 127 | name="analyze", 128 | builderNames=["analyze"]) 129 | ] 130 | 131 | 132 | ####### BUILDERS 133 | 134 | def process_yml_cfg(step): 135 | def launch_from_yaml(yamlstr): 136 | config = yaml.load(yamlstr) 137 | 138 | for plugin, config in config["plugins"].items(): 139 | task_image, *task_name = plugin.split("#", 1) 140 | 141 | 142 | # Is an allowed image? 143 | allowed_image = Config.WORKER_IMAGE_WHITELIST(task_image) 144 | if not allowed_image: 145 | log.err("Worker image %r is not allowed" % task_image) 146 | continue 147 | 148 | # Task name 149 | if not task_name: 150 | task_name = "main" 151 | else: 152 | task_name = task_name[0] 153 | 154 | # 155 | # Task args 156 | # 157 | if config is None: 158 | config = dict() 159 | 160 | unimportant = config.get("unimportant", False) 161 | options = config.get("options", {}) 162 | options["repopath"] = step.getProperty("repopath") 163 | 164 | # 165 | # Trigger tasks 166 | # 167 | for sched in step.schedulerNames: 168 | yield {"sched_name": sched, 169 | "props_to_set": { 170 | "task_image": task_image, 171 | "task_name": task_name, 172 | "task_args": options, 173 | "virtual_builder_name": f"{step.getProperty('project')}[{task_image}:{task_name}]"}, 174 | "unimportant": unimportant} 175 | 176 | # Server config 177 | if Config.GITSEC_SERVER_CONFIG is not None: 178 | try: 179 | with open(Config.GITSEC_SERVER_CONFIG, "r") as content: 180 | yield from launch_from_yaml(content) 181 | except Exception as exc: 182 | log.err("Error loading server config. %r" % exc) 183 | 184 | # User config 185 | if step.config is not None: 186 | yield from launch_from_yaml(step.config) 187 | 188 | 189 | launch_factory = util.BuildFactory() 190 | launch_factory.addStep( 191 | steps.Trigger(schedulerNames=["bootstrap"], 192 | set_properties={"virtual_builder_name": util.Property("project")})) 193 | 194 | bootstrap_factory = util.BuildFactory() 195 | bootstrap_factory.addStep(steps.SetProperty("repopath", "/work")) 196 | bootstrap_factory.addStep( 197 | steps.Git( 198 | repourl=util.Property("repository"), 199 | workdir=util.Property("repopath"))) 200 | bootstrap_factory.addStep( 201 | steps.TriggerFromFile( 202 | waitForFinish=True, 203 | configfile=util.Interpolate("%(prop:repopath)s/.gitsec.yml"), 204 | processor=process_yml_cfg, 205 | schedulerNames=["analyze"])) 206 | 207 | analyze_factory = util.BuildFactory() 208 | analyze_factory.addStep(steps.SetProperty("repopath", "/work")) 209 | analyze_factory.addStep( 210 | steps.Git( 211 | repourl=util.Property("repository"), 212 | workdir=util.Property("repopath"))) 213 | analyze_factory.addStep( 214 | steps.WasherTask( 215 | task_name=util.Property("task_name"), 216 | task_args=util.Property("task_args"))) 217 | 218 | 219 | c['builders'] = [] 220 | c['builders'].append( 221 | util.BuilderConfig( 222 | name="launch", 223 | workernames=docker_workers, 224 | factory=launch_factory)) 225 | 226 | c['builders'].append( 227 | util.BuilderConfig( 228 | name="bootstrap", 229 | workernames=docker_workers, 230 | factory=bootstrap_factory)) 231 | c['builders'].append( 232 | util.BuilderConfig( 233 | name="analyze", 234 | workernames=docker_workers, 235 | factory=analyze_factory)) 236 | 237 | 238 | ####### PROJECT IDENTITY 239 | 240 | c['title'] = "GitSec" 241 | c['titleURL'] = "https://github.com/BBVA/gitsec" 242 | c['buildbotURL'] = Config.BUILDBOT_WEB_URL 243 | c['www'] = dict(port=Config.BUILDBOT_WEB_PORT, 244 | plugins=dict(), 245 | change_hook_dialects=Config.CHANGE_HOOK_CONFIG, 246 | custom_templates_dir="templates") 247 | 248 | 249 | ####### DB URL 250 | 251 | c['db'] = {'db_url' : Config.BUILDBOT_DB_URL} 252 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright © 2018 Banco Bilbao Vizcaya Argentaria S.A. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------