Input validation utilities for security-critical data.
More...
#include <Security.hpp>
|
| static bool | isValidPlayerName (const std::string &name) |
| | Validate player name for security and format compliance.
|
| |
| static bool | isValidLobbyName (const std::string &name) |
| | Validate lobby name for security and format compliance.
|
| |
| static bool | isValidIPAddress (const std::string &ip) |
| | Validate server IP address format (basic check)
|
| |
| static bool | isValidPort (std::uint16_t port) |
| | Validate port number range.
|
| |
| static std::string | sanitize (const std::string &input, size_t maxLength=32) |
| | Sanitize string by removing dangerous characters.
|
| |
Input validation utilities for security-critical data.
Definition at line 20 of file Security.hpp.
◆ InputValidator() [1/3]
| utl::InputValidator::InputValidator |
( |
| ) |
|
|
delete |
◆ ~InputValidator()
| utl::InputValidator::~InputValidator |
( |
| ) |
|
|
delete |
◆ InputValidator() [2/3]
◆ InputValidator() [3/3]
◆ isValidIPAddress()
| static bool utl::InputValidator::isValidIPAddress |
( |
const std::string & | ip | ) |
|
|
inlinestaticnodiscard |
Validate server IP address format (basic check)
- Parameters
-
| ip | IP address string to validate |
- Returns
- True if plausible IPv4 format, false otherwise @security Prevents invalid IP configurations
Definition at line 74 of file Security.hpp.
◆ isValidLobbyName()
| static bool utl::InputValidator::isValidLobbyName |
( |
const std::string & | name | ) |
|
|
inlinestaticnodiscard |
Validate lobby name for security and format compliance.
- Parameters
-
| name | Lobby name to validate |
- Returns
- True if valid (alphanumeric + spaces + dash, max 32 chars), false otherwise @security Prevents injection attacks and buffer overflow
Definition at line 55 of file Security.hpp.
Referenced by srv::AsioServer::handleLobbyCreate().
◆ isValidPlayerName()
| static bool utl::InputValidator::isValidPlayerName |
( |
const std::string & | name | ) |
|
|
inlinestaticnodiscard |
Validate player name for security and format compliance.
- Parameters
-
| name | Player name to validate |
- Returns
- True if valid (alphanumeric + spaces, max 32 chars), false otherwise @security Prevents injection attacks and buffer overflow
Definition at line 36 of file Security.hpp.
Referenced by srv::AsioServer::handleConnect().
◆ isValidPort()
| static bool utl::InputValidator::isValidPort |
( |
std::uint16_t | port | ) |
|
|
inlinestaticnodiscard |
Validate port number range.
- Parameters
-
| port | Port number to validate |
- Returns
- True if port in valid range (1-65535), false otherwise @security Prevents invalid port configuration
Definition at line 91 of file Security.hpp.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ sanitize()
| static std::string utl::InputValidator::sanitize |
( |
const std::string & | input, |
|
|
size_t | maxLength = 32 ) |
|
inlinestaticnodiscard |
Sanitize string by removing dangerous characters.
- Parameters
-
| input | Input string to sanitize |
| maxLength | Maximum output length |
- Returns
- Sanitized string containing only safe characters @security Removes potential injection vectors
Definition at line 100 of file Security.hpp.
The documentation for this class was generated from the following file:
- /home/runner/work/R-Type/R-Type/modules/Utils/include/Utils/Security.hpp