-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
install_release.sh wrong SERVER_URL and SHA256 #4098
Comments
The script Therefore, this script is always updated one commit after the tag (along with the github pages referencing the new version): abc1be4 For This script is always intended to be executed on the |
OK, gotcha. Actually, yes: the version of the code I downloaded was from a release tag. Thanks. |
The install_release.sh script is updated one commit after the release tag, which may be confusing. For convenience, new lightweight tags have been added (for example v2.5-install-release) to point to the commit where install_release.sh is updated. But these tags interfere with "git describe" to generate pretty filenames when executing ./release.sh on a development branch, so ignore them. Before: release-v2.5-install-release-17-gc57a0512b After: release-v2.5-18-gc57a0512b Refs #4098 comment <#4098 (comment)>
The install_release.sh script is updated one commit after the release tag, which may be confusing. For convenience, new lightweight tags have been added (for example v2.5-install-release) to point to the commit where install_release.sh is updated. But these tags interfere with "git describe" to generate pretty filenames when executing ./release.sh on a development branch, so ignore them. Before: release-v2.5-install-release-17-gc57a0512b After: release-v2.5-18-gc57a0512b Refs Genymobile#4098 comment <Genymobile#4098 (comment)>
Hello @rom1v, "This script is always intended to be executed on the master branch as a convenience to install the latest release" please consider tagging it to releases or tags. kindly refer to releases here as an example. https://github.com/gohugoio/hugo/releases/tag/v0.131.0 This will ensure the checksums are available to everyone and are not hard-coded into the install script. We can then modify the install script to verify the hash. Kindly refer this script as an example https://gist.github.com/adityatelange/98a6b8e8cf9551a5eeee129aead01823 Regards. |
Reopening issue as the script's existence is still misleading users into using it, and there is now a proposed solution to improve the script and make it work not only for the master branch but for future releases as well. |
I totally agree that it is confusing. In theory, Before that script, the commands to execute were just documented. The script just does it automatically.
There is already such a file, but I don't want to use that for It is important that the checksum is hardcoded in a commit, because that gives some level of trust (it cannot be maliciously modified without a high probability of being noticed by many git users). By contrast, someone with write access to the repo might change the checksum file in the release, and Of course, the solution to this problem is known: public key cryptography (I also publish a signature
I might consider to move the tag just after the binaries are generated in the future, that would "solve" the problem. But I'm not sure yet. |
I knew you'd come to this as from the way I mentioned, the binary will be safe from tampering but not checksusms.txt is not. And this is a never ending cycle. You have to trust Github here to provide the server package as it is without tampering. |
I am not sure how the release takes place, or maintainers directly drag and drop binaries as assets in a release. ca7ab50b2e25a0e5af7599c30383e365983fa5b808e65ce2e1c1bba5bfe8dc3b scrcpy-server-v2.6.1
17a5d4d17230b4c90fad45af6395efda9aea287a03c04e6b4ecc9ceb8134ea04 scrcpy-win32-v2.6.1.zip
041fc3abf8578ddcead5a8c4a8be8960b7c4d45b21d3370ee2683605e86a728c scrcpy-win64-v2.6.1.zip
Lines 34 to 38 in 44b3fd8
to git clone https://github.com/Genymobile/scrcpy --branch v2.6.1
cd scrcpy
./install_release.sh
#!/usr/bin/env bash
set -e
GIT_TAG_VERSION=$(git describe --exact-match --tags)
BUILDDIR=build-auto
PREBUILT_SERVER_URL=https://github.com/Genymobile/scrcpy/releases/download/$GIT_TAG_VERSION/scrcpy-server-$GIT_TAG_VERSION
PREBUILT_SERVER_CHECKSUM=https://github.com/Genymobile/scrcpy/releases/download/$GIT_TAG_VERSION/SHA256SUMS.txt
rm -rf scrcpy-server*
rm -rf SHA256SUMS.*
echo "[scrcpy] Downloading prebuilt server..."
wget "$PREBUILT_SERVER_URL"
echo "[scrcpy] Downloading prebuilt server checksum..."
wget "$PREBUILT_SERVER_CHECKSUM"
echo "[scrcpy] Verifying prebuilt server..."
PREBUILT_SERVER_SHA256=$(grep "scrcpy-server-$GIT_TAG_VERSION" SHA256SUMS.txt)
if echo $PREBUILT_SERVER_SHA256 | sha256sum --check ;then
echo "[scrcpy] Building client..."
rm -rf "$BUILDDIR"
meson setup "$BUILDDIR" --buildtype=release --strip -Db_lto=true \
-Dprebuilt_server=scrcpy-server
cd "$BUILDDIR"
ninja
echo "[scrcpy] Installing (sudo)..."
sudo ninja install
else
echo "[scrcpy] Checksum verification failed!"
fi |
Sorry, there is no way the script will download and accept a file that can be replaced on the remote server in the future. |
I'm blind. Can't see where $GIT_CLONED_VERSION variable defined! |
Try developing an ability to correlate that it is a typo for |
You can use the git hash then. Since that depends on the previous changes, it cannot be altered: https://stackoverflow.com/questions/460297/git-finding-the-sha1-of-an-individual-file-in-the-index#answer-460422 |
@pupitetris, strange people are arguing if any of git used command returns valid hash compared to sha command. Haven't used and needed such git function. But if returns wrong hash it's usless. |
So you have trust issues on GitHub or the future maintainer of this project. Alright, so if they can replace the remote server file they can ofcourse rewrite the git history as well. What I can also see is the commits aren't signed by any key so they can do it without anyone even noticing it. Thoughts? |
Tag |
The install_release.sh script is updated one commit after the release tag, which may be confusing. For convenience, new lightweight tags have been added (for example v2.5-install-release) to point to the commit where install_release.sh is updated. But these tags interfere with "git describe" to generate pretty filenames when executing ./release.sh on a development branch, so ignore them. Before: release-v2.5-install-release-17-gc57a0512b After: release-v2.5-18-gc57a0512b Refs Genymobile#4098 comment <Genymobile#4098 (comment)>
Environment
Describe the bug
After a successful installation, scrcpy won´t run because install_release.sh pulled an old version of the scrcpy-server binary.
On errors, please provide the output of the console (and
adb logcat
if relevant).The solution was to get the url for the v2.0 binary, calculate the SHA256 hash and replace the values on the script:
to:
And run the script again. Now scrcpy runs fine.
I suppose those values on the script should be generated automatically using a template or something when generating the release.
Cheers!
The text was updated successfully, but these errors were encountered: