Skip to content

Commit

Permalink
Merge pull request #128 from mekanix/security
Browse files Browse the repository at this point in the history
Add bandit to CI
  • Loading branch information
mekanix authored Dec 13, 2023
2 parents d163531 + 2d77190 commit 408ed3a
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ jobs:
- name: Test and lint
run: |
bin/test.sh
- name: Security
run: |
bin/security.sh
9 changes: 9 additions & 0 deletions bin/security.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

BIN_DIR=`dirname $0`
export FREENIT_ENV="test"
. ${BIN_DIR}/common.sh


setup no
bandit `find freenit -type f -name '*.py'`
6 changes: 3 additions & 3 deletions freenit/base_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(
self,
server="mail.example.com",
user="[email protected]",
password="Secrit",
password="Secrit", #nosec
port=587,
tls=True,
from_addr="[email protected]",
Expand Down Expand Up @@ -69,7 +69,7 @@ class BaseConfig:
dburl = "sqlite:///db.sqlite"
database = None
engine = None
secret = "SECRET"
secret = "SECRET" #nosec
user = "freenit.models.ormar.user"
role = "freenit.models.ormar.role"
theme = "freenit.models.ormar.theme"
Expand Down Expand Up @@ -121,4 +121,4 @@ class TestConfig(BaseConfig):


class ProdConfig(BaseConfig):
secret = "MORESECURESECRET"
secret = "MORESECURESECRET" #nosec
2 changes: 1 addition & 1 deletion freenit/project/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
if __name__ == "__main__":
uvicorn.run(
"NAME.app:app",
host="0.0.0.0",
host="0.0.0.0", #nosec
port=config.port,
log_level="info",
reload=True,
Expand Down
2 changes: 1 addition & 1 deletion freenit/project/project/base_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ class TestConfig(BaseConfig):


class ProdConfig(BaseConfig):
secret = "MORESECURESECRET"
secret = "MORESECURESECRET" #nosec
2 changes: 1 addition & 1 deletion freenit/project/tests/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ async def test_get_user_list(self, client):
await admin.save()
client.login(user=admin)
response = client.get(f"/users")
assert response.status_code == 200
assert response.status_code == 200 #nosec
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
],
"test": [
"aiosqlite",
"bandit",
"black",
"httpx",
"isort",
Expand Down

0 comments on commit 408ed3a

Please sign in to comment.