Commit dd36d29
committed
osxkeychain: avoid incorrectly skipping store operation
git-credential-osxkeychain skips storing a credential if its "get"
action sets "state[]=osxkeychain:seen=1". This behavior was introduced
in e1ab45b (osxkeychain: state to skip unnecessary store operations,
2024-05-15), which appeared in v2.46.
However, this state[] persists even if a credential returned by
"git-credential-osxkeychain get" is invalid and a subsequent helper's
"get" operation returns a valid credential. Another subsequent helper
(such as [1]) may expect git-credential-osxkeychain to store the valid
credential, but the "store" operation is incorrectly skipped because it
only checks "state[]=osxkeychain:seen=1".
To solve this issue, "state[]=osxkeychain:seen" needs to contain enough
information to identify whether the current "store" input matches the
output from the previous "get" operation (and not a credential from
another helper).
Set "state[]=osxkeychain:seen" to a value encoding the credential output
by "get", and compare it with a value encoding the credential input by
"store".
[1]: https://github.com/hickford/git-credential-oauth
Reported-by: Petter Sælen <petter@saelen.eu>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Koji Nakamaru <koji.nakamaru@gree.net>1 parent fd372d9 commit dd36d29
File tree
3 files changed
+132
-30
lines changed- contrib/credential/osxkeychain
3 files changed
+132
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
7 | 40 | | |
8 | 41 | | |
9 | 42 | | |
10 | 43 | | |
11 | | - | |
| 44 | + | |
| 45 | + | |
12 | 46 | | |
13 | 47 | | |
14 | 48 | | |
15 | 49 | | |
16 | 50 | | |
17 | 51 | | |
18 | | - | |
| 52 | + | |
19 | 53 | | |
20 | 54 | | |
21 | 55 | | |
22 | 56 | | |
23 | 57 | | |
24 | 58 | | |
25 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
26 | 63 | | |
27 | 64 | | |
28 | 65 | | |
| |||
Lines changed: 92 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
15 | | - | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | 54 | | |
73 | 55 | | |
74 | 56 | | |
| |||
112 | 94 | | |
113 | 95 | | |
114 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
115 | 157 | | |
116 | 158 | | |
117 | 159 | | |
| |||
124 | 166 | | |
125 | 167 | | |
126 | 168 | | |
| 169 | + | |
127 | 170 | | |
128 | 171 | | |
129 | 172 | | |
| |||
163 | 206 | | |
164 | 207 | | |
165 | 208 | | |
| 209 | + | |
166 | 210 | | |
167 | 211 | | |
168 | 212 | | |
| |||
173 | 217 | | |
174 | 218 | | |
175 | 219 | | |
176 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
177 | 228 | | |
178 | 229 | | |
179 | 230 | | |
| |||
288 | 339 | | |
289 | 340 | | |
290 | 341 | | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | 342 | | |
295 | 343 | | |
296 | 344 | | |
297 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
298 | 358 | | |
299 | 359 | | |
300 | 360 | | |
| |||
403 | 463 | | |
404 | 464 | | |
405 | 465 | | |
406 | | - | |
407 | | - | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
408 | 469 | | |
409 | 470 | | |
410 | 471 | | |
| |||
443 | 504 | | |
444 | 505 | | |
445 | 506 | | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
446 | 510 | | |
447 | 511 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
0 commit comments