Repository navigation
Reject credentials without a JWT marker instead of looping at EOF - #1020
AayushDani wants to merge 2 commits into
Conversation
df5558e to
699fdb2
Compare
Marked ready for review. @caspervonb can you please merge the PR? |
ce16b65 to
2822a91
Compare
2822a91 to
be2afae
Compare
be2afae to
5c450d9
Compare
|
PTAL @claude |
|
Claude finished @caspervonb's task in 1m 28s —— View job Review
Verdict: looks correct and safe to merge.
One minor style nit, not a blocker: the new code raises
No functional issues found. This is a clean, narrowly-scoped fix for a real synchronous-hang bug, consistent with the repo's legacy-client conventions (Apache header file, |
The legacy client's JWT credential reader loops forever at EOF when a credential file or
RawCredentialsvalue has noBEGIN NATS USER JWTmarker. Because this reader runs synchronously, the loop can block the asyncio thread; an asyncio timeout cannot interrupt it.Raise the existing
InvalidUserCredentialsErroron EOF. Regression tests cover empty and seed-only synthetic input through string paths,Path, andRawCredentials, using a bounded subprocess so the old behavior cannot hang the test runner. Valid JWT blocks after a preamble remain covered. This change leaves reconnect/retry policy unchanged.Validation on Python 3.12.14/macOS arm64 with NATS Server 2.14.6:
The other Python/OS combinations and modern-client runtime tests remain for upstream CI.
AI assistance: OpenAI Codex implemented and tested this change.