You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/index.rst
+80Lines changed: 80 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,89 @@
1
1
.. Copyright (c) 2022 - 2023, Oracle and/or its affiliates. All rights reserved.
2
2
.. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
3
3
4
+
.. _index:
5
+
6
+
.. meta::
7
+
:description: macaron - A CI/CD security analysis tool for supply-chain attacks
8
+
:keywords: CI/CD, SLSA, supply-chain security
9
+
10
+
=====================
4
11
Macaron documentation
5
12
=====================
6
13
14
+
Software supply-chain attacks are becoming more prevalent as the systems get more complex, particularly with respect to the use of open-source
15
+
third-party code. Attacks include stealing credentials, tampering with the
16
+
code, tampering with the code repository, and tampering with the build system.
17
+
It is crucial to have guarantees that the third-party code we rely on is the
18
+
code we expect.
19
+
20
+
To tackle these problems, `Supply-chain Levels for Software Artifacts (SLSA or "salsa") <https://slsa.dev>`_ is created to improve the integrity and
21
+
protection of the software supply-chain. Macaron can analyze a software
22
+
repository to determine its SLSA level and provide supply-chain transparency of the build process.
23
+
24
+
--------
25
+
Overview
26
+
--------
27
+
28
+
Macaron is an analysis tool which focuses on the build process for an artifact and its dependencies. As the SLSA requirements
29
+
are at a high-level, Macaron first defines these requirements as specific
30
+
concrete rules that can be checked automatically. Macaron has a customizable checker platform that makes it easy to define checks that depend on each other.
31
+
32
+
-------------------------
33
+
Current checks in Macaron
34
+
-------------------------
35
+
36
+
The table below shows the current set of actionable checks derived from
37
+
the requirements that are currently supported by Macaron.
38
+
39
+
.. note:: The current checks are designed based on `SLSA v0.1 <https://slsa.dev/spec/v0.1/>`_. Support for `SLSA v1.0 <https://slsa.dev/spec/v1.0/>`_ is currently under development.
40
+
41
+
.. list-table:: Mapping SLSA requirements to Macaron checks
42
+
:widths: 20 40 40
43
+
:header-rows: 1
44
+
45
+
* - SLSA level
46
+
- SLSA spec v0.1
47
+
- Concrete check
48
+
* - 1
49
+
- **Scripted build** - All build steps were fully defined in a “build script”.
50
+
- Identify and validate build script(s).
51
+
* - 1
52
+
- **Provenance available** - The provenance is available.
53
+
- Check for existence of SLSA provenance. If there are no SLSA provenance, the repo can still be compliant to level 1 given the build script is available.
54
+
* - 2
55
+
- **Build service** - All build steps are run using some build service (e.g. GitHub Actions)
56
+
- Identify and validate the CI service(s) used for the build process.
57
+
* - 3
58
+
- **Trusted builders** - Guarantees the identification of the top-level build configuration used to initiate the build. The build is verified to be hermetic, isolated, parameterless, and executed in an ephemeral environment.
59
+
- Identify and validate that the builder used in the CI pipeline is a trusted one.
60
+
* - 3
61
+
- **Build as code** - If a trusted builder is not present, this requirement determines that the build definition and configuration executed by the build service is verifiably derived from text file definitions stored in a version control system.
62
+
- Identify and validate the CI service(s) used to build and deploy/publish an artifact.
63
+
* - 3
64
+
- **Provenance Level three** - Check whether the target has SLSA provenance level 3.
65
+
- Use the `slsa-verifier <https://github.com/slsa-framework/slsa-verifier>`_ to attest to the subjects in the SLSA provenance that accompanies an artifact.
66
+
* - 3
67
+
- **Provenance expectation** - Check if the provenance meets an expectation.
68
+
- The user can provide an expectation for the provenance as a CUE policy, which will be compared against the SLSA provenance.
Macaron is designed based on a Zero Trust model. It analyzes a target repository as an external
83
+
tool and requires minimal configurations. After cloning a repository, Macaron parses the CI
84
+
configuration files and bash scripts that are triggered by the CI, creates call graphs and other
85
+
intermediate representations as abstractions. Using such abstractions, Macaron implements concrete checks based on a security specification and verifies the desired properties.
Copy file name to clipboardExpand all lines: docs/source/pages/using.rst
+69-2Lines changed: 69 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,8 @@ Using Macaron
9
9
10
10
.. note:: The instructions below assume that you have setup you environment correctly to run Macaron (if not, please refer to :ref:`Installation Guide <installation-guide>`).
11
11
12
+
.. _analyze-action:
13
+
12
14
------------------------------------
13
15
Analyzing a public Github repository
14
16
------------------------------------
@@ -50,13 +52,45 @@ With the example above, the generated output reports can be seen here:
The provenance expectation is verified via the ``provenance_expectation`` check in Macaron. You can see the result of this check in the HTML or JSON report and see if the provenance found by Macaron meets the expectation CUE file.
86
+
53
87
----------------------
54
88
Analyzing with an SBOM
55
89
----------------------
56
90
57
-
Macaron can run the analysis against a `CycloneDX <https://cyclonedx.org/>`__ format SBOM, which contains all the necessary information of the target component and its dependencies. This use case is useful when you are running Macaron against a software component that is not available as a public GitHub repository but you still want to analyze the SLSA posture of its dependencies.
91
+
Macaron can run the analysis against an existing SBOM in `CycloneDX <https://cyclonedx.org/>`_ which contains all the necessary information of the dependencies of a target repository. In this case, the dependencies will not be resolved automatically.
58
92
59
-
CycloneDX provides open-source SBOM generators for different types of project (e.g Maven, Gradle, etc) To know how you could generate an CycloneDX SBOM for your projects, please have a look at their `open-source organization<https://github.com/CycloneDX>`_.
93
+
CycloneDX provides open-source SBOM generators for different types of project (e.g Maven, Gradle, etc). For instructions on generating a CycloneDX SBOM for your project, see `CycloneDX documentation<https://github.com/CycloneDX>`_.
60
94
61
95
For example, with `micronaut-core <https://github.com/micronaut-projects/micronaut-core>`_ at branch 4.0.x commit ``82d115b4901d10226552ac67b0a10978cd5bc603``, using the `CycloneDX Gradle plugin <https://github.com/CycloneDX/cyclonedx-gradle-plugin>`_ would give us the following `SBOM <./_static/micronaut-projects/micronaut-core/analyze_with_sbom/sbom.json>`_.
62
96
@@ -101,3 +135,36 @@ With ``rest_of_args`` being the arguments to the ``analyze`` command (e.g. ``-b`
101
135
The ``-lr`` flag configure Macaron to looks into ``path/to/boo/foo`` for local repositories. For more information, please see :ref:`Command Line Usage <cli-usage>`.
102
136
103
137
.. note:: If ``-lr`` is not provided, Macaron will looks inside ``<working_directory>/output/git_repos/local_repos/`` whenever you provide a local path to ``-rp``.
138
+
139
+
-------------------------
140
+
Running the policy engine
141
+
-------------------------
142
+
143
+
Macaron's policy engine accepts policies specified in `Datalog <https://en.wikipedia.org/wiki/Datalog>`_. An example policy
144
+
can verify if a project and all its dependencies pass certain checks. We use `Soufflé <https://souffle-lang.github.io/index.html>`_
145
+
as the Datalog engine in Macaron. Once you run the checks on a target project as described :ref:`here <analyze-action>`,
146
+
the check results will be stored in ``macaron.db`` in the output directory. We can pass the check results to the policy
147
+
engine and provide a Datalog policy file to be enforced by the policy engine.
148
+
149
+
We use `Micronaut MuShop <https://github.com/oracle-quickstart/oci-micronaut>`_ project as a case study to show how to run the policy engine.
150
+
Micronaut MuShop is a cloud-native microservices example for Oracle Cloud Infrastructure. When we run Macaron on the Micronaut MuShop GitHub
151
+
project, it automatically finds the project’s dependencies and runs checks for the top-level project and dependencies
152
+
independently. For example, the build service check, as defined in SLSA, analyzes the CI configurations to determine if its artifacts are built
153
+
using a build service. Another example is the check that determines whether a SLSA provenance document is available for an artifact. If so, it
154
+
verifies whether the provenance document attests to the produced artifacts. For the Micronaut MuShop project, Macaron identifies 48 dependencies
155
+
that map to 24 unique repositories and generates an HTML report that summarizes the check results.
156
+
157
+
Now we can run the policy engine over these results and enforce a policy:
In this example, the Datalog policy file is provided in `oci-micronaut.dl <../_static/examples/oracle-quickstart/oci-micronaut/policies/oci-micronaut.dl>`__.
164
+
This example policy can verify if the Micronaut MuShop project and all its dependencies pass the ``build_service`` check
165
+
and the Micronaut provenance documents meets the expectation provided as a `CUE file <../_static/examples/micronaut-projects/micronaut-core/policies/micronaut-core.cue>`__.
166
+
167
+
Thanks to Datalog’s expressive language model, it’s easy to add exception rules if certain dependencies do not meet a
168
+
requirement. For example, `the Mysql Connector/J <https://slsa.dev/spec/v0.1/requirements#build-service>`_ dependency in
169
+
the Micronaut MuShop project does not pass the ``build_service`` check, but can be manually investigated and exempted if trusted. Overall, policies expressed in Datalog can be
170
+
enforced by Macaron as part of your CI/CD pipeline to detect regressions or unexpected behavior.
0 commit comments