Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/build_validation_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ jobs:
TYPESCRIPT_ES_CONFIG_FILE: ../../ui/app/eslint.config.js
TSX_CONFIG_FILE: ../../ui/app/eslint.config.js

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"

- name: Install Bandit
if: ${{ steps.filter.outputs.core == 'true' }}
run: pip install bandit

- name: Run Bandit security checks
if: ${{ steps.filter.outputs.core == 'true' }}
run: bandit -c pyproject.toml -r .


- name: Docs validation
if: ${{ steps.filter.outputs.docs == 'true' }}
run: |
Expand Down
8 changes: 7 additions & 1 deletion api_app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,10 @@ def get_application() -> FastAPI:
FastAPIInstrumentor.instrument_app(app)

if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000, loop="asyncio")
uvicorn.run(
app,
host="0.0.0.0",
port=8000,
loop="asyncio",
) # nosec B104 - intended for containerized deployment

13 changes: 10 additions & 3 deletions api_app/models/domain/costs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,16 @@ class CurrencyEnum(StrEnum):

def generate_cost_row_dict_example(granularity: GranularityEnum, currency: CurrencyEnum):
return dict({
"cost": random.uniform(0, 365), "currency": currency, "date":
(datetime.today() - timedelta(
days=-1 * random.randint(0, 1000))).date() if granularity == GranularityEnum.daily else None
"cost": random.uniform(0, 365), # nosec B311 - non-cryptographic random for sample data
"currency": currency,
"date":(
datetime.today()
- timedelta(
days=-1 * random.randint(0, 1000) # nosec B311 - non-cryptographic random for sample data
)
).date()
if granularity == GranularityEnum.daily
else None,
})


Expand Down
13 changes: 13 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tool.bandit]
exclude_dirs = [
"api_app/tests_ma",
"airlock_processor/tests",
"resource_processor/tests_rp",
"e2e_tests",
".venv",
"venv"
]

skips = [
"B101", # asserts in test code
]
2 changes: 1 addition & 1 deletion resource_processor/helpers/httpserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):


def start_server():
server = ThreadedHTTPServer(('0.0.0.0', 8080), RequestHandler)
server = ThreadedHTTPServer(('0.0.0.0', 8080), RequestHandler) # nosec B104 - intended for containerized/dev use
server.serve_forever()