Commit a4875f2
Tighten OIDC token-kind and status validation
Three minor follow-ups to the device-flow review:
- storeTokens validated both the access_token and the id_token for
control/non-ASCII chars, but getToken() only ever serves (and sends)
one of them. A stray char in the unused kind - which never reaches a
header or a PG-wire password - aborted an otherwise-usable grant.
Validate only the served kind (groupsInToken ? idToken : accessToken);
the served kind is still strictly checked.
- The HTTP status classifiers keyed off the first digit with only a
length > 0 guard, so a malformed short all-digit status like "2" or
"5" could be read as a 2xx/5xx. readResponse already guarantees bare
digits; require exactly 3 of them, so a malformed-length status falls
through to the terminal reject path instead of being trusted.
- getTokenSilently's javadoc claimed it "never blocks". It does not wait
on interactive input or behind another thread's sign-in, but it can
make one synchronous refresh round-trip bounded by httpTimeoutMillis.
Reword to say so, matching the HttpTokenProvider contract.
Tests (both proven to fail without their fix):
- a control char in the unused id_token (groupsInToken=false) no longer
aborts the grant;
- a 1-digit "2" status from the token endpoint is rejected, not accepted
as success, and the smuggled token never surfaces.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 0493b4c commit a4875f2
2 files changed
Lines changed: 94 additions & 20 deletions
File tree
- core/src
- main/java/io/questdb/client/cutlass/auth
- test/java/io/questdb/client/test/cutlass/auth
Lines changed: 31 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
440 | 440 | | |
441 | 441 | | |
442 | 442 | | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
448 | 448 | | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
453 | 455 | | |
454 | 456 | | |
455 | 457 | | |
| |||
979 | 981 | | |
980 | 982 | | |
981 | 983 | | |
982 | | - | |
983 | | - | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
984 | 988 | | |
985 | 989 | | |
986 | 990 | | |
987 | | - | |
988 | | - | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
989 | 994 | | |
990 | 995 | | |
991 | 996 | | |
992 | 997 | | |
993 | | - | |
994 | | - | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
995 | 1001 | | |
996 | 1002 | | |
997 | 1003 | | |
| |||
1241 | 1247 | | |
1242 | 1248 | | |
1243 | 1249 | | |
1244 | | - | |
1245 | | - | |
1246 | | - | |
1247 | | - | |
1248 | | - | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
1249 | 1260 | | |
1250 | 1261 | | |
1251 | 1262 | | |
| |||
Lines changed: 63 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3176 | 3176 | | |
3177 | 3177 | | |
3178 | 3178 | | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
| 3195 | + | |
| 3196 | + | |
| 3197 | + | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
| 3201 | + | |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
| 3216 | + | |
| 3217 | + | |
| 3218 | + | |
| 3219 | + | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
| 3223 | + | |
| 3224 | + | |
| 3225 | + | |
| 3226 | + | |
| 3227 | + | |
| 3228 | + | |
| 3229 | + | |
| 3230 | + | |
| 3231 | + | |
| 3232 | + | |
| 3233 | + | |
| 3234 | + | |
| 3235 | + | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
| 3240 | + | |
| 3241 | + | |
3179 | 3242 | | |
3180 | 3243 | | |
3181 | 3244 | | |
| |||
0 commit comments