You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
share the .gitsecret/keys folder via bind-mount with docker on Windows via Docker Desktop (Docker Desktop sets permissions to read/write/execute for users, groups and others 0777 - this can not be changed)
run git secret hide
observe error message gpg: WARNING: unsafe permissions on homedir
Run the following script on Windows using Docker Desktop
The default permissions on shared volumes are not configurable. If you are working with applications that require permissions different from the shared volume defaults at container runtime, you need to either use non-host-mounted volumes or find a way to make the applications work with the default file permissions.
Docker Desktop does not enable you to control (chmod) the Unix-style permissions on shared volumes for deployed containers, but rather sets permissions to a default value of 0777 (read, write, execute permissions for user and for group) which is not configurable.
FYI: As a workaround, we are currently using a shim for gpg that adds the --no-permission-warning back when --encrypt is used as an option:
#!/usr/bin/env bash
if [[ ! "$@" =~ "--no-permission-warning" && "$@" =~ "--encrypt" ]]
then
/usr/bin/gpg $@ --no-permission-warning
else
/usr/bin/gpg $@
fi
The file is located at /usr/local/bin/gpg ( /usr/local/bin/ comes first in the $PATH and will thus take precedence over the "real" gpg in /usr/bin/gpg).
But this is obviously not a desirable solution and probably has some side effects somewhere :(
This is done in our Dockerfile via:
# Note:
# In v0.5.0 of `git-secret` the `--no-permission-warning` flag was removed from certain commands.
# This issues a warning due to unsafe permissions when encrypting filed:
# ```
# gpg: WARNING: unsafe permissions on homedir
# ```
# Unfortunately, we cannot modify the permissions of the `homedir` in a Docker Desktop setup, because
# the `homedir` is part of the repository and thus bind-mounted in the container:
# ```
# Docker Desktop sets permissions to read/write/execute for users, groups and others 0777 or a+rwx. This is not configurable.
# ```
# @see https://docs.docker.com/desktop/settings/windows/#file-sharing
# Thus, we create a shim for `gpg` in `/usr/local/bin/gpg` ( `/usr/local/bin/` comes first in the $PATH
# and will thus take precedence over the "real" gpg in `/usr/bin/gpg` ). The shim will add the
# `--no-permission-warning` warning as option if:
# - `--encrypt` is used
# - `--no-permission-warning` does not exist yet as an option
# and then execute the real `gpg` with all given arguments (via `$@`)
RUN path_to_original_gpg=$(which gpg) && \
echo '#!/usr/bin/env bash' >> /usr/local/bin/gpg && \
echo '' >> /usr/local/bin/gpg && \
echo 'if [[ ! "$@" =~ "--no-permission-warning" && "$@" =~ "--encrypt" ]]' >> /usr/local/bin/gpg && \
echo 'then' >> /usr/local/bin/gpg && \
echo ' '"${path_to_original_gpg}"' $@ --no-permission-warning' >> /usr/local/bin/gpg && \
echo 'else' >> /usr/local/bin/gpg && \
echo ' '"${path_to_original_gpg}"' $@' >> /usr/local/bin/gpg && \
echo 'fi' >> /usr/local/bin/gpg && \
chmod +x /usr/local/bin/gpg
What are the steps to reproduce this issue?
git secret
.gitsecret/keys
folder via bind-mount with docker on Windows via Docker Desktop (Docker Desktop sets permissions to read/write/execute for users, groups and others 0777 - this can not be changed)git secret hide
gpg: WARNING: unsafe permissions on homedir
Run the following script on Windows using Docker Desktop
See this gif for the an example
What happens?
A GPG permission warning is shown
What were you expecting to happen?
Not see any warnings
Proposal
Add an ENV variable like
DISABLE_GPG_PERMISSIONS_WARNING
that sets the--no-permission-warning
flag on thegpg
command.Any other comments?
This behavior started when we switched from v0.4.0 to v0.5.0 and is also documented in the CHANGELOG via
Unfortunately, there is no way to disable the warnings. In the setup outlined above, it is impossible to change the file permissions, see:
(https://docs.docker.com/desktop/settings/windows/#file-sharing)
(https://docs.docker.com/desktop/troubleshoot/topics/#permissions-errors-on-data-directories-for-shared-volumes)
(https://docs.docker.com/desktop/faqs/windowsfaqs/#can-i-change-permissions-on-shared-volumes-for-container-specific-deployment-requirements)
What versions of software are you using?
Operating system: (
uname -a
) …git-secret
path: (which git-secret
) …git-secret
version: (git secret --version
) …git
version: (git --version
) …Shell type and version: (
$SHELL --version
) …gpg
version: (gpg --version
) …The text was updated successfully, but these errors were encountered: