Skip to content

Commit 8f3a0f4

Browse files
committed
Resolve migration conflict and fix null text bug
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent 8139472 commit 8f3a0f4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

vulnerabilities/migrations/0106_detectionrule.py renamed to vulnerabilities/migrations/0116_detectionrule.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Generated by Django 4.2.25 on 2025-12-16 12:27
1+
# Generated by Django 5.2.11 on 2026-03-19 01:11
22

3-
from django.db import migrations, models
43
import django.db.models.deletion
4+
from django.db import migrations, models
55

66

77
class Migration(migrations.Migration):
88

99
dependencies = [
10-
("vulnerabilities", "0105_packagecommitpatch_patch_and_more"),
10+
("vulnerabilities", "0115_impactedpackageaffecting_and_more"),
1111
]
1212

1313
operations = [

vulnerabilities/pipelines/v2_improvers/yara_rules.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from vulnerabilities.models import DetectionRule
1515
from vulnerabilities.models import DetectionRuleTypes
1616
from vulnerabilities.pipelines import VulnerableCodePipeline
17+
from vulnerabilities.utils import get_advisory_url
1718

1819

1920
class YaraRulesImproverPipeline(VulnerableCodePipeline):
@@ -100,11 +101,20 @@ def collect_and_store_rules(self):
100101
raw_text = file_path.read_text(encoding="utf-8", errors="ignore")
101102
if not raw_text:
102103
continue
104+
raw_text = raw_text.replace("\x00", "")
105+
106+
repo_url = repo_url[4::]
107+
rule_url = get_advisory_url(
108+
file=file_path,
109+
base_path=base_directory,
110+
url=f"{repo_url}/blob/master/",
111+
)
103112

104113
DetectionRule.objects.update_or_create(
105114
rule_text=raw_text,
106115
rule_type=DetectionRuleTypes.YARA,
107116
advisory=None,
117+
source_url=rule_url,
108118
)
109119

110120
def clean_downloads(self):

0 commit comments

Comments
 (0)