Skip to content

feat(weight): add fallible constructors and enhance security document…#108

Merged
TKorr merged 1 commit into
mainfrom
fix/weight-security-updates
Apr 24, 2026
Merged

feat(weight): add fallible constructors and enhance security document…#108
TKorr merged 1 commit into
mainfrom
fix/weight-security-updates

Conversation

@TKorr

@TKorr TKorr commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

…ation

  • Introduced try_with_capacity and try_with_capacity methods for WeightStore and ConcurrentWeightStore, allowing for non-panicking allocation when capacity is derived from untrusted input.
  • Added a comprehensive section on security considerations in the module documentation, addressing risks related to hashers, capacity management, and handling sensitive values.
  • Updated the clear method to attribute removed entries to the removes metric, ensuring accurate tracking of bulk operations alongside per-entry removals.
  • Improved documentation for existing constructors to clarify panic behavior on allocator failure.

These changes enhance the robustness and security of the weight store implementations, aligning with best practices for handling untrusted input and sensitive data.

Description

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📝 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test addition or modification

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Manual testing

Test environment:

  • OS:
  • Rust version:

Checklist

  • My code follows the project's coding standards
  • I have run cargo fmt and cargo clippy
  • I have added tests for my changes
  • All new and existing tests pass (cargo test)
  • I have updated the documentation as needed
  • I have added an entry to CHANGELOG.md (if applicable)

Screenshots (if applicable)

Additional Notes

…ation

- Introduced `try_with_capacity` and `try_with_capacity` methods for `WeightStore` and `ConcurrentWeightStore`, allowing for non-panicking allocation when capacity is derived from untrusted input.
- Added a comprehensive section on security considerations in the module documentation, addressing risks related to hashers, capacity management, and handling sensitive values.
- Updated the `clear` method to attribute removed entries to the `removes` metric, ensuring accurate tracking of bulk operations alongside per-entry removals.
- Improved documentation for existing constructors to clarify panic behavior on allocator failure.

These changes enhance the robustness and security of the weight store implementations, aligning with best practices for handling untrusted input and sensitive data.
@TKorr TKorr merged commit 289bcf0 into main Apr 24, 2026
17 checks passed
@TKorr TKorr deleted the fix/weight-security-updates branch April 24, 2026 21:32
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.

1 participant