# EUVD records written by ENISA

On the instance that issues the official EUVD numbers, ENISA can create EUVD records
for vulnerabilities that have no CVE, write their content and publish them. These
records are private records of the private-record layer (see
[Drafts and publication state](editor.md)), in a family of their own, the EUVD family
(`website/web/services/euvd_record_family.py`). They are written in the vulnerability
editor, with the GCVE profile, and listed under **Admin > EUVD > EUVD records**.

## Prerequisites

- `euvd_authoritative` is `true` in `config/generic.json`. The family is registered,
  and the page answers, only there.
- ENISA's EUVD issuing component is installed and switched on. It provides the
  `vulnerabilitylookup.euvd_issuer` entry point that reserves the numbers; without it,
  no new record can be created.
- The vulnerability editor is on, to write the records, with private drafts by default
  (`"visibility": "private"` under `drafts` in `config/vulniverse.json`).

## Identifiers

A record has one number, written in two forms. EUVD is GNA 2 in the GCVE directory, so
`EUVD-2026-0001` is also `GCVE-2-2026-0001`, with the same year and serial. The record
is stored in the BCP-05 format under the GCVE form, which is what the staff see in the
editor, the list of private records and the history. Everything public names it by its
EUVD number only: the EUVD record, `/api/euvd/*`, the record page, search, exports and
the changes feed. Nothing that carries the GCVE form is in the public store: the
BCP-05 record of a published record is kept in PostgreSQL, and `GET /api/cna/cve/<id>`
answers it only to those who hold `euvd_record:view`. The editor and the private-record
API take the GCVE form only.

## Workflow

1. **Reservation.** *Reserve an EUVD record* takes the next EUVD number of the current
   year, from the same sequence as the numbers issued for CVEs, saves an empty private
   record under it and opens it in the editor. A number is never issued again, whatever
   becomes of its record. The identifier is never announced while the record is private.
2. **Writing.** The record stays private while its title, description, severity
   (CVSS), references and affected vendors and products are written and reviewed.
3. **Publication.** A record needs a description, at least one reference and at least
   one affected vendor and product to be published, and is published as interim or
   final, never as a public draft. It then appears on the public site, the API,
   search, statistics and exports like any other EUVD record.

A published record can be edited: the change is kept as a private copy and becomes
public when the record is published again.

A private or a published record can be **rejected**, with a reason. Rejection is
final: the record is never published again, a published one is removed from every
public page and API, nothing of it stays public, and its number is never reused. A
record linked to a CVE cannot be rejected; its status follows the CVE.

## What is public

Publishing writes the EUVD record that `/api/euvd/*` serves, made from the BCP-05
record: the title, the first description, the reference URLs, the affected vendors,
products and versions, and the CVSS metric of the highest version, as EUVD reads them
from a CVE record. The BCP-05 record is kept in PostgreSQL (`euvd_record_source`),
which is what the editor reads back to change the record.

`/api/euvd/<id>` and the listings carry its `title`, `description`, `cvss`,
`references`, `vendors` and `products`, with `assigner` ENISA, and its page shows the
same. The CVSS filters (`cvss_min`, `cvss_max`) and the statistics (severity, top
publishers, top vendors) use its own severity and vendors.

A published record is also found by the `text` filter of `/api/euvd/search`, on the
words of its title and description. Once a CVE is linked, only on those it locked: the
others are the CVE's, and the record is found through the CVE.

## Other instances

Instances that receive ENISA's EUVD records (`[feeder:enisa_euvd]`) get these records
too. Their first load reads them from `euvd.ndjson`, and `/api/euvd/changes` then serves
each one with its content under `content`. A record rejected after publication is
served once more as a row with `withdrawn: true`, and the receiving instance drops it.
A `withdrawn` row never removes a record issued for a CVE. An identifier retired by a
merge (see [Duplicates](#duplicates)) is served once as a row with `superseded_by`, and
the receiving instance retires it too. All of them name the record by its EUVD number
only.

## Linking a CVE

When a CVE is published for a vulnerability ENISA has already recorded, link it from
**Admin > EUVD > EUVD records** (*Link the CVE*, next to the published record). The
record must be published, the CVE must be in Vulnerability-Lookup, and it must not have
an EUVD identifier of its own yet: a CVE that already has one means two identifiers for
one vulnerability, which the duplicate merge resolves ([Duplicates](#duplicates)). Once
linked, the CVE keeps this record's identifier, so no second EUVD number is issued for
it, and the record can no longer be rejected. The link cannot be undone from the page,
and every link is in the audit trail (*CVE linked*) with the CVE. Linking takes
`euvd_record:publish`.

## Locked fields

Any field of a record (title, description, severity, references, affected vendors and
products, status) can be locked, each one separately, from **Admin > EUVD > EUVD
records** (*Locked fields*, with `euvd_record:edit`). The locks are kept in the record
itself, where the editor shows them under *Additional fields*:

```json
"containers": {"cna": {"x_euvd": {"locked": ["description", "severity"]}}}
```

Locks take effect when the record is published. Once a CVE is linked to a record, the
fields that are not locked are served from the CVE, as for any EUVD entry issued for a
CVE, and the record's status follows the CVE's. A locked field keeps the record's own
value: the vendor and product links are not rewritten from the CVE, and with the status
locked the reindex keeps the record's status whatever the CVE's becomes.

## Duplicates

A CVE published later for a vulnerability ENISA has already recorded must not give it a
second EUVD identifier. Before ENISA's issuing component numbers a new CVE, it compares
the CVE with every record ENISA wrote that has no CVE yet, published or private:

1. **Vendor and product select the candidates.** Names are normalised (lower case, no
   versions, no legal suffixes such as Inc or GmbH, no part names: `keycloak-services`
   is `keycloak`). The same name, package or source repository is strong evidence. A
   shared distinctive product word, a repository named only in the references, or a
   spelling learned from existing advisory-to-CVE links selects a candidate too, but one
   that is never attached automatically.
2. **Title and description summary give the score**: the word TF-IDF cosine of the title
   and the first 400 characters of the description, each word weighted by how rare it is
   among CVE texts.
3. **Additions**: +0.3 for a reference URL both cite that no other CVE cites (a vendor
   bulletin covering many CVEs does not count), +0.1 for the same version number, +0.1
   for the same code identifier. A shared URL strengthens a match but is never enough:
   a CVE of another product is not even a candidate.

From a score of 0.6, with strong vendor and product evidence and no conflicting fixed
version, the match is **strong**; from 0.15 (after 0.3 is taken off when the two texts
name different weakness types), or with any unique shared URL, it is **possible**. Either
way the CVE is numbered as usual and the pair is listed under **Admin > EUVD >
Duplicates**, with its evidence, and the staff holding `euvd_record:merge` are emailed by
the issuing component after its pass. Nothing of a private record's content is written to
Kvrocks for this: the evidence kept is what the record shares with the public CVE.

A strong match can instead take the record's identifier, so that no new one is issued,
with `"auto_attach": true` in `euvd_matching`. It is off by default: vendors that write
their CVEs from one template make different CVEs of the same product score high against
each other, so validate the threshold on such CVEs before turning it on. Even then, only
a published record is attached without a person's decision (attaching a private one would
make its number public), and two strong matches for one CVE are both listed rather than
attached. The thresholds and weights are settings too (`euvd_matching` in
`config/generic.json`).

On the duplicates page:

- **Dismiss**: not the same vulnerability. The pair is never listed again.
- **Confirm and merge**: if the ENISA record is published, it is kept; the CVE moves to
  it with what comes from the CVE (affected products, severity, exploitation status),
  except the fields locked on the record, and the identifier issued for the CVE is
  retired. If it is private, the merge publishes its content, so it takes
  `euvd_record:publish` and what a publication requires (a description, a reference, an
  affected vendor and product, and not marked as a draft). Its content moves to the
  identifier that is already public, which becomes a record ENISA wrote (its locked
  fields keep ENISA's content) and is edited in the editor from then on, and the ENISA
  identifier is retired: its private record is kept, shown as *Merged into* the other
  identifier, and can no longer be saved, published or rejected. It was never public, so
  nothing needs to point to it.
- **Reverse** (an administrator, in the history): both records are put back as they were
  before the merge, and the pair is dismissed, since the merge was an error. It is refused
  once the kept record has been published again, or has a private copy in progress, since
  that would undo a later change.

A **retired identifier** is kept, so its number is never issued again, but it is on no
listing, search, statistic or export, and it is not counted as published, reserved or
withdrawn. It leaves the indexes at once; the prepared figures (counts and rankings)
drop it at the next indexing pass, like any other change. `/api/euvd/<id>` answers with
`{"id": ..., "superseded_by": ...}`, so whoever cited it is led to the identifier that
replaced it.

Every automatic attach, listing, dismissal, merge and reversal is in the publication audit
trail with who did it, when and the identifiers involved. A merge entry keeps both
records' state from before the merge, which is what a reversal restores.

The comparison uses corpus statistics: word weights, which product words and repositories
are distinctive, how many CVEs cite each reference URL, and the spellings learned from
advisories linked to CVEs. They are written to Kvrocks (`euvd:matching:*`) by

```bash
poetry run euvd --rebuild-matching --quiet
```

which only reads the records and is meant to run on a timer (daily is enough). The URL
citations of the CVEs stored since the last run (from a day before it started) are
counted when a URL is looked up, so a bulletin first cited by several CVEs on the same day
is unique to none of them. Until it has run once, every word weighs the same and every
shared URL counts as unique.

## Permissions

| Permission | |
|---|---|
| `euvd_record:view` | See the private records and their history |
| `euvd_record:create` | Reserve a number for a new record |
| `euvd_record:edit` | Change the content and the locks of a private copy |
| `euvd_record:publish` | Publish a record, publish it again, or link a CVE to it |
| `euvd_record:reject` | Reject a record |
| `euvd_record:merge` | Confirm or dismiss a possible duplicate |
| `euvd_record:unmerge` | Reverse a merge |

Three roles are seeded: `euvd_editor` (view, create, edit, publish, merge) for the staff
who write the records, `euvd_viewer` (view) for other operators, who see the duplicates
but cannot act on them, and the owner role `euvd_record_owner` (view, reject), which the
author of a record receives for that record. The `admin` role holds all seven, so the
author of a record or an administrator can reject it, and only an administrator can
reverse a merge.

## History and log file

The layer records every action in the audit trail, shown in the editor under
*History*, and writes every creation, publication and rejection to the `records` log
(see [Logging](logging.md)).
