Skip to content

Building 70 Projects ranging from beginner to advanced so anyone can β€” learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company πŸ‘‡

5.4 KB
Raw Blame
[project]
name = "api-security-scanner-backend"
version = "1.0.1"
description = "Backend API for security testing tool"
requires-python = ">=3.13"
authors = [
    {name = "CarerPerez-dev", email = "[email protected]"}
]
license = {text = "MIT"}

dependencies = [
    # FastAPI and server
    "fastapi==0.128.0",
    "uvicorn[standard]==0.40.0",
    "python-multipart===0.0.27",
    # Database
    "sqlalchemy==2.0.46",
    "psycopg2-binary==2.9.11",
    "alembic>=1.18.3",
    # Security
    "slowapi==0.1.9",
    "python-jose[cryptography]==3.5.0",
    "bcrypt==5.0.0",
    # HTTP client for scanners
    "requests==2.32.5",
    "httpx==0.28.1",
    "aiohttp==3.14.4",
    # Settings management
    "pydantic==2.12.5",
    "pydantic-settings==2.14.2",
    "python-dotenv==1.2.2",
    # Utilities
    "email-validator==2.3.0",
]

[project.optional-dependencies]
dev = [
    "pylint==4.0.4",
    "pre-commit==4.5.1",
    "pip-audit==2.10.0",
    "ruff==0.14.14",
    "mypy==1.19.1",
    "bandit[toml]==1.9.3",
    "yapf==0.43.0",
    "pylint-pydantic==0.4.1",
    "pylint-per-file-ignores==3.2.0",
    "pylint-plugin-utils==0.9.0",
    "pylint-pydantic==0.4.1"
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = [
    "main.py",
    "config.py",
    "factory.py",
    "core",
    "routes",
    "models",
    "schemas",
    "services",
    "scanners",
    "repositories",
]

[tool.ruff]
target-version = "py313"
line-length = 95
indent-width = 4
exclude = [
    ".bzr",
    ".direnv",
    ".eggs",
    ".git",
    ".git-rewrite",
    ".hg",
    ".ipynb_checkpoints",
    ".mypy_cache",
    ".nox",
    ".pyenv",
    ".pytest_cache",
    ".pytype",
    ".ruff_cache",
    ".svn",
    ".tox",
    ".venv",
    "__pycache__",
    "_build",
    "build",
    "dist",
    "site-packages",
    "venv",
    "migrations",
    "devtools",
    "main.py",
]

[tool.ruff.lint]
select = [
    "E1",   # Indentation
    "E4",   # Imports
    "E7",   # Statement
    "F",    # Pyflakes (all F rules)
    "W292", # No newline at end of file
    "W605", # Invalid escape sequence
    "B",    # Bugbear
    "C4",   # Comprehensions
    "UP",   # Pyupgrade
    "ARG",  # Unused arguments
    "SIM",  # Simplify
    "I",    # isort rules
    "F401", # Unused imports
    "F811", # Redefined imports
    "F821", # Undefined name
]

ignore = [
    "E501",   # Line length (handled by formatter)
    "W291",   # Trailing whitespace
    "W293",   # Blank line contains whitespace
    "I001",   # Import sorting
    "RUF001", # Ambiguous unicode
    "RUF002", # Docstring with ambiguous unicode
]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["ALL"]
"core/dependencies.py" = ["B008"]
"routes/auth.py" = ["ARG001", "B008"]
"routes/scans.py" = ["ARG001", "B008"]
"scanners/base_scanner.py" = ["B010"]


[tool.mypy]
python_version = "3.13"
mypy_path = "backend"
namespace_packages = true
explicit_package_bases = true
warn_return_any = false
warn_unused_configs = true
disallow_untyped_defs = false
disallow_incomplete_defs = true
ignore_missing_imports = true
check_untyped_defs = false
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
show_error_codes = true
show_column_numbers = true
pretty = true

exclude = [
    ".venv",
    "venv",
]

[[tool.mypy.overrides]]
module = [
    "models.*",
    "repositories.*",
    "core.security",
    "core.database",
    "scanners.*",
    "schemas.*",
    "services.*",
    "routes.*",
    "factory",
    "config",
]
disable_error_code = [
    "no-any-return",
    "assignment",
    "return-value",
    "arg-type",
    "var-annotated",
    "index",
    "attr-defined",
    "operator",
    "union-attr",
    "call-arg",
    "dict-item",
    "abstract",
    "import-untyped",
]


[tool.pylint.main]
py-version = "3.13"
jobs = 4
load-plugins = [
    "pylint_pydantic",
    "pylint_per_file_ignores"
]
persistent = true
suggestion-mode = true
init-hook = "import sys; import os; sys.path.insert(0, os.getcwd())"
ignore = [
    "venv",
    ".venv",
    "__pycache__",
    "build",
    "dist",
    ".git",
    ".pytest_cache",
    ".mypy_cache",
    ".ruff_cache",
]
ignore-paths = [
    "^venv/.*",
    "^.venv/.*",
    "^build/.*",
    "^dist/.*",
]
[tool.pylint.type-check]
generated-members = [
    "objects",
    "id",
    "get_or_create",
    "DoesNotExist",
    "MultipleObjectsReturned",
    "objects.get_or_create"
]

[tool.pylint.messages_control]
disable = [
    "C0111",  # missing-docstring
    "C0103",  # invalid-name
    "R0903",  # too-few-public-methods
    "W0511",  # fixme
    "W0622",  # redefined-builtin
    "W0612",  # unused-variable (handled by ruff)
    "W0613",  # unused-argument (handled by ruff)
    "C0301", # Line too long
    "C0302", # Too many lines
    "C0411", # Wrong import order
    "C0305", # Trailing newlines
    "C0303", # Trailing whitespace
    "C0304", # Final newline missing
    "R0801", # Similar lines (want exact duplicates only)
]

per-file-ignores = [
    "schemas/scan_schemas.py:C0415",
    "scanners/rate_limit_scanner.py:W0718",
    "scanners/auth_scanner.py:W0718",
    "scanners/sqli_scanner.py:W0718",
    "scanners/idor_scanner.py:W0718",
    "services/scan_service.py:W0718",
    "models/Base.py:E0213",
]

[tool.pylint.design]
max-args = 10
max-attributes = 12
max-branches = 13
max-locals = 20
max-statements = 40


[tool.bandit]
exclude_dirs = [
    ".venv",
    "venv",
]
skips = ["B104"]