Skip to content

Make sure that blobs downloaded by the client are validated#4075

Closed
bart-linera wants to merge 2 commits intolinera-io:mainfrom
bart-linera:issue-2351
Closed

Make sure that blobs downloaded by the client are validated#4075
bart-linera wants to merge 2 commits intolinera-io:mainfrom
bart-linera:issue-2351

Conversation

@bart-linera
Copy link
Contributor

Motivation

#3787 left a potential security issue: when a client was downloading a missing ChainDescription blob, it would just download a blob, but wouldn't make sure that it was legitimately created on another chain.

Proposal

Whenever a ChainDescription is fetched, fetch the certificate for the block that created it and validate it against committees known from the admin chain.

Test Plan

CI should catch regressions.

Release Plan

  • Nothing to do / These changes follow the usual release cycle.

Links

Notes

The TODO in attempted_changes.rs has been removed after verifying that the safety issue is no longer present there: the committees are taken from a blob, but that blob can only exist on the validator if it has been legitimately created on another chain.

@bart-linera bart-linera requested review from Twey, afck, deuszx and ma2bd June 6, 2025 14:41
let Some(blob) = blob_certificate
.value()
.block()
.created_blobs()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this function doesn't assume it's a chain description blob, we shouldn't assume it's in created_blobs. Could just be a required blob.

.collect())
}

async fn fetch_blob(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this doing the same as update_local_node_with_blobs_from, but serially instead of in parallel?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed! 🤦‍♂️ Well, it also returns the blob, but it can just be read afterwards if needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, no, wait, there is a difference: update_local_node_with_blobs_from works for multiple blobs and a single validator, while fetch_blob works for a single blob and multiple validators. I guess ideally we'd just have a function for multiple blobs and multiple validators, but that's what the TODO is about, after all 😬

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'd prefer generalizing over duplicating. And we can make the other function return the blob, too?

@lerlar

This comment was marked as spam.

@afck
Copy link
Contributor

afck commented Jun 9, 2025

Closing in favor of #4082.

@afck afck closed this Jun 9, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jun 11, 2025
This is a completion of @bart-linera's #4075:

## Motivation

#3787 left a potential security issue: when a client was downloading a
missing `ChainDescription` blob, it would just download a blob, but
wouldn't make sure that it was legitimately created on another chain.

## Proposal

Whenever a `ChainDescription` is fetched, fetch the certificate for the
block that created it and validate it against committees known from the
admin chain.

## Test Plan

The only occurrences of `RemoteNode::download_blob[s]` are now after
`process_certificate` returned `BlobsNotFound`, i.e. after checking a
certificate's signatures.

CI should catch regressions.

## Release Plan

- Nothing to do / These changes follow the usual release cycle.

## Links

- Closes #2351 
- [reviewer
checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)

## Notes

The `TODO` in `attempted_changes.rs` has been removed after verifying
that the safety issue is no longer present there: the committees are
taken from a blob, but that blob can only exist on the validator if it
has been legitimately created on another chain.

---------

Co-authored-by: Bartłomiej Kamiński <bartlomiej.kaminski@linera.io>
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.

Don't set the committee before checking it in process_confirmed_block.

3 participants