You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cb8ea6e
Browse filesBrowse the repository at this point in the historyBrowse files
fix(oauth/nous): code/robustness fixes from CodeRabbit outside-diff review
- jwtExpiryMs: only accept an exp within a plausible now-relative window,
falling back to expires_in for out-of-range claims; clamp skew-adjusted
expiry to non-negative. Add a dedicated DEFAULT_ACCESS_TOKEN_TTL_MS so the
device-flow window is not reused as the access-token fallback lifetime.
- pollForToken: tolerate transient transport errors (timeout/DNS/connection)
until the device deadline; only genuine cancellation aborts early.
- writeRefreshIntent: re-apply owner-only 0o700 on an existing intent dir.
- resolvePortalBaseUrl docstring: stop claiming Hermes host-allowlist parity.
- parseTokenPayload: device-login missing refresh_token is invalid_token, not
refresh_token_reused; missing access_token is now a terminal error.
- index.ts: anchor nous defaultRefreshPolicy explicitly to lazy-only.
- Live test: import NOUS_INFERENCE_BASE_URL instead of the hard-coded URL; use a
structural refresh-only def type instead of the non-exported OAuthProviderDef.
- Regressions: implausible exp falls back to expires_in; device-login missing
refresh_token is invalid_token.
// Rotation path: the server consumed RT-A but returned no replacement, so
432
+
// reusing RT-A would trigger refresh_token_reused and revoke the session.
433
+
thrownewNousTokenError(
434
+
undefined,
435
+
"refresh_token_reused",
436
+
"Nous Portal did not return a replacement refresh token; refusing to reuse the consumed one (would trigger refresh_token_reused and revoke the session)",
437
+
{terminal: true},
438
+
);
439
+
}
440
+
// Device-login path: no refresh token was submitted; a missing refresh_token
441
+
// in the initial token response is an unusable response, not a reuse.
413
442
thrownewNousTokenError(
414
443
undefined,
415
-
"refresh_token_reused",
416
-
"Nous Portal did not return a replacement refresh token; refusing to reuse the consumed one (would trigger refresh_token_reused and revoke the session)",
444
+
"invalid_token",
445
+
"Nous Portal token response did not include a refresh token",
417
446
{terminal: true},
418
447
);
419
448
}
@@ -431,8 +460,9 @@ function parseTokenPayload(payload: NousTokenResponse, submittedRefreshToken: st
0 commit comments