Commit b7bb36d
Harden OIDC token flow, store lock, name escaping
A batch of moderate review findings across the OIDC device flow, the
token store, the ILP-over-HTTP flush path, and the QWP senders, plus the
test-quality issues they surfaced.
OidcDeviceAuth:
- getToken()'s peer-wait budget was one httpTimeoutMillis, but a lock
holder doing a silent refresh can legitimately hold for up to
LOCK_HOLD_HTTP_TIMEOUT_MULTIPLE times that, so a concurrent caller
threw on a refresh that was going to succeed. The peer now waits the
holder's own worst-case hold.
- getToken() no longer forecloses a silent refresh when the served-kind
token is null but a refresh token exists (the partial grant a
groups-in-token sign-in with no id_token leaves behind): it attempts
the refresh instead of throwing "no token has been obtained yet".
- close()'s javadoc claimed it returns after at most one HTTP request
timeout; corrected to describe the in-flight refresh's real worst
case, an OS-bounded connect stall.
FileTokenStore:
- inLock() now serializes same-identity critical sections within one JVM
with a process-wide lock, so two OidcDeviceAuth instances for one
identity cannot both run the read-refresh-write when the cross-process
file lock degrades and double-POST the same rotating refresh token,
which a reuse-detecting IdP revokes the whole family for.
- warnNoPosixPermsOnce/warnPersistence log via SLF4J instead of
System.err, so a host application can filter and redirect them.
ILP over HTTP:
- The response-body reads inherited the raw request_timeout instead of
the per-flush budget (base plus the throughput extension), so a
tuned-low request_timeout with request_min_throughput could abort a
large, still-progressing chunked error body and turn it into a retry
of a non-retryable status. The body reads now use the per-flush budget.
QWP:
- A rejected table or column name was spliced raw into the error message
(QwpWebSocketSender, QwpUdpSender, QwpTableBuffer); it now routes
through putAsPrintable, matching the ILP name/error render, so a
BOM/bidi/control char in a hostile name cannot reorder or forge the
displayed text.
Tests:
- A swallowed Assert.fail on a mock-server thread, a mutual-exclusion
test that passed if a contender died silently (now with a barrier and
a run counter), a vacuous enum valueOf cross-check, and a sleep-gated
negative assertion that could pass before its waiter thread started are
all fixed to assert on the main thread and to prove the thread is
genuinely blocked.
- Added coverage for a unicode escape at the end of a JSON value, the
TokenStore.inLock default, putRawMessage's token stamp, and the
null-served-kind refresh; each new production fix's test is proven to
fail when the fix is reverted.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 3250b3e commit b7bb36d
13 files changed
Lines changed: 296 additions & 80 deletions
File tree
- core/src
- main/java/io/questdb/client/cutlass
- auth
- line/http
- qwp
- client
- protocol
- test/java/io/questdb/client/test
- cutlass
- auth
- json
- line
- qwp/client
Lines changed: 48 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| |||
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
| 63 | + | |
60 | 64 | | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| |||
131 | 136 | | |
132 | 137 | | |
133 | 138 | | |
| 139 | + | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
| |||
144 | 150 | | |
145 | 151 | | |
146 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
147 | 161 | | |
148 | 162 | | |
149 | 163 | | |
| |||
255 | 269 | | |
256 | 270 | | |
257 | 271 | | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
263 | 280 | | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
278 | 302 | | |
| 303 | + | |
| 304 | + | |
279 | 305 | | |
280 | 306 | | |
281 | 307 | | |
| |||
638 | 664 | | |
639 | 665 | | |
640 | 666 | | |
641 | | - | |
642 | | - | |
643 | | - | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
644 | 670 | | |
645 | 671 | | |
646 | 672 | | |
| |||
Lines changed: 31 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
| |||
145 | 148 | | |
146 | 149 | | |
147 | 150 | | |
| 151 | + | |
148 | 152 | | |
149 | 153 | | |
150 | 154 | | |
| |||
436 | 440 | | |
437 | 441 | | |
438 | 442 | | |
439 | | - | |
440 | | - | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
441 | 449 | | |
442 | 450 | | |
443 | 451 | | |
| |||
509 | 517 | | |
510 | 518 | | |
511 | 519 | | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
512 | 530 | | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | 531 | | |
520 | 532 | | |
521 | 533 | | |
| |||
1062 | 1074 | | |
1063 | 1075 | | |
1064 | 1076 | | |
1065 | | - | |
1066 | | - | |
1067 | | - | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
1068 | 1086 | | |
1069 | 1087 | | |
1070 | 1088 | | |
| |||
1625 | 1643 | | |
1626 | 1644 | | |
1627 | 1645 | | |
1628 | | - | |
1629 | | - | |
| 1646 | + | |
| 1647 | + | |
1630 | 1648 | | |
1631 | 1649 | | |
1632 | 1650 | | |
| |||
0 commit comments