Skip to content

fix: guard handle_pat_check against deregistered hotkey TOCTOU race (#1297)#1301

Closed
alpurkan17 wants to merge 1 commit into
entrius:testfrom
alpurkan17:fix/1297-handle-pat-check-toctou
Closed

fix: guard handle_pat_check against deregistered hotkey TOCTOU race (#1297)#1301
alpurkan17 wants to merge 1 commit into
entrius:testfrom
alpurkan17:fix/1297-handle-pat-check-toctou

Conversation

@alpurkan17
Copy link
Copy Markdown
Contributor

Summary

handle_pat_check calls metagraph.hotkeys.index(hotkey) without verifying the hotkey is still registered. A metagraph refresh between the blacklist pass and handler execution creates a TOCTOU race — the blacklist passes on a stale view, then .index() raises ValueError, crashing the axon coroutine.

Every sibling function in pat_handler.py already guards this correctly. This fix applies the same pattern used in handle_pat_broadcast.

Validation

  • uv run ruff check — clean
  • uv run ruff format --check — clean

Closes #1297

…ntrius#1297)

handle_pat_check calls metagraph.hotkeys.index(hotkey) without
first verifying the hotkey is still registered. A metagraph refresh
between blacklist pass and handler execution causes an uncaught
ValueError that crashes the axon coroutine.

Fix matches handle_pat_broadcast pattern: reject early with a clear
rejection_reason when the hotkey is not in metagraph.hotkeys.
@xiao-xiao-mao
Copy link
Copy Markdown

xiao-xiao-mao Bot commented May 18, 2026

You already have 4 open PRs in this repo. The threshold is 3, so closing this one until a maintainer can triage your existing PRs. Please don't open any more — they'll be closed too.

@xiao-xiao-mao xiao-xiao-mao Bot closed this May 18, 2026
@alpurkan17
Copy link
Copy Markdown
Contributor Author

I have closed #1263 and #1257 (both had deleted source branches). Currently at 2 open PRs (#1278, #1247). Could you please reopen this PR? The fix is ready: +5 lines adding the missing guard against in .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CRITICAL] Validator DoS via unguarded .index() in handle_pat_check — TOCTOU race crashes axon handler

1 participant