|
| 1 | +--- |
| 2 | +title: "Sigstore, in-toto, OPA, orientation" |
| 3 | +date: 2023-01-11 |
| 4 | +author: Daniel Bevenius |
| 5 | +--- |
| 6 | + |
| 7 | +As someone who was completly new to secure supply chain security (sscs) there |
| 8 | +were a lot of new projects that I learned the names of but did not really |
| 9 | +understand exactly what they did or how they complement each other. This post |
| 10 | +hopes to clarify a few of these projects, and others will be addressed in future |
| 11 | +posts. |
| 12 | + |
| 13 | +Lets say we have a software project that we want to distribute. We want to sign |
| 14 | +the artifact that we produce, and lets say it's distributed as a tar file. It |
| 15 | +is possible to do this signing manually, but it involves some work like managing |
| 16 | +keys and using tools to perform the signing tasks. Using |
| 17 | +[sigstore](https://www.sigstore.dev/) simplfies this process, similar to how |
| 18 | +Let's Encrypt made it simpler to get certificates to be used with web sites. |
| 19 | +Sigstore also provides tools to verify signatures and a transparency log to |
| 20 | +store signatures. So that allows us to sign our end product, and publish the |
| 21 | +signatures to the transparency log, and consumers/clients can verify our |
| 22 | +artifact. |
| 23 | + |
| 24 | +But how can we trust what was built? For example, if I built this tar on my |
| 25 | +local laptop I could replace a source code file with a backdoor and still be |
| 26 | +able to produce a valid signature, and it could still be verified. This is also |
| 27 | +the case if a build server is used and it gets compromised, so we need something |
| 28 | +more. |
| 29 | + |
| 30 | +This is where another project named [in-toto](https://in-toto.io/) comes into |
| 31 | +play. It contains tools to define the steps of a build process, and assign |
| 32 | +someone that is responsible for each step. This person also signs the artifact |
| 33 | +produced by that step. So each step is signed by the person responsible for that |
| 34 | +step, called the funtionary, and then all the steps are signed by a product |
| 35 | +owner. This will produce a document which lists the steps that were followed to |
| 36 | +produce the software, with signatures for each step. |
| 37 | + |
| 38 | +For example, one step might have been checking out a specific version from git, |
| 39 | +and this could be verified that it was indeed that version that was used, and |
| 40 | +the source files that were used. This gives the end user insight into the |
| 41 | +product that they are about to install and the ability to verify it. |
| 42 | + |
| 43 | +So we now have our built artifact, signed it, and we have attestations, in |
| 44 | +this case json files that contain metadata about how it was built. And we can |
| 45 | +use in-toto-verify to verify that all that information is correct. |
| 46 | + |
| 47 | +Now, lets say that another company, or another project, wants to include our |
| 48 | +software in their project, as a thirdparty dependency. Ours might be one of many |
| 49 | +dependencies that they include in their product and they might have |
| 50 | +requirements/restrictions on what they are allowed to use. For example, they |
| 51 | +might require that only certain licences are used. The license information is |
| 52 | +hopefully available in the project, like a license file or field in Cargo.toml, |
| 53 | +but there is nothing available to say that only certain licenses are allowed. |
| 54 | +This is where a policy engine like |
| 55 | +[Open Policy Agent (OPA)](https://www.openpolicyagent.org/) comes into play. OPA |
| 56 | +gives us the ability to write policy rules that take in-toto json files as |
| 57 | +input, and verify that there are licences for all thirdparty dependencies and |
| 58 | +that they are of the type(s) that are allowed. Rules can be written to handle |
| 59 | +other types of restrictions/requirements as well, which are the policies that |
| 60 | +the company has. |
| 61 | + |
| 62 | +So they could include a step in their build process that execute enforces the |
| 63 | +policy rules they have defined. Policy rules can also be useful when deploying |
| 64 | +applications in container images where one might want to make sure that only |
| 65 | +supported base images are used etc. |
| 66 | + |
| 67 | +Hopefully this post gives some insight into how Sigstore, in-toto, and OPA may |
| 68 | +be used, and how they complement each other. |
0 commit comments