Skip to content

Commit

Permalink
ci(sast): added Bandit
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienbrignon committed Jun 23, 2024
1 parent 01935c2 commit 42b70eb
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ jobs:
run: |
pip install poetry
make install
- name: Run linter
- name: Run Flake8
run: |
poetry run flake8
38 changes: 38 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Security

on:
workflow_dispatch:
push:

env:
PYTHON_VERSION: '3.12'

jobs:
lint:
name: Lint source code
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Poetry
run: |
pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: poetry
- name: Set up Poetry environment
env:
PYTHON_VERSION: ${{ env.PYTHON_VERSION }}
run: |
poetry env use ${PYTHON_VERSION}
- name: Install Python dependencies
run: |
pip install poetry
make install
- name: Run Bandit
run: |
poetry run bandit -r mkdocs_exporter
5 changes: 1 addition & 4 deletions mkdocs_exporter/formats/pdf/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ async def print(self, html: str) -> tuple[bytes, int]:
pages = int(await context.locator('body').get_attribute('mkdocs-exporter-pages') or 0)
pdf = await context.pdf(prefer_css_page_size=True, print_background=True, display_header_footer=False)

try:
os.unlink(file)
except Exception:
pass
os.unlink(file)

await context.close()

Expand Down
104 changes: 103 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ mkdocs-redirects = "^1.2.0"
mdx-truly-sane-lists = "^1.3"
mkdocstrings = {extras = ["python"], version = "^0.25.1"}
mkdocs-git-committers-plugin-2 = "^2.3.0"
bandit = "^1.7.9"

0 comments on commit 42b70eb

Please sign in to comment.