Only allow HTTP requests authorized by the committee#3427
Merged
jvff merged 6 commits intolinera-io:mainfrom Mar 9, 2025
Merged
Only allow HTTP requests authorized by the committee#3427jvff merged 6 commits intolinera-io:mainfrom
jvff merged 6 commits intolinera-io:mainfrom
Conversation
deuszx
reviewed
Feb 27, 2025
deuszx
reviewed
Feb 27, 2025
|
|
||
| let response = Client::new() | ||
| .request(request.method.into(), request.url) | ||
| .request(request.method.into(), url) |
Contributor
There was a problem hiding this comment.
Should we whitelist also methods?
Contributor
Author
There was a problem hiding this comment.
I don't think that's needed. We could make the allow list more complicated, mapping hosts to a set of allowed methods, but where do we draw the line? We could also limit headers, ports, etc. Right now I'm assuming that the allowed HTTP servers will be safe to communicated with.
jvff
added a commit
that referenced
this pull request
Mar 8, 2025
## Motivation In integration tests, the `ResourceControlPolicy` was hardcoded to use the default value. With the addition of an HTTP allow list (#3427), the tests aren't able to test any HTTP requests. ## Proposal Allow changing the `ResourceControlPolicy` used inside a test, allowing to add hosts to the allow list. For the policy change to work, a new committee and epoch must be published. Therefore the epoch and committee can't be assumed to be constant anymore. ## Test Plan Wrote some (upcoming) tests that try to perform an HTTP request without changing the policy and after adding the host to the policy, and ensured that the former fails while the latter succeeds. ## Release Plan - These changes follow the usual release cycle, because this will help with tests that use a feature that has not yet been released. ## Links - [reviewer checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
1438770 to
509c313
Compare
ma2bd
approved these changes
Mar 8, 2025
Allow configuring the HTTP allow list for genesis.
Store on chain the HTTP allow list.
Fail if an attempt is made to perform an HTTP request to a host that's not in the `ResourceControlPolicy`.
Ensure that end-to-end tests using local networks can perform HTTP queries to `localhost`.
Move it from the `linera_net_tests` to the `local_net_tests`, so that it is allowed to perform HTTP requests.
Use the new size of the valid block.
509c313 to
397dc90
Compare
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.
Motivation
For security reasons, we would like to initially limit the hosts that applications can send HTTP requests to.
Proposal
Add an allow-list of hosts to the
ResourceControlPolicyconfigured by a committee. Only perform HTTP requests in the execution state actor if the target host is in the list.Test Plan
Tests that exercise the allow list were added in PR #3509.
Release Plan
Links