Skip to main content

is_valid_daemon_id

Function is_valid_daemon_id 

Source
pub fn is_valid_daemon_id(id: &str) -> bool
Expand description

Validates a daemon ID to ensure it’s safe for use in file paths and IPC.

A valid daemon ID:

  • Is not empty
  • Does not contain path separators (/ or \)
  • Does not contain parent directory references (..)
  • Does not contain spaces
  • Is not . (current directory)
  • Contains only printable ASCII characters

This validation prevents path traversal attacks when daemon IDs are used to construct log file paths or other filesystem operations.