Add vulnerability scanner and WebSocket manager for scan notifications

- Implemented VulnerabilityScanner class to scan images for vulnerabilities using Trivy and NVD API.
- Added methods to parse and store vulnerability data in the database.
- Created WebSocketManager class to handle real-time notifications for scan status updates.
- Integrated WebSocket notifications for scan start, completion, and failure events.
This commit is contained in:
JSC
2025-07-10 22:57:00 +02:00
parent 7f8c47273a
commit 2c64c2c34d
11 changed files with 3042 additions and 14 deletions

View File

@@ -1,18 +1,78 @@
[project]
name = "backend"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = []
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[dependency-groups]
dev = ["black==25.1.0", "pytest==8.4.1", "ruff==0.12.2"]
[project]
name = "gitlab-docker-images-tracker"
version = "0.1.0"
description = "GitLab Docker Images Tracker with vulnerability scanning and lifecycle management"
authors = [
{name = "GitLab Docker Images Tracker", email = "noreply@example.com"},
]
dependencies = [
"fastapi>=0.104.0",
"uvicorn[standard]>=0.24.0",
"sqlalchemy>=2.0.0",
"python-gitlab>=4.0.0",
"pydantic>=2.0.0",
"python-multipart>=0.0.6",
"httpx>=0.25.0",
"pyyaml>=6.0.1",
"python-dateutil>=2.8.2",
"aiosqlite>=0.19.0",
"schedule>=1.2.0",
"requests>=2.31.0",
"python-dotenv>=1.0.0",
"websockets>=12.0",
"python-socketio>=5.10.0",
]
requires-python = ">=3.12"
readme = "README.md"
license = {text = "MIT"}
[tool.hatch.build.targets.wheel]
packages = ["."]
[project.optional-dependencies]
dev = [
"pytest>=7.0.0",
"pytest-asyncio>=0.21.0",
"black>=23.0.0",
"ruff>=0.1.0",
"mypy>=1.0.0",
"httpx>=0.25.0",
]
[tool.black]
line-length = 80
line-length = 88
target-version = ['py312']
[tool.ruff]
line-length = 80
lint.select = ["ALL"]
lint.ignore = ["D100", "D104"]
target-version = "py312"
line-length = 88
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
]
ignore = [
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"C901", # too complex
]
[tool.mypy]
python_version = "3.12"
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = true
strict_equality = true