fix(sophia): fail closed on ticket-less block submission under ENFORCE (#14588)#7828
Open
Vyacheslav-Tomashevskiy wants to merge 1 commit into
Open
Conversation
…E (#14588)
The Silicon Ticket guard in api_submit_block() short-circuited on a falsey
ticket_id:
if ENFORCE and ticket_id and ticket_id not in tickets_db:
A miner could omit ticket_id (or send an empty string) and skip the
tickets_db membership check entirely, submitting blocks without a valid
ticket even in ENFORCE mode. Guard now fails closed:
if ENFORCE and (not ticket_id or ticket_id not in tickets_db):
Behaviour with ENFORCE off is unchanged. Adds a regression test covering
missing, empty, and unknown ticket_id under enforcement.
Contributor
|
Welcome to RustChain! Thanks for your first pull request. Before we review, please make sure:
Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150) A maintainer will review your PR soon. Thanks for contributing! |
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
Fixes the ticket-less block-submission bypass reported in Scottcjn/rustchain-bounties#14588 (High).
api_submit_block()innode/sophia_elya_service.pyguarded the Silicon Ticket check with:Because
ticket_idis falsey when the field is omitted (None) or empty (""), theand ticket_id andclause short-circuits and thetickets_dbmembership check never runs. A miner could POST a block withheader_extcarrying noticket(or{"ticket": {"ticket_id": ""}}) and pass straight through even withENFORCEenabled, defeating the ticket-based access control.Fix
Fail closed — reject when the ticket is missing/empty or unknown, only under enforcement:
Behaviour with
ENFORCEoff is unchanged, so normal operation is unaffected.Tests
Added
test_elya_submit_block_rejects_missing_ticket_when_enforcedcovering all three bypass vectors underENFORCE=True: missing ticket, emptyticket_id, and unknownticket_id. Verified it fails on the pre-fix code (the ticket-less request slips past the gate into epoch accounting) and passes after the fix (clean400 invalid_ticket).Two files changed, +42/-1, no dependency or workflow changes.
Closes Scottcjn/rustchain-bounties#14588
/claim #14588
RTC payout address:
RTCd1554f0f35576faf01d386a6be1c947f560dd0b7