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

Preserve permission bits on updateself #76

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bitwarden.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ echo ""
function downloadSelf() {
if curl -L -s -w "http_code %{http_code}" -o $SCRIPT_PATH.1 $BITWARDEN_SCRIPT_URL | grep -q "^http_code 20[0-9]"
Copy link

@sincerelysaucy sincerelysaucy Mar 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The normal method of controlling permissions is to specifically set them, not to merely copy them and rely on the history of permissions of the previous deployment. Relying on history that is out of the control of the deployment tool creates uncertainty of deployment, a dangerous practice for a security tool.

then
if [ -e $SCRIPT_PATH ]; then
chmod --reference $SCRIPT_PATH $SCRIPT_PATH.1
fi
mv -f $SCRIPT_PATH.1 $SCRIPT_PATH
chmod u+x $SCRIPT_PATH
else
Expand Down