Repository navigation
Commit 17772cf
committed
krn-napi-binding: reclassify OAuth token-exchange failures as Unauthenticated
Per src/kernel_error.rs:74-77 doc-comment, Unauthenticated is the
intended ErrorCode for "Server returned HTTP 401 (or OIDC discovery
rejected the token request)". M2M and U2M token-exchange paths were
using Error::io() (-> Internal), which is reserved for kernel-side
I/O / parsing failures. The misclassification caused authentication
failures to surface in NodeJS as HiveDriverError instead of
AuthenticationError (D-015).
Fix: m2m.rs:270 and u2m.rs:433 swap Error::io() -> Error::unauthenticated().
No kernel unit tests assert ErrorCode::Internal on these paths
(verified by grep) so no test updates are needed. The U2M test
`test_u2m_cache_miss_with_expired_refresh` asserts only `result.is_err()`,
which remains true.
Deferred (worth a follow-up): distinguish oauth2::RequestTokenError
subtypes so 5xx token-endpoint failures get NetworkError while
invalid_client / invalid_grant / unauthorized_client stay
Unauthenticated. The current change correctly handles the dominant
case (bad-credentials -> 400/401 from server) and matches the
existing kernel doc-comment intent.
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>1 parent 62f6c10 commit 17772cf
2 files changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
| 290 | + | |
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
450 | | - | |
| 450 | + | |
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
| |||
0 commit comments