diff options
author | Ludovic Courtès <ludo@gnu.org> | 2020-06-21 15:34:53 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-06-21 17:36:39 +0200 |
commit | 41939c374a3ef421d2d4c6453c327a9cd7af4ce5 (patch) | |
tree | 6b7b406aa82fdf8e3e9e691c76adbb709d36ec5c | |
parent | bdafdfcec9861f53f93fc9cf81c2e83fe45c35dd (diff) | |
download | guix-41939c374a3ef421d2d4c6453c327a9cd7af4ce5.tar guix-41939c374a3ef421d2d4c6453c327a9cd7af4ce5.tar.gz |
git-authenticate: Ignore authenticated commit cache when it's not #o600.
* guix/git-authenticate.scm (previously-authenticated-commits): Stat
PORT; return the empty list if it's no #o600 and change it to #o600.
-rw-r--r-- | guix/git-authenticate.scm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/guix/git-authenticate.scm b/guix/git-authenticate.scm index 228d551d11..082c44ee06 100644 --- a/guix/git-authenticate.scm +++ b/guix/git-authenticate.scm @@ -306,7 +306,14 @@ IDs (hex strings)." (catch 'system-error (lambda () (call-with-input-file (authenticated-commit-cache-file key) - read)) + (lambda (port) + ;; If PORT has the wrong permissions, it might have been tampered + ;; with by another user so ignore its contents. + (if (= #o600 (stat:perms (stat port))) + (read port) + (begin + (chmod port #o600) + '()))))) (lambda args (if (= ENOENT (system-error-errno args)) '() |