Debian Codegraph @

README.md

raw
1 <p align="center">
2 <img src="docs/assets/logo.png">
3 </p>
4
5 [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8280/badge)](https://www.bestpractices.dev/projects/8280)
6 [![OpenSSF-Scorecard](https://api.securityscorecards.dev/projects/github.com/in-toto/archivista/badge)](https://api.securityscorecards.dev/projects/github.com/in-toto/archivista)
7 [![FOSSA Status](https://app.fossa.com/api/projects/custom%2B41709%2Fgithub.com%2Fin-toto%2Farchivista.svg?type=shield&issueType=license)](https://app.fossa.com/projects/custom%2B41709%2Fgithub.com%2Fin-toto%2Farchivista?ref=badge_shield&issueType=license)
8
9 # Archivista
10
11 Archivista is a graph and storage service for [in-toto](https://in-toto.io)
12 attestations. Archivista enables the discovery and retrieval of attestations for
13 software artifacts.
14
15 ## Archivista enables you to
16
17 - Store and retrieve in-toto attestations
18 - Query for relationships between attestations via a GraphQL API
19 - Validate Witness policy without the need to manually list expected
20 attestations
21
22 ## Archivista is a trusted store for supply chain metadata
23
24 - It creates a graph of supply chain metadata while storing attestations that
25 can be later used for policy validation and flexible querying.
26 - It is designed to be horizontally scaleable, supporting storing a large number
27 of attestations.
28 - It supports deployment on major cloud service and infrastructure providers,
29 making it a versatile and flexible solution for securing software supply
30 chains.
31 - It only stores signed attestations to further enhance security and and
32 increase trust.
33
34 ## Key Features
35
36 - Native support for storing attestations created by Witness
37 - A GraphQL API endpoint and playground
38 - Support for MySQL and Postgres database backends
39 - Support for S3-compatible object storage
40 - A Helm Chart for deployment in Kubernetes environments
41 - The ability to download and export attestations to transfer across an air gap
42 - Support for Darwin, Windows, and ARM architectures.
43
44 ## How Archivista Works
45
46 When an attestation is uploaded to Archivista it will store the entire
47 attestation in a configured object store as well as scrape some data from the
48 attestation and store it in a queryable metadata store. This metadata is exposed
49 through a GraphQL API. This enables queries such as finding all attestations
50 related to an artifact with a specified hash or finding all attestations that
51 recorded the use of a specific dependency.
52
53 Archivista uses Subjects on the
54 [in-toto Statement](https://github.com/in-toto/attestation/blob/main/spec/README.md#statement)
55 as edges on this graph. Producers of attestations (such as
56 [Witness](https://github.com/in-toto/witness) can use these subjects as a way to
57 expose relationships between attestations.
58
59 For example when attesting that an artifact was compiled the compiled artifact
60 may be a subject, as well as the git commit hash the artifact was built from.
61 This would allow traversing the graph by the commit hash to find other relevant
62 attestations such as those describing code reviews, testing, and scanning that
63 happened on that git commit.
64
65 ## Running Archivista
66
67 A public instance of Archivista is running
68 [here](https://archivista.testifysec.io) for testing purposes. The data in this
69 instance is open to the world and there are currently no SLAs defined for this
70 instance.
71
72 Archivista requires a MySQL database as well as a compatible file store.
73 Compatible file stores include a local directory or any S3 compatible store.
74
75 A docker compose file is included in the repository that will run a local
76 instance of Archivista along with the necessary services for it to operate.
77 These include Minio and MySQL. Simply cloning the repo and running
78
79 ```bash
80 docker compose up --build -d
81 ```
82
83 is enough to get a local instance of Archivista up and running. Archivista will
84 be listening at `http://localhost:8082` by default with this docker compose
85 file.
86
87 ### Configuration
88
89 Archivista is configured through environment variables currently.
90
91 **Note**: If `ARCHIVISTA_ENABLE_SQL_STORE` is set to false no metadata about store attestations will be collected. Archivista will only store and retrieve attestations by Gitoid from it's storage. Archivista servers with GraphQL or SQL store disabled cannot be used to verify Witness policies.
92
93 | Variable | Default Value | Description |
94 | ------------------------------------------ | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
95 | ARCHIVISTA_LISTEN_ON | tcp://127.0.0.1:8082 | URL endpoint for Archivista to listen on |
96 | ARCHIVISTA_READ_TIMEOUT | 120 | HTTP server read timeout |
97 | ARCHIVISTA_WRITE_TIMEOUT | 120 | HTTP server write timeout |
98 | ARCHIVISTA_LOG_LEVEL | INFO | Log level. Options are DEBUG, INFO, WARN, ERROR |
99 | ARCHIVISTA_CORS_ALLOW_ORIGINS | | Comma separated list of origins to allow CORS requests from |
100 | ARCHIVISTA_ENABLE_SQL_STORE | TRUE | Enable SQL Metadata store. If disabled, GraphQL will also be disabled |
101 | ARCHIVISTA_SQL_STORE_BACKEND | | Backend to use for SQL. Options are MYSQL or PSQL (MYSQL_RDS_IAM or PSQL_RDS_IAM for AWS IAM authentication)|
102 | ARCHIVISTA_SQL_STORE_CONNECTION_STRING | postgresql://root:example@tcp(db)/testify | SQL store connection string |
103 | ARCHIVISTA_STORAGE_BACKEND | | Backend to use for attestation storage. Options are FILE, BLOB, or empty string for disabled. |
104 | ARCHIVISTA_FILE_SERVE_ON | | What address to serve files on. Only valid when using FILE storage backend (e.g. `:8081`). |
105 | ARCHIVISTA_FILE_DIR | /tmp/archivista/ | Directory to store and serve files. Only valid when using FILE storage backend. |
106 | ARCHIVISTA_BLOB_STORE_ENDPOINT | 127.0.0.1:9000 | URL endpoint for blob storage. Only valid when using BLOB storage backend. |
107 | ARCHIVISTA_BLOB_STORE_CREDENTIAL_TYPE | | Blob store credential type. Options are IAM or ACCESS_KEY. |
108 | ARCHIVISTA_BLOB_STORE_ACCESS_KEY_ID | | Blob store access key id. Only valid when using BLOB storage backend. |
109 | ARCHIVISTA_BLOB_STORE_SECRET_ACCESS_KEY_ID | | Blob store secret access key id. Only valid when using BLOB storage backend. |
110 | ARCHIVISTA_BLOB_STORE_USE_TLS | TRUE | Use TLS for BLOB storage backend. Only valid when using BLOB storage backend. |
111 | ARCHIVISTA_BLOB_STORE_BUCKET_NAME | | Bucket to use for storage. Only valid when using BLOB storage backend. |
112 | ARCHIVISTA_ENABLE_GRAPHQL | TRUE | Enable GraphQL Endpoint. Archivista servers with GraphQL disabled cannot be used to verify Witness policies |
113 | ARCHIVISTA_GRAPHQL_WEB_CLIENT_ENABLE | TRUE | Enable GraphiQL, the GraphQL web client |
114 | ARCHIVISTA_ENABLE_ARTIFACT_STORE | FALSE | Enable Artifact Store Endpoints |
115 | ARCHIVISTA_ARTIFACT_STORE_CONFIG | /tmp/artifacts/config.yaml | Location of the config describing available artifacts |
116 | ARCHIVISTA_PUBLISHER | "" | Publisher to use. Options are DAPR, RSTUF. Supports multiple, Comma-separated list of String |
117 | ARCHIVISTA_PUBLISHER_DAPR_HOST | localhost | Dapr host |
118 | ARCHIVISTA_PUBLISHER_DAPR_PORT | 3500 | Dapr port |
119 | ARCHIVISTA_PUBLISHER_DAPR_COMPONENT_NAME | "archivista" | Dapr pubsub component name |
120 | ARCHIVISTA_PUBLISHER_DAPR_TOPIC | "attestations" | Dapr pubsub topic |
121 | ARCHIVISTA_PUBLISHER_DAPR_URL | | Dapr full URL |
122 | ARCHIVISTA_PUBLISHER_RSTUF_HOST | | RSTUF URL |
123
124 ## Using Archivista
125
126 Archivista exposes two HTTP endpoints to upload or download attestations:
127
128 ```http
129 POST /upload - Uploads an attestation to Archivista. The attestation is to be in the request's body
130 ```
131
132 ```http
133 GET /download/:gitoid: - Downloads an attestation with provided gitoid from Archivista
134 ```
135
136 Additionally Archivista exposes a GraphQL API. By default the GraphQL playground
137 is enabled and available at root.
138
139 `archivistactl` is a CLI tool in this repository that is available to interact
140 with an Archivista instance. `archivistactl` is capable of uploading and
141 downloading attestations as well as doing some basic queries such as finding all
142 attestations with a specified subject and retrieving all subjects for a
143 specified attestation.
144
145 ## Navigating the Graph
146
147 As previously mentioned, Archivista offers a GraphQL API that enables users to
148 discover attestations. When Archivista ingests an attestation some metadata will
149 be stored into the SQL metadata store. This metadata is exposed through the
150 GraphQL API. Archivista uses
151 [Relay connections](https://relay.dev/graphql/connections.htm) for querying and
152 pagination.
153
154 Here is an entity relationship diagram of the metadata that is currently
155 available.
156
157 ```mermaid
158 erDiagram
159 dsse ||--|| statement : Contains
160 statement ||--o{ subject : has
161 subject ||--|{ subjectDigest : has
162 statement ||--o| attestationCollection : contains
163 attestationCollection ||--|{ attestation : contains
164 dsse ||--|{ payloadDigest : has
165 dsse ||--|{ signature : has
166 signature ||--o{ timestamp : has
167
168 dsse {
169 string gitoidSha256
170 string payloadType
171 }
172
173 statement {
174 string predicate
175 }
176
177 subject {
178 string name
179 }
180
181 subjectDigest {
182 string algorithm
183 string value
184 }
185
186 attestationCollection {
187 string name
188 }
189
190 attestation {
191 string type
192 }
193
194 payloadDigest {
195 string algorithm
196 string value
197 }
198
199 signature {
200 string keyID
201 string signature
202 }
203
204 timestamp {
205 string type
206 time timestamp
207 }
208 ```
209
210 ## Deployment
211
212 Archivista can be easily deployed thru the provided helm chart into your
213 kubernetes cluster. See the [README](https://github.com/in-toto/helm-charts/blob/main/charts/archivista/README.md) for more details.
214
215 ## What's Next
216
217 We would like to expand the types of data Archivista can ingest as well as
218 expand the metadata Archivista collected about ingested data. If you have ideas
219 or use cases for Archivista, feel free to
220 [contact us](mailto:[email protected]) or create an issue!
221
222 ## Contributing
223
224 See [CONTRIBUTING.md](CONTRIBUTING.md) for information on how to contribute to
225 Archivista.