From 2000ceca5449358b7b08eebf59a0b6413bebd787 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Sat, 28 Nov 2026 02:17:51 +0100 Subject: [PATCH] Add `flake8-bandit` --- noxfile.py | 1 + pyproject.toml | 3 +- src/velofy/forecasts/timify.py | 2 +- uv.lock | 76 +++++++++++++++++++++++++++++++++- 4 files changed, 78 insertions(+), 4 deletions(-) diff --git a/noxfile.py b/noxfile.py index 8cdb4fe..e46459f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -182,6 +182,7 @@ def lint_code(session: Session) -> None: session, 'flake8', 'flake8-annotations', + 'flake8-bandit', 'flake8-black', 'flake8-pyproject', 'flake8-pytest-style', diff --git a/pyproject.toml b/pyproject.toml index ddbe4cf..bfd816c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,6 +91,7 @@ dev = [ # Code Analyzers "flake8 (>=7.5.0,<8.0.0)", "flake8-annotations (>=3.3.1,<4.0.0)", + "flake8-bandit (>=4.1.1,<5.0.0)", "flake8-black (>=0.5.0,<0.6.0)", "flake8-pyproject (>=1.2.4,<2.0.0)", "flake8-pytest-style (>=2.2.0,<3.0.0)", @@ -244,8 +245,6 @@ per-file-ignores = [ "migrations/versions/*.py:ANN0,ANN2,S608", # Type annotations are not strictly enforced. "noxfile.py:ANN0,ANN2", - # No SQL injection as the inputs come from a safe source. - "src/velofy/forecasts/timify.py:S608", # - ANN0, ANN2 => Type annotations are not strictly enforced. # - D106 => The `Meta` class inside the factory_boy models do not need a docstring. # - S101 => `assert` statements are ok in the test suite. diff --git a/src/velofy/forecasts/timify.py b/src/velofy/forecasts/timify.py index 5fa4cf7..dd78c1b 100644 --- a/src/velofy/forecasts/timify.py +++ b/src/velofy/forecasts/timify.py @@ -70,7 +70,7 @@ class OrderHistory: # This happens when there is no demand in the `Pixel` in the given `time_step`. data = pd.read_sql_query( sa.text( - f""" + f""" -- # noqa:S608 SELECT pixel_id, start_at, diff --git a/uv.lock b/uv.lock index e10bfbe..f334a29 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 3 +revision = 5 requires-python = ">=3.13, <4.0" resolution-markers = [ "python_full_version >= '3.15' and sys_platform == 'win32'", @@ -247,6 +247,21 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/71/3b/ddf4b07be846bfa361683729b5948c9c61a87fbdf09e69540d8e586bb7c5/babel-2.19.0-py3-none-any.whl", hash = "sha256:6d49734aed1d595b2c065d012174df8c83964692f26fc461702281634dd7555b", size = 10983582, upload-time = "2026-11-24T20:14:30.163Z" }, ] +[[package]] +name = "bandit" +version = "1.9.4" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "pyyaml" }, + { name = "rich" }, + { name = "stevedore" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/aa/c3/0cb80dfe0f3076e5da7e4c5ad8e57bac6ac357ff4a6406205501cade4965/bandit-1.9.4.tar.gz", hash = "sha256:b589e5de2afe70bd4d53fa0c1da6199f4085af666fde00e8a034f152a52cd628", size = 4242677, upload-time = "2026-02-25T06:44:15.503Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/05/a4/a26d5b25671d27e03afb5401a0be5899d94ff8fab6a698b1ac5be3ec29ef/bandit-1.9.4-py3-none-any.whl", hash = "sha256:f89ffa663767f5a0585ea075f01020207e966a9c0f2b9ef56a57c7963a3f6f8e", size = 134741, upload-time = "2026-02-25T06:44:13.694Z" }, +] + [[package]] name = "beautifulsoup4" version = "4.15.0" @@ -872,6 +887,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/f4/2b/ef0b4b0927b9f3a7034d3a76ee6e150c4b40459a8704132793cac43537be/flake8_annotations-3.3.1-py3-none-any.whl", hash = "sha256:64c926ccce95da4f666db6b04a7bfc8892118671a2b10cc339bbba9acf91ca70", size = 17264, upload-time = "2026-10-29T23:43:36.898Z" }, ] +[[package]] +name = "flake8-bandit" +version = "4.1.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "bandit" }, + { name = "flake8" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/77/1c/4f66a7a52a246d6c64312b5c40da3af3630cd60b27af81b137796af3c0bc/flake8_bandit-4.1.1.tar.gz", hash = "sha256:068e09287189cbfd7f986e92605adea2067630b75380c6b5733dab7d87f9a84e", size = 5403, upload-time = "2022-08-29T13:48:41.225Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e7/5f/55bab0ac89f9ad9f4c6e38087faa80c252daec4ccb7776b4dac216ca9e3f/flake8_bandit-4.1.1-py3-none-any.whl", hash = "sha256:4c8a53eb48f23d4ef1e59293657181a3c989d0077c9952717e98a0eace43e06d", size = 4828, upload-time = "2022-08-29T13:48:39.737Z" }, +] + [[package]] name = "flake8-black" version = "0.5.0" @@ -1689,6 +1717,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/6d/a0/053d6af3e8f871e0073b4a36732d9e65be77a72e5434c31b94f6af78a6bb/mako-1.4.3-py3-none-any.whl", hash = "sha256:723296007c870bfd6b3f0c3230dba7198096e5269297ebf5e4eff9e7ffa39d4f", size = 80164, upload-time = "2026-09-22T20:54:33.128Z" }, ] +[[package]] +name = "markdown-it-py" +version = "4.3.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "mdurl" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/16/fc/cee2c45553c9a9bf77d8b0c391560c556d7ed756b1f0bb35eb5d48db09ea/markdown_it_py-4.3.0.tar.gz", hash = "sha256:91a58fa5b72c71a40cf7177250fd767480d7a2bb3ac426ccfb76fb90305fdaaa", size = 242701, upload-time = "2026-11-10T16:18:30.467Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c9/31/5f0ac2f1a1c67423c995c731a11cd4ad05d081a2be969d74f868bdb9cc70/markdown_it_py-4.3.0-py3-none-any.whl", hash = "sha256:7aa1511a46c39138de78d9eba92ce47e63124d8003fc98b3a351909e04239efa", size = 96951, upload-time = "2026-11-10T16:18:28.975Z" }, +] + [[package]] name = "markupsafe" version = "3.0.4" @@ -1862,6 +1902,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/27/1a/1f68f9ba0c207934b35b86a8ca3aad8395a3d6dd7921c0686e23853ff5a9/mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e", size = 7350, upload-time = "2022-01-24T01:14:49.62Z" }, ] +[[package]] +name = "mdurl" +version = "0.1.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729, upload-time = "2022-08-14T12:40:10.846Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979, upload-time = "2022-08-14T12:40:09.779Z" }, +] + [[package]] name = "mistune" version = "3.4.0" @@ -2803,6 +2852,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7e/71/44ce230e1b7fadd372515a97e32a83011f906ddded8d03e3c6aafbdedbb7/rfc3987_syntax-1.1.0-py3-none-any.whl", hash = "sha256:6c3d97604e4c5ce9f714898e05401a0445a641cfa276432b0a648c80856f6a3f", size = 8046, upload-time = "2025-07-18T01:05:03.843Z" }, ] +[[package]] +name = "rich" +version = "15.0.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markdown-it-py" }, + { name = "pygments" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c0/8f/0722ca900cc807c13a6a0c696dacf35430f72e0ec571c4275d2371fca3e9/rich-15.0.0.tar.gz", hash = "sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36", size = 230680, upload-time = "2026-04-12T08:24:00.75Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/82/3b/64d4899d73f91ba49a8c18a8ff3f0ea8f1c1d75481760df8c68ef5235bf5/rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb", size = 310654, upload-time = "2026-04-12T08:24:02.83Z" }, +] + [[package]] name = "roman-numerals" version = "4.1.0" @@ -3315,6 +3377,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e3/eb/90a506dbee5cde669e2ef28565ff6b7a0791ab415eab2da82f92d033cccc/statsmodels-0.15.0-cp315-cp315t-win_arm64.whl", hash = "sha256:90df413d7e09474f7e7cbf8807440c1bf76298cdd9daabf9141f76d7627c9151", size = 11021454, upload-time = "2026-08-30T16:06:08.124Z" }, ] +[[package]] +name = "stevedore" +version = "5.10.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/7a/ec/b628c3b1613fe9340de1c5daba957f5b152159ac350b6ce4ad3d2469f822/stevedore-5.10.0.tar.gz", hash = "sha256:6005f32c09dc3159802a61c04862770e439e32db22f6da78ba56e8a735466882", size = 520466, upload-time = "2026-11-12T11:47:05.38Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/10/78/918aaff2864a8829d061db40acb9da04c89e5c3a01d65932b34432ebd78b/stevedore-5.10.0-py3-none-any.whl", hash = "sha256:47c48dc09e75933106c1bba0a7690eef3b5acecdb807df6d47cc40b2532fa927", size = 56789, upload-time = "2026-11-12T11:47:04.273Z" }, +] + [[package]] name = "terminado" version = "0.18.1" @@ -3461,6 +3532,7 @@ wheels = [ name = "velofy" version = "0.5.0.dev0" source = { editable = "." } +default-groups = "all" dependencies = [ { name = "alembic" }, { name = "click" }, @@ -3491,6 +3563,7 @@ dev = [ { name = "black" }, { name = "flake8" }, { name = "flake8-annotations" }, + { name = "flake8-bandit" }, { name = "flake8-black" }, { name = "flake8-pyproject" }, { name = "flake8-pytest-style" }, @@ -3542,6 +3615,7 @@ dev = [ { name = "black", specifier = ">=25.12.0,<26.0.0" }, { name = "flake8", specifier = ">=7.5.0,<8.0.0" }, { name = "flake8-annotations", specifier = ">=3.3.1,<4.0.0" }, + { name = "flake8-bandit", specifier = ">=4.1.1,<5.0.0" }, { name = "flake8-black", specifier = ">=0.5.0,<0.6.0" }, { name = "flake8-pyproject", specifier = ">=1.2.4,<2.0.0" }, { name = "flake8-pytest-style", specifier = ">=2.2.0,<3.0.0" },