Repository navigation
fix(auth): count wrong codes only for requests that exist (review fixes for #1164) - #1171
Merged
HexaField merged 1 commit intoSep 26, 2026
Merged
Conversation
agent.generateJwt needs no token, and each made-up request id added an entry to FAILED_CODE_ATTEMPTS that was never removed. - A wrong code counts only while the request id has a permitted request. A made-up id returns the error and records nothing. - The entry is removed when the lockout drops the request's codes. The call that triggers the lockout returns "Too many wrong codes". - exception_visible parses ExceptionInfo and matches ExceptionType with no `_` arm, so a new type fails to compile until someone decides who sees it. Unknown types go to approvers only. - sync-state-change uses LazyDid, so a socket opened before agent.generate() gets sync-state once the DID exists. Implements review 5327106399 on #1164. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Stacked on #1164. Implements my review 5327106399 on it.
Changes:
capabilities/mod.rs:381). A wrong code counts only while the request id has a permitted request (requests_map::has_requests_for). A made-up id returns the error and records nothing. The lockout removes the entry together with the request's codes. The call that triggers the lockout now returns "Too many wrong codes"; later calls get "Can't find permitted request", so I adjusteda_request_stops_accepting_codes_after_too_many_wrong_onesto match.Tests:
made_up_request_ids_leave_no_attempt_entries(10k made-up ids, 0 entries left; 10000 on fix(events): keep app tokens, webhook secrets and other users' perspectives out of broadcasts #1164's head) anda_locked_out_request_leaves_no_attempt_entry. Both fail on fix(events): keep app tokens, webhook secrets and other users' perspectives out of broadcasts #1164's head.events_ws.rs:665).exception_visibleparsesExceptionInfoand matchesExceptionTypewith no_arm. Unknown types go to approvers only. Test:exceptions_of_an_unknown_type_reach_only_sessions_that_can_approve_apps(fails on fix(events): keep app tokens, webhook secrets and other users' perspectives out of broadcasts #1164's head).events_ws.rs:162).s_syncusesLazyDid. Test:sync_state_reaches_a_socket_opened_before_the_did_resolvedgoes throughbuild_event_stream, opens the stream before the DID exists, and checks that only the main agent's event arrives. It fails on fix(events): keep app tokens, webhook secrets and other users' perspectives out of broadcasts #1164's head, and would also fail withbroadcast_stream!.Not done:
agent_ws.rs:501, useguards::refuse_user_sessionfrom fix(api): keep user sessions off node operations; sign as the user #1167. That needs both PRs merged first.Tests:
cargo test --release -p ad4m-executor --libwith filters_tests::(518 passed),capabilities::(25 passed) andevents_ws::(25 passed).🤖 Generated with Claude Code