Skip to content

Commit

Permalink
can successfully generate reports with the pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
lauraschauer authored and copernico committed Sep 2, 2024
1 parent 3ca4625 commit 4b81a31
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions prospector/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ services:
context: .
dockerfile: docker/worker/Dockerfile
volumes:
- ./app:/app
- ./:/app
# - ./pipeline/reports:/app/pipeline/reports
depends_on:
- redis
environment:
LOG_LEVEL: debug
PIP_REQUIREMENTS: requirements.txt
GIT_CACHE: /tmp
GIT_CACHE: /tmp/gitcache

db:
image: postgres
Expand Down
10 changes: 8 additions & 2 deletions prospector/pipeline/filter_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import requests
from psycopg2.extensions import parse_dsn
from psycopg2.extras import DictCursor, DictRow, Json
from tqdm import tqdm

from backenddb.postgres import PostgresBackendDB
from cli.console import ConsoleWriter, MessageStatus # noqa: E402
Expand Down Expand Up @@ -182,8 +183,13 @@ async def process_cve_data():
unprocessed_vulns = db.get_unprocessed_vulns()

# Process each entry
pbar = tqdm(
unprocessed_vulns,
desc="Processing raw CVE data",
unit="CVE record",
)
processed_vulns = []
for unprocessed_vuln in unprocessed_vulns:
for unprocessed_vuln in pbar:
entry_id = unprocessed_vuln[0]
raw_record = unprocessed_vuln[1]

Expand Down Expand Up @@ -224,7 +230,7 @@ async def map_entry(vuln):
"repo_url": data["git"],
"version_interval": version,
}
print(vuln["cve"]["id"])
# print(vuln["cve"]["id"]) # Sanity Check
return filtered_vuln

return None
Expand Down
11 changes: 6 additions & 5 deletions prospector/pipeline/job_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _run_prospector(
"backend_address": config.backend,
"git_cache": config.git_cache,
"limit_candidates": config.max_candidates,
"use_llm_repository_url": config.use_llm_repository_url,
"use_llm_repository_url": config.llm_service.use_llm_repository_url,
"enabled_rules": config.enabled_rules,
}

Expand All @@ -114,10 +114,11 @@ def _run_prospector(
results, advisory_record = prospector(**params)

generate_report(
results,
advisory_record,
"html",
f"{report_filepath}{cve_id}_{job_id}",
results=results,
advisory_record=advisory_record,
report_type=config.report.format,
report_filename=f"{report_filepath}{cve_id}_{job_id}",
prospector_params=params,
)
status = "finished"
results = (f"{report_filepath}{cve_id}_{job_id}",)
Expand Down
2 changes: 1 addition & 1 deletion prospector/pipeline/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pipeline.job_creation import enqueue_jobs


DAYS_AGO = 1 # Time period from DAYS_AGO to now to retrieve CVEs from NVD
DAYS_AGO = 5 # Time period from DAYS_AGO to now to retrieve CVEs from NVD


async def dispatch_jobs():
Expand Down

0 comments on commit 4b81a31

Please sign in to comment.