Makes Documentation

repository·main·Indexed 19 days ago

https://github.com/fluidattacks/makes

A Nix-powered CI/CD framework for building secure, portable, and reproducible application environments and pipelines. Includes built-ins for AWS Batch job submission (computeOnAwsBatch), OCI container deployment (deployContainer, deployContainerManifest), Terraform module deployment (deployTerraform), and local DynamoDB configuration. Provides declarative development environments via the dev key and integration with direnv, as well as formatting tools for Bash, Markdown, Nix, Terraform, and YAML. Note: This project is deprecated in favor of Nix Flakes.

Tokens
28.5K
Snippets
93
Records
112
Agent score
64%

What's inside Makes

  1. What is Makes?

    main

    Makes is an open-source, production-ready CI/CD framework powered by Nix. It is designed to build both CI/CD pipelines and application environments with a focus on security, speed, and portability.

    Key features include:

    • Secure: Uses cryptographically signed dependencies for apps and pipelines.
    • Easy: Single-command installation and dozens of generic CI/CD builtins.
    • Fast: Supports distributed and granular caching.
    • Portable: Runs on Docker, VMs, and any Linux-based OS.
    • Extensible: Can be extended to work with any technology.
  2. How Makes ensures isolation between users

    main

    Makes implements 'Least Common Mechanism' by ensuring that, in standard configurations, users do not share state. Each user has their own personal /nix/store and a personal installation of Nix.

    Store contents are not shared between users unless a user explicitly configures a read+write binary cache and sets the required binary cache secret.

  3. How Makes ensures Hermetic and Isolated builds

    main

    Makes uses the Nix package manager to enforce build isolation and hermeticity, which are critical for preventing supply chain attacks.

    Hermetic Builds

    Builds are hermetic because all transitive build steps, sources, and dependencies are fully declared upfront with immutable references. Nix ensures:

    • All declared artifacts are fetched into a trusted control plane (/nix/store).
    • Only specific /nix/store paths required by the build are mounted into the sandbox.
    • Network connectivity is denied unless an expected hash is specified for an artifact.
    • Integrity is validated via hashes before use; builds fail if verification fails.

    Isolated Builds

    Builds run in an environment free from influence by other concurrent or prior build instances. This is achieved through:

    • Containerization: Using Nix to prevent access to external environment variables, network resources, sockets, or arbitrary file system paths.
    • Namespace Isolation: Providing private versions of /proc, /dev, /dev/shm, and /dev/pts, along with private PID, mount, network, IPC, and UTS namespaces.
  4. Understand Makes' SLSA compliance and security model

    main

    Makes adheres to the SLSA (Supply Chain Levels for Software Artifacts) v0.1 specification, currently achieving SLSA Level 2. This framework ensures the integrity of software artifacts by securing the build and release process, source code, and dependencies against tampering.

    Core Infrastructure Mapping

    • Source: Managed via Git (GitHub).
    • Platform: GitHub Actions, Makes, and the Nix package manager.
    • Build Service: GitHub Actions using GitHub-hosted runners.
    • Build Mechanism: Nix derivations.
    • Environment: An isolated sandbox using Chroot and private namespaces (PID, mount, network, IPC, UTS) to prevent interference from other processes.
    • Steps: Defined via Nix and shell scripting, versioned as code within the source repository.
  5. How Makes handles Provenance

    main

    Provenance in Makes is a JSON document produced by the build service that accompanies the produced artifacts. It provides verifiable metadata about how the artifact was created.

    Provenance Characteristics

    • Available: Generated automatically by Makes for any build that produces artifacts.
    • Authenticated: Provenance is downloaded directly from the build service, making its authenticity as secure as the build service itself.
    • Service Generated: Data is generated by Makes and exposed by the build service. Because builds are fully automated by configuration from the source, users cannot inject or alter the contents.
    • Non-Falsifiable: Users cannot falsify provenance because builds run in a hermetic environment where no secret material is available to the build steps, and all fields are generated by the build service in a trusted control plane.
    • Dependencies Complete: Because builds are hermetic, all dependencies must be declared to succeed. Consequently, the provenance contains a complete list of all dependencies used during the build.
  6. Legal requirements for contributions

    main

    All code submitted to the Makes repository is licensed under the MIT license.

    To signal agreement to the Developer Certificate of Origin (DCO), you must sign your commits by adding a Signed-off-by: Full Name <email> line at the end of your commit message.

  7. Privileges required by Makes CLI

    main

    The Makes CLI is a Python application that runs in user-space. It does not require elevated or root privileges for standard operations. The following permissions are used:

    • Write access to ${HOME}: Uses existing user permissions.
    • Temporary file/directory creation: Respects the ${TMPDIR} environment variable.
    • Nix Installation: Requires a system with Nix installed.
    • Kernel Namespaces (Optional): Some advanced features may require privileges to create Kernel namespaces.

    When building containers, Makes assembles OCI-compliant images (TAR files per layer plus a JSON manifest) using information from the Nix Store, avoiding the need for privileged daemons like Docker.

  8. Understand the Makes versioning scheme

    main

    Makes uses Calendar Versioning (CalVer) for its stable releases. The ecosystem consists of two main components that must be kept in sync:

    1. The Framework: The core logic used for evaluation.
    2. The CLI: The command-line interface (invoked via $ m).

    Important: To ensure the ecosystem works correctly, you must use the same version for both the framework and the CLI (e.g., both should be 24.12).

    Release Types

    • Stable releases: These do not have the Pre-release label. They are frozen and will not be modified.
    • Unstable releases: These have the Pre-release label. They contain the latest features but may include bugs or breaking changes.
  9. Quickstart: Create and run a Makes job

    main

    To get started with Makes, follow these steps:

    1. Create a makes.nix file in your project root. Define your jobs using the makeScript function.
    2. Run the job using the m command from your project root, specifying the directory and the job path.

    Example makes.nix configuration:

    { makeScript, ...}: {
      jobs = {
        "/helloWorld" = makeScript {
          name = "helloWorld";
          entrypoint = "echo 'Hello World!'";
        };
      };
    }

    To invoke the job:

    m . /helloWorld
  10. Default security behavior and binary cache configuration

    main

    Makes follows a 'fail-safe defaults' approach regarding file ownership and artifact sharing:

    File Ownership

    Generated files are created inside user-owned folders by default, inheriting the user's existing directory security. Users can opt-out of this via environment variables.

    Binary Caching and Artifact Sharing

    By default, the contents of the /nix/store are never published to the internet. The default configuration uses a read-only binary cache (e.g., https://cache.nixos.org) and no write binary cache.

    To share artifacts with other users to improve performance, you must explicitly configure a read+write binary cache and provide the corresponding access secret.

  11. Verify the security assurance of Makes

    main

    Makes provides software assurance based on a Structured Assurance Case Model. Users can verify the security posture of the Makes CLI application through the following proofs:

    1. Code Vulnerability Verification

    The Python code for the Makes CLI is reviewed using SonarCloud on every pull request. To verify that the code is free of known vulnerabilities:

    2. Dependency Security Verification

    Dependencies for the Makes CLI are monitored via Fluid Attacks Continuous Hacking. You can verify this security coverage by viewing the official Fluid Attacks Certificate.