Security Notes
Method Execution Safety
The MethodResolver enforces strict rules to prevent arbitrary code execution:
^[a-zA-Z][a-zA-Z0-9]\.[a-zA-Z][a-zA-Z0-9_]$rpc. are always rejected__ are never callablePath Traversal Prevention
Handler file paths are constructed deterministically:
user from user.create) is mapped to User.phpAuthentication
Authorization header, never from request paramsLogging
Secret Sanitization
The LogFormatter automatically redacts values for keys containing:
password, secret, token, api_key, apikeyauthorization, credit_card, creditcard, cvvaccess_token, refresh_token, private_keyNested values are also sanitized recursively.
Log Injection Prevention
Log messages are structured as single-line entries. Newline characters in messages are replaced with escaped literals (\n, \r). Context data is JSON-encoded, preventing log injection through crafted input.
Log Rotation Integrity
When compression is enabled, backup files only receive the .gz extension when gzip compression actually succeeds. If compression fails (e.g., due to runtime constraints), the backup is stored uncompressed without the .gz extension, preventing misleading file naming.
Rate Limiting
fail_open behavior: by default, requests are allowed on storage failure with a warning; set fail_open: false to deny on failure (fail-closed)E_USER_WARNING for monitoringCompression
Batch Request Abuse
-32600 Invalid Request error instead of being silently acceptedConfig Loading
Config::fromFile() throws RuntimeException on missing files or non-array returnsContent-Type Enforcement
content_type.strict: false), POST requests are accepted regardless of Content-Typecontent_type.strict: true to require application/json Content-Type on POST requests-32600 Invalid Request errorError Information Leakage
In production mode (debug: false):
Recommended Production Configuration
[
'debug' => false,
'limits' => [
'max_body_size' => 1048576, // 1MB max
'max_json_depth' => 32, // Reasonable depth
],
'batch' => [
'max_items' => 50, // Conservative limit
],
'logging' => [
'sanitize_secrets' => true,
],
'content_type' => [
'strict' => true, // Require application/json
],
'rate_limit' => [
'enabled' => true,
'max_requests' => 100,
'window_seconds' => 60,
'fail_open' => false, // Fail-closed in production
],
'auth' => [
'enabled' => true,
'jwt' => [
'secret' => '<strong-random-secret>',
'algorithm' => 'HS256',
],
],
]