Skip to content

Commit

Permalink
Fix: Remove value from CVE Description primary key
Browse files Browse the repository at this point in the history
Fix the db model of the CVE Description. There should only be one
description per CVE and language. Currently inserting a description may
fail because the value is too long for the primary key btree index.
  • Loading branch information
bjoernricks authored and greenbonebot committed Jun 11, 2024
1 parent 87e9271 commit 9cd9696
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion greenbone/scap/cve/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ async def _insert_cve_descriptions(
index_elements=[
CVEDescriptionModel.cve_id,
CVEDescriptionModel.lang,
CVEDescriptionModel.value,
],
set_=dict(
cve_id=statement.excluded.cve_id,
Expand Down
2 changes: 1 addition & 1 deletion greenbone/scap/cve/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class CVEDescriptionModel(Base):

cve_id: Mapped[cve_fk] = mapped_column(primary_key=True)
lang: Mapped[str] = mapped_column(primary_key=True)
value: Mapped[str] = mapped_column(primary_key=True)
value: Mapped[str]

cve: Mapped[CVEModel] = relationship(back_populates="descriptions")

Expand Down

0 comments on commit 9cd9696

Please sign in to comment.