Skip to content

Verify the checksum #427

@suzuki-shunsuke

Description

@suzuki-shunsuke

ref. https://zenn.dev/shunsuke_suzuki/scraps/7cfc2d3a5c6d04

Overview

Verify the checksum of downloaded file, and if the checksum is wrong make the installation failure.

Motivation

Make aqua secure.
Prevent the supply chain atack.

Consideration

We have to keep aqua simple. We should avoid making aqua complicated by introducing checksum verification.

Proposal of Specification

When a tool is installed, aqua verifies the checksum as the following.

  1. Download the file in the temporal directory
  2. Calculate the checksum from the downloaded file
  3. Read the file .aqua-checksums.json on the same directory as aqua configuration file. If .aqua-checksums.json isn't found, aqua treats the file is empty
  4. Get the expected checksum of downloaded file from .aqua-checksums.json
  5. If the actual checksum is different from the expected checksum, make the installation failure. If the checksum isn't found in .aqua-checksums.json, the actual checksum is added to .aqua-checksums.json
  6. Install the file

⚠️ Note

If the file is falsified before the correct checksum is added to .aqua-checksums.json, it is difficult to detect the falsification.

💡 Ignore the specific checksum verification

If you would like to ignore the specific checksum verification, you can do it by removing the checksum from .aqua-checksums.json.

.aqua-checksums.json

Pairs of package id and checksum are recorded.

e.g.

{
  "github_archive/github.com/tfutils/tfenv/v2.2.3": "0b42330aeed675ad3e5dd6063dbd1daabecb36180e515cca1c6e105dd7a1fa49"
}

This file is created and updated by aqua automatically, so you don't have to update this file manually.

Question: Should .aqua-checksums.json be managed with Git?

Coming soon

Algorithm to calculate checksums

sha256 is used for goreleaser by default, so aqua would also support sha256 by default.
In future, aqua may support other algorithms too.

Idea: command to update .aqua-checksums.json like terraform providers lock

Coming soon

Future work

  • Verify Registry
  • Verify aqua-proxy
  • Support checksum algorithm other than sha256
  • Get checksums from GitHub Releases's file

Implementation

Reference

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions