harden ember-server: grpc limits, scan cap, gossip port overflow - #133
Merged
Conversation
kacy
force-pushed
the
security/server-hardening
branch
from
February 14, 2026 22:51
dca1046 to
c87dad8
Compare
- suppress clippy result_large_err on validate_key/validate_value (tonic Status is the idiomatic error type, 176 bytes is acceptable) - cap SCAN count at 10,000 to prevent huge allocations - set explicit 4 MB max message size on grpc service - replace saturating_add with checked_add for gossip port calculation (prevents silent port collision on overflow)
kacy
force-pushed
the
security/server-hardening
branch
from
February 14, 2026 22:53
c87dad8 to
6e3bb67
Compare
kacy
added a commit
that referenced
this pull request
Feb 19, 2026
* cargo fmt: fix formatting drift from merged refactoring PRs * harden grpc and cluster inputs - suppress clippy result_large_err on validate_key/validate_value (tonic Status is the idiomatic error type, 176 bytes is acceptable) - cap SCAN count at 10,000 to prevent huge allocations - set explicit 4 MB max message size on grpc service - replace saturating_add with checked_add for gossip port calculation (prevents silent port collision on overflow)
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
security hardening for ember-server, addressing findings #4, #7, #9, #12 from the security audit.
result_large_err: added#[allow(clippy::result_large_err)]onvalidate_keyandvalidate_valuewith justification — tonic'sStatusis the idiomatic error typereq.countis now capped at 10,000 to prevent a client from requesting unbounded iterationsaturating_addwithchecked_addat both gossip port calculation sites — prevents silent port collision when offset overflows u16what was tested
cargo build --workspace --features protobuf,grpc,vector— cleancargo test -p ember-server --features protobuf,grpc,vector— 43/43 passcargo clippy --workspace --features protobuf,grpc,vector -- -D warnings— cleancargo fmt --all --check— cleandesign considerations
result_large_erris suppressed rather than fixed because boxingtonic::Statuswould add allocation overhead on every validation call for no practical benefit. the lint exists for types that are unexpectedly large; 176 bytes for an error type in a non-hot-path is fine.expect()in the constructor (startup) since an invalid port config is a fatal error, andchecked_add+ early return inspawn_gossip()since that runs after initialization.