Skip to content

Commit 38b3d0e

Browse files
Fixing the vulnerabiltities
1 parent 9c99fae commit 38b3d0e

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

dataherald/sql_generator/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def get_upper_bound_limit(cls) -> int:
7272
return top_k if isinstance(top_k, int) else int(top_k)
7373

7474
def extract_cve_ids(self, query: str) -> list:
75-
return re.findall(r"CVE-\d{4}-\d{4,7}", query)
75+
return list(set(re.findall(r"CVE-\d{4}-\d{4,7}", query)))
7676

7777
def create_sql_query_status(
7878
self, db: SQLDatabase, query: str, sql_generation: SQLGeneration

dataherald/sql_generator/dataherald_sqlagent.py

+2-14
Original file line numberDiff line numberDiff line change
@@ -682,22 +682,10 @@ def augment_prompt(self, user_prompt: Prompt, storage: DB) -> None: # noqa: C90
682682
vulnerability = vulnerabilities.find_by({"cve_id": cve})[0]
683683
if vulnerability:
684684
if vulnerability.description:
685-
extra_info = f"{cve} is {vulnerability.description}. "
685+
extra_info = f"{cve} is {vulnerability.description}.\n "
686686
if vulnerability.affected_versions:
687687
extra_info += (
688-
f"{cve} affect the {vulnerability.affected_versions}"
689-
)
690-
if vulnerability.date_reserved:
691-
extra_info += (
692-
f"{cve} was reserved on {vulnerability.date_reserved}"
693-
)
694-
if vulnerability.date_updated:
695-
extra_info += (
696-
f"{cve} was updated on {vulnerability.date_updated}"
697-
)
698-
if vulnerability.published_date:
699-
extra_info += (
700-
f"{cve} was published on {vulnerability.published_date}"
688+
f"{cve} affects the followig packages:\n {vulnerability.affected_versions}\n"
701689
)
702690
if vulnerability.hotfix_ids:
703691
extra_info += f"{cve} is fixed in the following patches which can be found in patches.hotfix_id: {', '.join(vulnerability.hotfix_ids)}" # noqa: E501

0 commit comments

Comments
 (0)