Repository navigation
Commit 49d736d
fix(helper): fail KeyStoreHelper.run when the X.509 context watch fails
KeyStoreHelper's X.509 context watcher released the run latch and then
threw a WatcherException from onError. DefaultWorkloadApiClient invokes
watchers on gRPC executor threads, so the exception never reached the
thread blocked in run: run returned normally, as if the KeyStore had
been written. run(false) therefore reported success when the first
X.509 context could not be fetched or stored, and the CLI, which uses
run(true), exited with status 0 after a failed watch (for example
PERMISSION_DENIED from the Workload API, or an update that could not be
stored). The existing error test passed only because its stub calls
onError synchronously on the caller's thread.
Record the first error reported while run is waiting and throw it from
run after the latch is released, so run fails with
KeyStoreHelperException as documented and the CLI exits with status 1.
Errors arriving after run has returned are only logged; previously the
exception thrown from onError could also cancel the gRPC stream.
Fixes spiffe#488
Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>1 parent ae84260 commit 49d736d
2 files changed
Lines changed: 48 additions & 2 deletions
File tree
- java-spiffe-helper/src
- main/java/io/spiffe/helper/keystore
- test/java/io/spiffe/helper/keystore
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| 170 | + | |
169 | 171 | | |
170 | 172 | | |
171 | 173 | | |
| |||
183 | 185 | | |
184 | 186 | | |
185 | 187 | | |
186 | | - | |
187 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
188 | 194 | | |
189 | 195 | | |
190 | 196 | | |
191 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
192 | 203 | | |
193 | 204 | | |
194 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
375 | 376 | | |
376 | 377 | | |
377 | 378 | | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
378 | 403 | | |
379 | 404 | | |
380 | 405 | | |
| |||
439 | 464 | | |
440 | 465 | | |
441 | 466 | | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
442 | 477 | | |
443 | 478 | | |
444 | 479 | | |
| |||
0 commit comments