Comments across the codebase credited one individual by role and, in places, described that person's own machines: which SQL Server versions a host ran, which devices were enrolled, what a particular dashboard showed, how many findings sat open on which server. In a public repository that reads as a profile of someone's unpatched estate. The observations are why the code looks the way it does, so they stay. Every CVE id, version, build number, count and date is preserved, as are the verbatim quotes that motivated specific sort and filter rules — only the attribution changes, to "field report", "observed", "a host". A local variable in tests/test_autodesk_year.py was renamed for the same reason; its value and every assertion around it are byte-identical. PROJECT_OVERVIEW.md additionally loses a subtitle naming the kind of organisation this was built for, and a support section pointing at an internal team, both replaced with neutral wording. Comments, docstrings and markdown prose only: 74 files, 200 lines, one-for-one swaps. detect_changes reports 104 touched symbols and zero affected execution flows, and all 55 test scripts pass. Nothing here needs re-testing.
49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
"""Add network-exposure columns to assets
|
|
|
|
Revision ID: 026
|
|
Revises: 025
|
|
Create Date: 2026-05-31 16:00:00.000000
|
|
|
|
Field request: use Wazuh IT-hygiene (open listeners / ports) as an
|
|
extra risk dimension — a host with an exposed VNC/RDP/Telnet listener
|
|
is network-vulnerabler regardless of its CVE count.
|
|
|
|
Columns on `assets`:
|
|
network_exposure_score FLOAT 0-100, computed from risky listeners
|
|
exposed_services TEXT JSON list of {port, proto, service, risk}
|
|
exposure_updated_at TIMESTAMP
|
|
|
|
Idempotent — ADD COLUMN IF NOT EXISTS.
|
|
"""
|
|
from alembic import op
|
|
|
|
|
|
revision = "026"
|
|
down_revision = "025"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.execute("""
|
|
ALTER TABLE assets
|
|
ADD COLUMN IF NOT EXISTS network_exposure_score DOUBLE PRECISION,
|
|
ADD COLUMN IF NOT EXISTS exposed_services TEXT,
|
|
ADD COLUMN IF NOT EXISTS exposure_updated_at TIMESTAMP;
|
|
""")
|
|
op.execute("""
|
|
CREATE INDEX IF NOT EXISTS ix_assets_network_exposure_score
|
|
ON assets (network_exposure_score)
|
|
WHERE network_exposure_score > 0;
|
|
""")
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.execute("DROP INDEX IF EXISTS ix_assets_network_exposure_score;")
|
|
op.execute("""
|
|
ALTER TABLE assets
|
|
DROP COLUMN IF EXISTS network_exposure_score,
|
|
DROP COLUMN IF EXISTS exposed_services,
|
|
DROP COLUMN IF EXISTS exposure_updated_at;
|
|
""")
|