Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have multiple researchers in advisory PDF #204

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
have multiple researchers in advisory PDF
  • Loading branch information
blockisec committed Mar 27, 2024
commit 376712015ccecd4562017c476db4d39620db39c2
9 changes: 8 additions & 1 deletion frontend/src/views/pages/advisories/AdvisoryCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
severity: null,
vendor_name: null,
vendor_url: null,
researchers: null,
attachments: []
},
loading: false,
Expand All @@ -62,7 +63,8 @@ export default {
fixed_version: this.model.fixed_version,
severity: this.model.severity,
vendor_name: this.model.vendor_name,
vendor_url: this.model.vendor_url
vendor_url: this.model.vendor_url,
researchers: this.model.researchers
};
// create advisory first, so we can upload attachments afterward
let response = await this.service.createAdvisory(this.$api, data);
Expand Down Expand Up @@ -165,6 +167,11 @@ export default {
<label for="vendor_url">Vendor URL</label>
<InputText id="vendor_url" v-model="model.vendor_url"></InputText>
</div>
<div class="field col-12">
<label for="researchers">Researchers</label>
<InputText id="researchers" v-model="model.researchers"></InputText>
<small id="researchers-help">Overwrites the researchers section in the report (default: your display name).</small>
</div>
<div class="field col-12">
<label for="description">Description</label>
<MarkdownEditor v-model="model.description"></MarkdownEditor>
Expand Down
11 changes: 2 additions & 9 deletions frontend/src/views/pages/advisories/AdvisoryInbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,9 @@ export default {
v-model:filters="filters"
filter-display="menu"
@rowClick="onRowClick"
:show-search="true"
@search="onGlobalSearch"
>
<template #header>
<div class="grid">
<IconField iconPosition="left">
<InputIcon class="fa fa-search"></InputIcon>
<InputText @update:modelValue="onGlobalSearch" placeholder="Keyword Search" style="width: 100%" />
</IconField>
</div>
</template>

<Column field="pk" header="ID"> </Column>
<Column field="internal_name" header="Internal Name"></Column>
<Column field="vulnerability.name" header="Vulnerability"></Column>
Expand Down
14 changes: 3 additions & 11 deletions frontend/src/views/pages/advisories/AdvisoryList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export default {
}
},
methods: {
onSort() {},
onFilter() {
this.getItems();
},
Expand Down Expand Up @@ -105,16 +104,9 @@ export default {
@filter="onFilter"
filter-display="menu"
:filter="true"
@search="onGlobalSearch"
:show-search="true"
>
<template #header>
<div class="grid">
<IconField iconPosition="left">
<InputIcon class="fa fa-search"></InputIcon>
<InputText @update:modelValue="onGlobalSearch" placeholder="Keyword Search" style="width: 100%" />
</IconField>
</div>
</template>

<Column field="pk" header="ID"></Column>
<Column field="internal_name" header="Internal Name"></Column>
<Column field="vulnerability.name" header="Vulnerability"></Column>
Expand All @@ -135,7 +127,7 @@ export default {
<Column field="date_planned_disclosure" header="Planned Disclosure"></Column>
<Column header="Labels" field="labels" :showFilterMatchModes="false">
<template #body="slotProps">
<AdvisoryLabelBadge v-for="label in slotProps.data.labels" :label="label"></AdvisoryLabelBadge>
<AdvisoryLabelBadge v-for="label in slotProps.data.labels" :label="label" :key="label.pk"></AdvisoryLabelBadge>
</template>
</Column>
</GenericDataTable>
Expand Down
22 changes: 14 additions & 8 deletions frontend/src/views/pages/advisories/AdvisoryUpdate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default {
hide_advisory_id_in_report: this.model.hide_advisory_id_in_report,
custom_report_title: this.model.custom_report_title,
cve_id: this.model.cve_id,
researchers: this.model.researchers,
vulnerability_id: this.model.template,
report_template: this.model.report_template
};
Expand Down Expand Up @@ -127,17 +128,21 @@ export default {
<div class="col-12">
<div class="card">
<div class="p-fluid formgrid grid" v-if="loaded">
<div class="field col-12">
<div class="field col-12 md:col-6">
<label for="template">Vulnerability Template</label>
<Dropdown :options="templateChoices" optionLabel="name" optionValue="vulnerability_id" @focus="onFocusTemplate" filter @filter="onFilterTemplate" v-model="model.template"></Dropdown>
</div>
<div class="field col-12">
<div class="field col-12 md:col-6">
<label for="name">Internal Name</label>
<InputText id="name" v-model="model.internal_name"></InputText>
</div>
<div class="field col-12">
<div class="field col-12 md:col-6">
<SeveritySelectField v-model="model.severity"></SeveritySelectField>
</div>
<div class="field col-12 md:col-6">
<label for="cve-id">CVE-ID</label>
<InputText id="cve-id" v-model="model.cve_id"></InputText>
</div>
<div class="field col-12">
<label for="product">Product</label>
<InputText id="product" v-model="model.product"></InputText>
Expand All @@ -161,16 +166,17 @@ export default {
<div class="field col-12" v-if="authStore.groups.isAdvisoryManagement === true">
<AdvisoryLabelSelectField v-model="model.labels"></AdvisoryLabelSelectField>
</div>
<div class="field col-12">
<div class="field col-12 md:col-6">
<ReportTemplateSelectField v-model="model.report_template"></ReportTemplateSelectField>
</div>
<div class="field col-12 md:col-6">
<label for="custom_title">Custom Report Title</label>
<InputText id="custom_title" v-model="model.custom_report_title"></InputText>
</div>
<div class="field col-12 md:col-6">
<label for="cve-id">CVE-ID</label>
<InputText id="cve-id" v-model="model.cve_id"></InputText>
<div class="field col-12">
<label for="researchers">Researchers</label>
<InputText id="researchers" v-model="model.researchers"></InputText>
<small id="researchers-help">Overwrites the researchers section in the report (default: your display name).</small>
</div>
<div class="field col-12">
<InputSwitch v-model="model.hide_advisory_id_in_report" id="hide_id"></InputSwitch>
Expand All @@ -193,4 +199,4 @@ export default {
</div>
</div>
</div>
</template>
</template>
2 changes: 1 addition & 1 deletion server/advisories/serializers/advisory.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Meta:
"vendor_url", "vendor_name", "description", "internal_name",
"recommendation", "date_created", "date_updated",
"custom_report_title", "hide_advisory_id_in_report",
"proof_text", "labels"
"proof_text", "labels", "researchers"
]
read_only_fields = [
"pk", "user"
Expand Down
18 changes: 18 additions & 0 deletions server/backend/migrations/0048_advisory_researchers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.3 on 2024-03-27 04:18

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('backend', '0047_technology_apitoken_scope_asmonitor'),
]

operations = [
migrations.AddField(
model_name='advisory',
name='researchers',
field=models.CharField(blank=True, max_length=512, null=True),
),
]
7 changes: 7 additions & 0 deletions server/backend/models/advisory.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ class Advisory(TimestampedModel):
visibility = models.PositiveSmallIntegerField(
choices=VisibilityChoices.choices, default=VisibilityChoices.MEMBERS
)
# overwrites the default "user" display name in the research section of the PDF
researchers = models.CharField(max_length=512, null=True, blank=True)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand All @@ -167,6 +169,11 @@ def __init__(self, *args, **kwargs):
def __str__(self):
return self.advisory_id

def get_researchers(self):
if self.researchers:
return self.researchers
return self.user.report_display_name

def get_advisory_id_display(self):
prefix = Setting.get('ADVISORY_ID_PREFIX')
return f"{prefix}{self.advisory_id}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ <h3 id="vuln-{{ advisory.pk }}-title">
</tr>
<tr>
<th>Discovered by</th>
<td>{{ advisory.user.report_display_name }}</td>
<td>{{ advisory.get_researchers() }}</td>
</tr>
</table>
</section>
Expand Down
Loading