-
Notifications
You must be signed in to change notification settings - Fork 338
Fix: Code vulnerabilities and unsafe practices #350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…QueryStateMachine
…in LastMinuteLatency
…ess and secret keys
IDK why the e2e-test is failing, locally all the tests have passed. May be some kind of initialization issues in the CI/CD workflow. Please check on that and let me know. |
It looks like the unit test failed.
|
Yess...i've been diving deep into the issue...i'm fixing them up |
Thank you for your contribution! |
Type of Change
Related Issues
Summary of Changes
This pull request introduces a series of safety and validation improvements across several modules, focusing on robust error handling for integer overflows, resource exhaustion, and port validation. The changes are grouped into three main themes: erasure coding arithmetic safety, time/resource exhaustion protection, and port validation in service management.
Arithmetic Safety and Error Handling in Erasure Coding:
checked_add
,checked_sub
,checked_mul
) and error propagation inErasure
andShardReader
implementations to prevent integer overflows during size calculations, block offsets, and data writes. All critical arithmetic operations now return explicit errors or safe defaults on overflow, improving reliability and maintainability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]Protection Against Resource Exhaustion and Unbounded Loops:
LastMinuteLatency
to prevent resource exhaustion and unbounded loops, including a new safe version ofget_total
that returns errors if time jumps are excessive.LastMinuteHistogram
does not exceed bounds by clamping the tag index.Port Validation and Error Messaging in Service Management:
ServiceManager
to include explicit range checks, reserved port warnings, and unified parsing/validation logic. Service start and restart methods now validate ports before proceeding, with improved error messaging. [1] [2] [3] [4]Refactoring for Code Safety
Replaced unsafe
AtomicPtr
usage with the saferArc<RwLock>
primitive for concurrent state management in both theQueryStateMachine
and themetadata Cache
. This improves memory safety and reduces the risk of race conditions.These changes collectively enhance the system's robustness against common runtime errors and improve operational safety.
Checklist
cargo fmt --all
cargo clippy --all-targets --all-features -- -D warnings
cargo check --all-targets
Impact
Additional Notes
Thank you for your contribution! Please ensure your PR follows the community standards (CODE_OF_CONDUCT.md) and sign the CLA if this is your first contribution.