Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Use download url and checksum of binaries stored in taiki-e/install-action #1720

Open
NobodyXu opened this issue Jun 8, 2024 · 10 comments

Comments

@NobodyXu
Copy link
Member

NobodyXu commented Jun 8, 2024

We could use checksum in taiki-e/install-action to make sure the pre-built binaries are not modified.

Originally posted in taiki-e/install-action#514 (comment)

@NobodyXu NobodyXu changed the title Feature: Use checksum of binaries stored in taiki-e/install-action Feature: Use download url and checksum of binaries stored in taiki-e/install-action Sep 20, 2024
@NobodyXu
Copy link
Member Author

The download url/template in taiki-e/install-action can be used to speedup package resolution.

NobodyXu added a commit to taiki-e/install-action that referenced this issue Sep 21, 2024
Motivation:

In cargo-bins/cargo-binstall#1720, I'd like to speedup cargo-binstall, by using the template recorded in taiki-e/install-action while utilise the checksum to validate the artifacts.

I've extracted all manifests I need into a crate named taiki-e-install-action-manifest-schema so that it could be publish it to crates-io
NobodyXu added a commit to taiki-e/install-action that referenced this issue Oct 2, 2024
Motivation:

In cargo-bins/cargo-binstall#1720, I'd like to speedup cargo-binstall, by using the template recorded in taiki-e/install-action while utilise the checksum to validate the artifacts.

I've extracted all manifests I need into a crate named taiki-e-install-action-manifest-schema so that it could be publish it to crates-io
@NobodyXu
Copy link
Member Author

Just think of another solution:

We could run auto-discovery on popular-crates like quickinstall/taiki-e and cache it within repository.

This is perhaps better suited for quickinstall to do as it already have the infrastructure.

@NobodyXu
Copy link
Member Author

cc @passcod @alsuren what do you think?

@passcod
Copy link
Member

passcod commented Oct 22, 2024

There's no point to this for binaries hosted in quickinstall as those are already signed and verified.

For others, we'd essentially have a crawler that downloads binaries, produces a checksum, and hosts that somewhere?

I think my concerns are provenance and mutability:

  • provenance: we can't guarantee that the crawler downloaded the right thing. we also can't represent these checksums as being a guarantee from the original file producer, so it would need some kind of warning or careful wording.
  • mutability: github release artifacts can be changed. if that happens legitimately, all binstalls for that tool version will start failing. we'd at least need to have a way to force a checksum update, in a reactive manner when breakage reports come in.

@NobodyXu
Copy link
Member Author

For others, we'd essentially have a crawler that downloads binaries, produces a checksum, and hosts that somewhere?

Well, it will just contain a url and checksum for the target.

Storing binaries will make it really hard for user to verify the content.

Storing urls and checksum will be more compact, we can just put it in a branch as a json/csv to be auditable/readable.

@alsuren
Copy link
Contributor

alsuren commented Oct 22, 2024

Last time I thought about this, I wrote these notes:

cargo-bins/cargo-quickinstall#56

I think that we should be comfortable thinking of quickinstall tarballs as immutable at this point. I have mostly been thinking that way from the start and only broke the rule once (can't remember why).

If the notary is handed the tarball url to checksum as soon as it is built, and the client checks the tarball against the checksum from the notary then we should be good. If we fuck something up in a minor way then we can just delete the tarball (and put a tombstone somewhere so that it will never be rebuilt) and the client can just rebuild from source. If we mess it up in a bad way then we can release a new version of the client that looks in a different place (with an epoch in the url scheme to count how many times we have brought shame upon ourselves).

@NobodyXu
Copy link
Member Author

NobodyXu commented Oct 23, 2024

cc @alsuren @passcod I'm thinking of a json file, containing the url and optionally, the checksum.

E.g.

{
    "target": [
        {
            "url": "...",
            "checksum": "..."
        }
    ]
}

We can put it in release, or in a branch/tag.

A tag is immutable, it can be deleted and recreated but it seems that it can be disabled in github.

@passcod
Copy link
Member

passcod commented Oct 23, 2024

Well, it will just contain a url and checksum for the target.

Sure, but we'll still need to download stuff to compute that checksum.

@NobodyXu
Copy link
Member Author

Hmmm... yeah I can't think of a good way to fix checksum, maybe we can simply omit it and only include the url?

@passcod
Copy link
Member

passcod commented Oct 23, 2024

That still leaves the problem of cache invalidation, though I suppose in the rare case that the URLs change we'll fallback to runtime resolution (and then to source).

I wonder if we'd better make an actual database-backed app for this express purpose, that reuses the binstall internals so we guarantee the exact same resolution algorithm, and doesn't store stuff in github releases so we're not rate limited.

shuttle.rs's free tier would likely be fine, or whatever other service https://www.shuttle.dev/pricing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants