-
Notifications
You must be signed in to change notification settings - Fork 0
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
Rewrote installer shell script to pull directly from Github #3
Comments
This is pretty great. Thank you @nullbio. I have mixed feelings on moving off a domain that would allow us to substitute where we mirror/host the binaries in the future, but generally I like the idea of removing another piece of complexity (keeping dotenvx.sh maintained, up, and secure). any idea on rate limits for raw.github requests? part of the solution for dotenvx.sh was to boost up to the 5,000 requests per hour per IP 1. Requests can quickly add up for those installing essentially from the same ip inside AWS or Digital Ocean, etc. |
maybe there are 3 questions here:
-- |
additional context: Sentry publishes their binaries to npm and their installer script under their domain (which appears not to be open sourced):
Pkgx hosts their installer.sh on github but under their own domain code (which appears partially open sourced): Other companies use cloudsmith.com or host static binaries at their own s3 bucket. ideally, my solution would be to offer such transparency and tooling around the dotenvx.sh domain, site, and hosting that it could be trusted and verified. somehow tooling around confirming the dns, ownership of the domain, verifying the code deployed is what is open sourced, etc. a checksum for the running site servicing the binaries so to speak. this would allow us to continue hosting or redirecting to github, but offer flexibility in the future to move binary host providers if needed (for example switching to s3). in addition to that maybe we provide a normal |
one more added note: I think dotenvx is currently one of the most transparent when it comes to hosting and publishing its binaries. the process can be completely duplicated by:
the only potential distribution security concern i've seen brought up is the same one you point to - the domain because fear of a mitm attack (which arguably github actions has as well - complexity, a junior github employee introducing a potential bug, an attacker gaining access to our ci process by credentials or some other means.) the github domain just has more trust attached to it in the public's psyche - well earned. |
downloading sentry's binary directly from the npm registry:
this is very attractive because:
|
All excellent points @motdotla. The rate limits for the unauthenticated endpoint are on the low end, I can see how that might be an issue in some setups. The script doesn't perform the API call if the user specifies an exact version, but for those who always fetch the latest it would be. Checksums are another option that might serve as an addendum security feature, sha256sum is GNU Core Utilities so it should be available on most systems out of the box. We could use something like this (should be forked first though): https://github.com/marketplace/actions/generate-checksum to include a checksum file for each release. Github & npmjs use predictable URL pathing, and if we know what version the user is requesting, we can curl the checksum file to compare the hash against the downloaded archive inside the installer script. npmjs.com could work as well, they have a public API here, example using react package: https://registry.npmjs.org/react which contains a "dist-tags:{latest:version}" version number, which could work in the same vein as the Github API request. Or we could keep the heroku endpoint to return the latest version number, and use Github (or npmjs) for the downloading. So seems we have a few best-options here:
Whatever we choose to do here, I think keeping the --version and --path features are useful for everyone. We don't need to change the default installation path if you would rather keep things how they are, I think the error messages make it fairly clear. Whatever scenario you choose, I'm happy to make the necessary changes to the script. |
agree 100% on your improvements with the version flag, etc. those are great additions. what do you think about the installer script embedding all possible versions? too noisy?
so in other words we'd programmatically publish/generate the installer.sh script. the script itself would gain git history coupled with version releases. |
A few points to consider for those who want to store the installer script locally instead of curling it:
There are some good gains to be had:
Overall I think it's a good idea and this might be the way to go, I just think we should try and limit the spam as much as possible. If we add just the version numbers and a separator, for arguments sake let's say we give 9 bytes (v11.11.11) per version number, plus the separator character, you're looking at 1-2kb given the current number of tags. Over time, I suppose we might end up adding anywhere up to 20kb to this file (over many years). Not really a big deal in the scheme of things I suppose. Plus you could always truncate the old version numbers later (that might actually be the way to go, only keep the last x number of versions. That way you could make the argument to add extra data in as well without it blowing up the file too significantly). |
good points. my thoughts:
yeah, but also removes the need to visit a remote url. all the info is right there. i like this - like visiting a README
for the security-minded this is actually a benefit. they can modify the script to only have specific versions available - and they can place that in their infrastructure. we've given them more control. in the details of the installer.sh script we can provide a url where they can visit to update their script. i'm going to make a first pass at this using what you've already built here. great conversation, thank you! i think we are going to end up with something that is better than 99% of installer scripts - could be an example for future ones. |
Sounds good, excited to see where you get with it! Happy to lend a hand if you need, just let me know. |
on vacation at the moment with family, but enjoying this work in the early mornings! some effort started here: #4 |
making progress on this: https://dotenvx.sh/install.sh includes specs: https://github.com/dotenvx/dotenvx.sh/blob/main/spec/install_spec.sh i'm going to start moving some of my own stuff over to it to test in the real world. then still to do:
|
after some solid real world testing, i've updated the documentation to use https://dotenvx.com/docs |
working on auto-generate next, but maybe before that publishing binaries to npm. then downloads can happen from there - which will give stats on each os/arch (needed) |
now that https://dotenvx.sh/install.sh has built-in branding and documentation, I'm thinking it should be at root. so that when you visit: you simply see the plaintext /install.sh script. what do you think?
downside:
what are your thoughts @nullbio ? |
That's great @motdotla, looking very clean. I think the url idea is cool, personally have no issue with it. I think it's obvious it is a sh script from the domain name + the contents, but perhaps I'm biased. |
script is now using the npm published binaries. last major step is to |
this is done. all future work on it is published as part of the release, then automatically committed to this repo, and automatically deployed. we get download count going forward: this is all living under |
Great job @motdotla ! Thank you. |
I'm not sure what you'd like to do with this, if anything, but I rewrote the shell script to pull binaries directly from GitHub releases using the tag names, version numbering, and file formats automated in your build system. While switching my current project to dotenvx, I found the need to install the binary on my Docker containers. This led me to make some adjustments to the installation script for enhanced security.
My reasons are as follows:
Here are some modifications I made and the reasoning:
As for the docs on the website, in maintaining the theme of transparency, they could say:
curl -fSs https://raw.githubusercontent.com/dotenvx/dotenvx.sh/main/installer.sh | sh
I haven't created a pull request for this because I'm not sure how you wanted to handle this, considering that if you're on board with all of this it may replace the need for the dotenvx.sh Heroku app.
Here's the code:
The text was updated successfully, but these errors were encountered: