Skip to content

Commit

Permalink
Add bandit to the quality tools
Browse files Browse the repository at this point in the history
Adding the bandit tool to the toolbox.

And fix some trivial py3 syntax errors in the op3 example so it doesn't blow up right away.
  • Loading branch information
schlenk committed Apr 15, 2019
1 parent de5d6e4 commit c1470bb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ help:
@echo " test to run the tests"
@echo " isort to sort imports"
@echo " blacken to format the code"
@echo " bandit to run some simple security checkers"
.PHONY: help

clean:
Expand Down Expand Up @@ -55,6 +56,10 @@ check-black:
@pipenv run black src/ --check
.PHONY: blacken check-black

bandit:
@pipenv run bandit -a file -r src/ oauth_example/ oidc_example/
.PHONY: bandit

check-pylama:
@pipenv run pylama $(OICDIR) $(TESTDIR)
.PHONY: check-pylama
Expand Down
8 changes: 5 additions & 3 deletions oidc_example/op3/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import traceback
import argparse
import importlib
import logging

from mako.lookup import TemplateLookup

from oic import rndstr
Expand Down Expand Up @@ -243,7 +245,7 @@ def meta_info(self, environ, start_response):
]}
"""
print '\n in meta-info'
print('\n in meta-info')
pass

def webfinger(self, environ, start_response):
Expand Down Expand Up @@ -275,7 +277,7 @@ def application(self, environ, start_response):
"""
path = environ.get('PATH_INFO', '').lstrip('/')

print 'start_response: ', start_response
print('start_response: ', start_response)

if path == "robots.txt":
return static(self, environ, start_response, "static/robots.txt")
Expand Down Expand Up @@ -470,7 +472,7 @@ def mako_renderer(template_name, context):
server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', config.PORT), _app.application)
server.ssl_adapter = BuiltinSSLAdapter(config.SERVER_CERT, config.SERVER_KEY)

print "OIDC Provider server started (issuer={}, port={})".format(config.ISSUER, config.PORT)
print("OIDC Provider server started (issuer={}, port={})".format(config.ISSUER, config.PORT))

try:
server.start()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def run_tests(self):
'develop': ["cherrypy==3.2.4", "pyOpenSSL"],
'testing': tests_requires,
'docs': ['Sphinx', 'sphinx-autobuild', 'alabaster'],
'quality': ['pylama', 'isort', 'eradicate', 'mypy', 'black'],
'quality': ['pylama', 'isort', 'eradicate', 'mypy', 'black', 'bandit'],
'ldap_authn': ['pyldap'],
},
install_requires=[
Expand Down

0 comments on commit c1470bb

Please sign in to comment.