|
| 1 | +# 00005. Handling of signatures |
| 2 | + |
| 3 | +Date: 2025-04-22 |
| 4 | + |
| 5 | +## Status |
| 6 | + |
| 7 | +DRAFT |
| 8 | + |
| 9 | +## Context |
| 10 | + |
| 11 | +Currently, when importing SBOMs and CSAF documents via the importers, we do check the GPG signatures provided and fail |
| 12 | +the document (not the whole process) in cases where the signature is invalid. |
| 13 | + |
| 14 | +This leads to documents not being imported if the signature is not valid. |
| 15 | + |
| 16 | +That process has a bunch of drawbacks: |
| 17 | + |
| 18 | +* It's only supported via the importer process |
| 19 | +* There's no (except from the importer report) information visible to the user |
| 20 | +* There's only one source for signatures, the one of the importer source |
| 21 | +* We do not store the signatures |
| 22 | + |
| 23 | +Today signatures are seen as an element of the importer (transport) process. The automatic import process ensures, using |
| 24 | +the provided/published signatures, that the document was not tampered with during the transport. |
| 25 | + |
| 26 | +The goal of this ADR is to: |
| 27 | + |
| 28 | +* [ ] Add the ability to store one or more signatures for each imported document |
| 29 | +* [ ] Add an importer of signatures from one or more Sigstore sources |
| 30 | +* [ ] Allow the user to inspect the document's signature and give a visual indication "if the signature is good" |
| 31 | +* [ ] Define a way to deal with invalid signatures |
| 32 | + |
| 33 | +## Proposal |
| 34 | + |
| 35 | +We create a new table, alongside the `source_document` table, storing all known signatures for a document. With that, |
| 36 | +we can, later on, extract all kinds of information from this. |
| 37 | + |
| 38 | +GPG signatures of documents will be stored in this table too. This happens during the import process. |
| 39 | + |
| 40 | +### Sources |
| 41 | + |
| 42 | +To validate the signatures, we need some trust anchors. Those need to be set up and linked to the documents. For |
| 43 | +configured importers, it may be reasonable to import the keys (as trust anchors) automatically as well. |
| 44 | + |
| 45 | +Keys are only validm when |
| 46 | + |
| 47 | +### Database |
| 48 | + |
| 49 | +We add a new table `document_signatures`, with the following structure: |
| 50 | + |
| 51 | +```mermaid |
| 52 | +erDiagram |
| 53 | + source_document |
| 54 | + source_document 1 to zero or more document_signatures: owns |
| 55 | +
|
| 56 | + document_signatures { |
| 57 | + uuid id PK |
| 58 | + uuid doc_id FK "source_document.id" |
| 59 | + string type "Signature type: pgp, sigstore" |
| 60 | + string value "Signature value" |
| 61 | + } |
| 62 | +
|
| 63 | + trust_anchors { |
| 64 | + string id PK "unique name of the trust anchor" |
| 65 | + string type "Type of the trust anchor: pgp, sigstore" |
| 66 | + string value "Trust anchor value: keychain, sigstore instance" |
| 67 | + } |
| 68 | +``` |
| 69 | + |
| 70 | +### API |
| 71 | + |
| 72 | +* [ ] Validate a document against a list/set/query of trust anchors (might not be necessary if done while adding a signature) |
| 73 | +* [ ] Retrieve validation results |
| 74 | + |
| 75 | +TBD |
| 76 | + |
| 77 | +### UI representation |
| 78 | + |
| 79 | +* There should be a visual representation if the document is "ok" |
| 80 | +* There should be detail information on how that state was evaluated (signature, error information, …) |
| 81 | +* … |
| 82 | + |
| 83 | +## Open questions |
| 84 | + |
| 85 | +* [ ] What will happen when the importer detects an invalid signature? |
| 86 | +* [ ] What will happen when an invalid signature is attached to the document? |
| 87 | +* [ ] What signatures are required for a document to be considered "ok"? |
| 88 | +* [ ] What happens when a required signature is missing? |
| 89 | +* [ ] Does revokation work? |
| 90 | +* [ ] How to deal with signatures that no longer validate? |
| 91 | +* [ ] Do we store evaluation results? When adding a signature, do we validate it, and store the result? So that we have |
| 92 | + the outcome stored, "at that point in time". |
| 93 | + |
| 94 | +## Conclusion |
0 commit comments