Skip to main content

Module memory_fence

Module memory_fence 

Source
Expand description

Session-scoped memory boundaries and key/content sanitization.

Structs§

SessionScopedMemory
A memory store that is scoped to a specific session. Prevents memory from one session leaking into another.

Constants§

MAX_CONTENT_BYTES
Maximum serialized memory content size (bytes).
MAX_KEY_CHARS
Maximum key length in Unicode scalar values (after sanitization).

Functions§

sanitize_content
Sanitize a memory content string: strip NULs and cap size at 1MB (byte length).
sanitize_key
Sanitize a string to prevent injection in memory keys: keep alnum, dash, underscore, dot.
validate_key
Validate that a memory key is safe for filesystem use.