Commit df1b020
authored
Fix/ghost list security update (#96)
* Enhance `GhostList` with security documentation and customizable hashers
- Added a security section to the module documentation, highlighting the risks of using the default non-cryptographic hasher and providing guidance for handling untrusted input.
- Implemented a customizable hasher in `GhostList`, allowing users to specify a DoS-resistant hasher for better security.
- Updated the `new` method to clamp capacity to prevent oversized allocations, enhancing robustness against potential DoS attacks.
- Improved the `Debug` implementation to prevent exposure of sensitive data in debug output.
These changes improve the security and usability of the `GhostList`, ensuring safer handling of cache keys and memory management.
* Enhance `GhostList` with improved `Debug` implementation and capacity documentation
- Updated the `Debug` implementation to prevent exposure of sensitive keys, ensuring that only structural metadata is printed.
- Enhanced documentation for `MAX_CAPACITY`, detailing the calculation based on key size and platform constraints to prevent oversized allocations.
- Added tests to verify that the `Debug` output does not leak sensitive information and that `MAX_CAPACITY` respects the byte budget.
These changes improve the security and clarity of the `GhostList`, reinforcing safe handling of cache keys and memory management.
* Refactor `GhostList` capacity handling and enhance documentation
- Simplified the `try_new` method to delegate to `try_with_capacity_and_hasher`, improving code clarity.
- Updated documentation for `try_new` and `try_with_capacity_and_hasher` to clarify behavior when requested capacity exceeds `MAX_CAPACITY`.
- Introduced `BYTES_PER_ENTRY` constant in `IntrusiveList` to provide an exact compile-time footprint for memory budgeting, aiding in capacity management.
These changes enhance the usability and clarity of the `GhostList` and `IntrusiveList`, ensuring better handling of capacity constraints and memory estimation.
* Enhance `GhostList` tests with memory allocation considerations
- Added tests to verify behavior at `MAX_CAPACITY`, including clamping for oversized requests and ensuring successful allocations below the maximum.
- Marked tests that allocate significant memory (up to 16 GiB) as ignored to prevent failures on machines with limited resources.
- Improved documentation within tests to clarify the memory implications and usage instructions for running ignored tests.
These changes enhance the robustness of the `GhostList` testing suite, ensuring better handling of edge cases related to capacity and memory management.1 parent 5ff949c commit df1b020
2 files changed
Lines changed: 600 additions & 30 deletions
0 commit comments