fix(gateway): fail closed when auth_pair bearer RNG fails - #92
Closed
cursor[bot] wants to merge 1 commit into
Closed
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
auth_pair ignored generate_random_hex failures, so urandom/OOM left an uninitialized stack buffer as the bearer, wrote it to auth_tokens.json, and burned the pairing code. Check the RNG result before mutating store state and keep the pending code usable for retry. Co-authored-by: esadrianno <esadrianno@gmail.com>
4 tasks
Collaborator
|
Superseded by #98 (rewrite contra |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
auth_pairnow checksgenerate_random_hexand returns-1on RNG/OOM failure before touchingauth_tokens.jsonor clearing the pending pairing code.crypto_read_urandomfailure and asserts no tokens file write, pending code retained, and a later successful pair.Bug
On
main@d367477,auth_pairignoredgenerate_random_hexfailure. Trigger:/dev/urandomopen/read failure or malloc failure inside the helper (PoC viacrypto_test_force_urandom_fail). Impact: pairing returned success with an uninitialized/empty bearer, wrote[""](or garbage) toauth_tokens.json, and consumed the pairing code so retry required manual file cleanup. Distinct from #71 (O_TRUNC wipe after successful hex gen) and #72 (auth cleanup UAF).Test plan
make test_auth && ./build/test_authauth_pairreturns-1, no tokens file, pending code still pairsChangelog