@@ -48,6 +48,23 @@ test_expect_success GPGSSH 'create signed tags ssh' '
48
48
git tag -u"${GPGSSH_KEY_UNTRUSTED}" -m eighth eighth-signed-alt
49
49
'
50
50
51
+ test_expect_success GPGSSH,GPGSSH_VERIFYTIME ' create signed tags with keys having defined lifetimes' '
52
+ test_when_finished "test_unconfig commit.gpgsign" &&
53
+ test_config gpg.format ssh &&
54
+
55
+ echo expired >file && test_tick && git commit -a -m expired -S"${GPGSSH_KEY_EXPIRED}" &&
56
+ git tag -s -u "${GPGSSH_KEY_EXPIRED}" -m expired-signed expired-signed &&
57
+
58
+ echo notyetvalid >file && test_tick && git commit -a -m notyetvalid -S"${GPGSSH_KEY_NOTYETVALID}" &&
59
+ git tag -s -u "${GPGSSH_KEY_NOTYETVALID}" -m notyetvalid-signed notyetvalid-signed &&
60
+
61
+ echo timeboxedvalid >file && test_tick && git commit -a -m timeboxedvalid -S"${GPGSSH_KEY_TIMEBOXEDVALID}" &&
62
+ git tag -s -u "${GPGSSH_KEY_TIMEBOXEDVALID}" -m timeboxedvalid-signed timeboxedvalid-signed &&
63
+
64
+ echo timeboxedinvalid >file && test_tick && git commit -a -m timeboxedinvalid -S"${GPGSSH_KEY_TIMEBOXEDINVALID}" &&
65
+ git tag -s -u "${GPGSSH_KEY_TIMEBOXEDINVALID}" -m timeboxedinvalid-signed timeboxedinvalid-signed
66
+ '
67
+
51
68
test_expect_success GPGSSH ' verify and show ssh signatures' '
52
69
test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
53
70
(
@@ -80,6 +97,31 @@ test_expect_success GPGSSH 'verify and show ssh signatures' '
80
97
)
81
98
'
82
99
100
+ test_expect_success GPGSSH,GPGSSH_VERIFYTIME ' verify-tag exits failure on expired signature key' '
101
+ test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
102
+ test_must_fail git verify-tag expired-signed 2>actual &&
103
+ ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
104
+ '
105
+
106
+ test_expect_success GPGSSH,GPGSSH_VERIFYTIME ' verify-tag exits failure on not yet valid signature key' '
107
+ test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
108
+ test_must_fail git verify-tag notyetvalid-signed 2>actual &&
109
+ ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
110
+ '
111
+
112
+ test_expect_success GPGSSH,GPGSSH_VERIFYTIME ' verify-tag succeeds with tag date and key validity matching' '
113
+ test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
114
+ git verify-tag timeboxedvalid-signed 2>actual &&
115
+ grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual &&
116
+ ! grep "${GPGSSH_BAD_SIGNATURE}" actual
117
+ '
118
+
119
+ test_expect_success GPGSSH,GPGSSH_VERIFYTIME ' verify-tag failes with tag date outside of key validity' '
120
+ test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
121
+ test_must_fail git verify-tag timeboxedinvalid-signed 2>actual &&
122
+ ! grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual
123
+ '
124
+
83
125
test_expect_success GPGSSH ' detect fudged ssh signature' '
84
126
test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
85
127
git cat-file tag seventh-signed >raw &&
0 commit comments