You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix: Add input validation to prevent memory exhaustion (#147)
* Add input validation to prevent memory exhaustion (Issue #82)
* fix: coordinated eviction from both caches and update test to trigger eviction
* feat: make validation limits configurable via ValidationLimits struct
* remove unnecessary deprecated constant aliases
* refactor: move cache_size into ValidationLimits
* fix: add zero-value validation to all ValidationLimits builder methods
Copy file name to clipboardExpand all lines: crates/mdk-memory-storage/CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,8 @@
40
40
41
41
- Implemented pagination support using `Pagination` struct for group messages ([#111](https://github.com/marmot-protocol/mdk/pull/111))
42
42
- Implemented pagination support using `Pagination` struct for pending welcomes ([#110](https://github.com/marmot-protocol/mdk/pull/110))
43
+
-**Security (Audit Issue AM)**: Added input validation constants and enforcement to prevent memory exhaustion attacks. New public constants: `DEFAULT_MAX_RELAYS_PER_GROUP`, `DEFAULT_MAX_MESSAGES_PER_GROUP`, `DEFAULT_MAX_GROUP_NAME_LENGTH`, `DEFAULT_MAX_GROUP_DESCRIPTION_LENGTH`, `DEFAULT_MAX_ADMINS_PER_GROUP`, `DEFAULT_MAX_RELAYS_PER_WELCOME`, `DEFAULT_MAX_ADMINS_PER_WELCOME`, `DEFAULT_MAX_RELAY_URL_LENGTH`. Fixes [#82](https://github.com/marmot-protocol/mdk/issues/82) ([#147](https://github.com/marmot-protocol/mdk/pull/147))
44
+
- Added `ValidationLimits` struct for configurable validation limits, allowing users to override default memory exhaustion protection limits via `MdkMemoryStorage::with_limits()` ([#147](https://github.com/marmot-protocol/mdk/pull/147))
43
45
44
46
### Fixed
45
47
@@ -52,7 +54,9 @@
52
54
-**Security (Audit Issue AA)**: Added pagination to prevent memory exhaustion from unbounded loading of pending welcomes ([#110](https://github.com/marmot-protocol/mdk/pull/110))
53
55
-**Security (Audit Issue AN)**: Fixed security issue where `save_message` would accept messages for non-existent groups, allowing cache pollution. Now verifies group existence before inserting messages into the cache. ([#113](https://github.com/marmot-protocol/mdk/pull/113))
54
56
-**Security (Audit Issue AO)**: Removed MLS group identifiers from error messages to prevent metadata leakage in logs and telemetry. Error messages now use generic "Group not found" instead of including the sensitive 32-byte MLS group ID. ([#112](https://github.com/marmot-protocol/mdk/pull/112))
57
+
-**Security (Audit Issue AM)**: Added input validation to prevent memory exhaustion from unbounded per-key values in LRU caches. Validation is enforced in `save_group`, `replace_group_relays`, `save_message`, and `save_welcome` to cap string lengths, collection sizes, and per-group message counts. Fixes [#82](https://github.com/marmot-protocol/mdk/issues/82) ([#147](https://github.com/marmot-protocol/mdk/pull/147))
55
58
- Fix `admins()` to return `InvalidParameters` error when group not found, instead of incorrectly returning `NoAdmins` ([#104](https://github.com/marmot-protocol/mdk/pull/104))
0 commit comments