diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2020-06-10 14:54:13 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2020-06-12 18:56:11 +0200 |
| commit | 52c529ff20b389eb64ac033586e6b1a5c5d82cb5 (patch) | |
| tree | a7ebdb0c7a019a4062508a58168d7c9a35500879 /tests/git-authenticate.scm | |
| parent | 7def5056b631978e246211fabe81e0754c795ebe (diff) | |
git-authenticate: Disallow SHA1 (and MD5) signatures.
* guix/git-authenticate.scm (commit-signing-key): Add
#:disallowed-hash-algorithms and honor it.
(authenticate-commit)[recent-commit?]: New variable.
Pass #:disallowed-hash-algorithms to 'commit-signing-key'.
* tests/git-authenticate.scm ("signed commits, SHA1 signature"): New test.
Diffstat (limited to 'tests/git-authenticate.scm')
| -rw-r--r-- | tests/git-authenticate.scm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/git-authenticate.scm b/tests/git-authenticate.scm index 84689d628e4..97990acaea5 100644 --- a/tests/git-authenticate.scm +++ b/tests/git-authenticate.scm | |||
| @@ -81,6 +81,35 @@ | |||
| 81 | #:keyring-reference "master") | 81 | #:keyring-reference "master") |
| 82 | 'failed))))) | 82 | 'failed))))) |
| 83 | 83 | ||
| 84 | (unless (which (git-command)) (test-skip 1)) | ||
| 85 | (test-assert "signed commits, SHA1 signature" | ||
| 86 | (with-fresh-gnupg-setup (list %ed25519-public-key-file | ||
| 87 | %ed25519-secret-key-file) | ||
| 88 | ;; Force use of SHA1 for signatures. | ||
| 89 | (call-with-output-file (string-append (getenv "GNUPGHOME") "/gpg.conf") | ||
| 90 | (lambda (port) | ||
| 91 | (display "digest-algo sha1" port))) | ||
| 92 | |||
| 93 | (with-temporary-git-repository directory | ||
| 94 | `((add "a.txt" "A") | ||
| 95 | (add "signer.key" ,(call-with-input-file %ed25519-public-key-file | ||
| 96 | get-string-all)) | ||
| 97 | (add ".guix-authorizations" | ||
| 98 | ,(object->string | ||
| 99 | `(authorizations (version 0) | ||
| 100 | ((,(key-fingerprint %ed25519-public-key-file) | ||
| 101 | (name "Charlie")))))) | ||
| 102 | (commit "first commit" | ||
| 103 | (signer ,(key-fingerprint %ed25519-public-key-file)))) | ||
| 104 | (with-repository directory repository | ||
| 105 | (let ((commit (find-commit repository "first"))) | ||
| 106 | (guard (c ((unsigned-commit-error? c) | ||
| 107 | (oid=? (git-authentication-error-commit c) | ||
| 108 | (commit-id commit)))) | ||
| 109 | (authenticate-commits repository (list commit) | ||
| 110 | #:keyring-reference "master") | ||
| 111 | 'failed)))))) | ||
| 112 | |||
| 84 | (unless (gpg+git-available?) (test-skip 1)) | 113 | (unless (gpg+git-available?) (test-skip 1)) |
| 85 | (test-assert "signed commits, default authorizations" | 114 | (test-assert "signed commits, default authorizations" |
| 86 | (with-fresh-gnupg-setup (list %ed25519-public-key-file | 115 | (with-fresh-gnupg-setup (list %ed25519-public-key-file |
