Repository navigation
Harden the CLI's downloads, the installers and the workflows - #128
Merged
Merged
Conversation
What a review rated low, in one change: - kiff --use made its scratch directory with createDirectories, which takes a directory already there under that name, and in a shared temporary directory that is someone else's. It is made new or not at all. kiff release verifies a patch in a directory of its own for the same reason, rather than at a name a link could be planted at. - curl may no longer follow a redirect from https to plain http, gives up on a connection that has stalled for two minutes, and refuses a file past half a gigabyte. The installers keep the redirect rule; a mirror named over http, as the tests name one, is unchanged. - install.sh checks a JVM zip's listing before unpacking it, as it checks a tarball's, and refuses a link in bin before the chmod that would follow it. The action's installer unpacks the zip through the same check its archives go through. - plan.sh refuses a release asset whose name is not a file name before downloading to a file of that name. - The README says what the .sha256 guards against: a corrupt download, not a substituted one, since both come from the release. - Every third-party action is pinned to a commit, with its version beside it for Dependabot to move, and every checkout in the tests workflow drops its credentials.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The low-severity CLI and tooling findings from a security review, in one change. No behaviour changes for a normal install from github.com.
KiffVersions.install,ReleaseCommand.verify):createDirectoriesaccepted a pre-existing directory of the same name in a shared$TMPDIR; the scratch directory is now created withmustCreate, andrelease --verifyrestores into a directory of its own rather than at a predictable file name a link could be planted at.Curl.fetch):--proto-redir =httpswhen the URL is https (an http mirror, as the tests use, may still redirect freely),--speed-limit 1 --speed-time 120so a stalled transfer gives up,--max-filesize 512 MiB.entry_outsidelike the tarballs, a symlink inbin/is refused beforechmod a+x bin/*, and both curl calls get the redirect rule.action/install-kiff.shunpacks the JVM zip through its existingunpackcheck./,\, or is./..before writing to a file of that name..sha256beside each asset guards against a corrupt download, not a substituted one, since both come from the same release.tests.ymlsetpersist-credentials: false.Validation:
./gradlew :cli:jvmTestpasses, including the download tests against a local server with real curl;shellcheck install.shis clean. The install and action workflows exercise the shell paths in CI.