JSON Configuration
Configure Monitor using local JSON configuration files. Ideal for version-controlled setups, offline environments, and CI/CD pipelines.
Overview
JSON configuration lets you define protections, logging, rate limiting, and other Monitor settings in a file that lives alongside your application code. This is useful for:
- Version control: Track configuration changes in git alongside your codebase
- Environment-specific configs: Different files per environment (dev, staging, production)
- Offline deployments: No dependency on the ByteHide Cloud API
- CI/CD pipelines: Automate configuration as part of your build and deploy process
Configuration Priority
When multiple configuration sources are present, they are applied in this priority order: Cloud Dashboard (highest) > JSON File > Code (Configuration API) (lowest). Cloud configuration overrides JSON settings. See Cloud Configuration for details.
Export from Cloud Dashboard
If you already have rules configured in the Cloud Dashboard, click Export config in the Workflow tab to download them as a JSON file. This gives you a ready-to-use configuration file that matches your current cloud setup.
Configuration Files
Monitor searches for configuration files in your project root directory, in this order:
monitor.config.jsonbytehide.monitor.jsonbytehide.monitor.config.jsonmonitor-config.jsonbytehide-monitor-config.json
The first file found is used. Place any one of these in your project root directory.
Basic Configuration
Desktop/Mobile Application
{
"name": "My Desktop App",
"enabled": true,
"projectToken": "${BYTEHIDE_TOKEN}",
"preset": "desktop",
"protections": {
"DebuggerDetection": { "enabled": true, "action": "close" },
"VirtualMachineDetection": { "enabled": true, "action": "log" }
}
}{
"name": "My Desktop App",
"enabled": true,
"projectToken": "${BYTEHIDE_TOKEN}",
"preset": "desktop",
"protections": {
"DebuggerDetection": { "enabled": true, "action": "close" },
"VirtualMachineDetection": { "enabled": true, "action": "log" }
}
}Web Application
{
"name": "My Web API",
"enabled": true,
"projectToken": "${BYTEHIDE_TOKEN}",
"preset": "cloud",
"protections": {
"SqlInjection": { "enabled": true, "action": "block" },
"CrossSiteScripting": { "enabled": true, "action": "block" },
"PathTraversal": { "enabled": true, "action": "block" }
}
}{
"name": "My Web API",
"enabled": true,
"projectToken": "${BYTEHIDE_TOKEN}",
"preset": "cloud",
"protections": {
"SqlInjection": { "enabled": true, "action": "block" },
"CrossSiteScripting": { "enabled": true, "action": "block" },
"PathTraversal": { "enabled": true, "action": "block" }
}
}Complete Schema Reference
Root Configuration
| Field | Type | Default | Description |
|---|---|---|---|
name | string | - | Configuration name/description |
enabled | boolean | true | Enable/disable monitoring |
projectToken | string | - | ByteHide project token (can use env vars) |
preset | string | - | "cloud", "desktop", "mobile", "videogame", "custom" |
debugResponses | boolean | false | Include threat details in responses (dev only) |
autoIntegration | boolean | true | Auto-register middleware (Android web frameworks only) |
throwOnConnectionFailure | boolean | false | Fail startup if backend unreachable |
logging | object | - | Logging configuration |
protections | object | - | Protection module configurations |
cloud | object | - | Cloud-specific settings (web apps only) |
Protection Configuration
Each protection can be configured individually:
{
"protections": {
"SqlInjection": {
"enabled": true,
"action": "block",
"customActionName": "my-action",
"intervalMs": 30000,
"config": {}
}
}
}{
"protections": {
"SqlInjection": {
"enabled": true,
"action": "block",
"customActionName": "my-action",
"intervalMs": 30000,
"config": {}
}
}
}| Field | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Enable this protection |
action | string | "block" | "none", "log", "block", "close", "erase", "custom" |
customActionName | string | - | Name of custom action (when action="custom") |
intervalMs | number | - | Check interval in ms (desktop/mobile only) |
config | object | - | Module-specific configuration |
Interval Configuration
intervalMs only applies to desktop/mobile protections (DebuggerDetection, VirtualMachineDetection, etc.). Web protections run per-request.
Available Presets
Presets enable a predefined group of protections. See Protection Modules for the full reference of all available modules.
"cloud" - Web Applications
Enables web-focused protections:
- SqlInjection
- CrossSiteScripting
- PathTraversal
- CommandInjection
- SSRF
- LdapInjection
- XxeInjection
- NoSqlInjection
- LlmPromptInjection
"desktop" - Desktop Applications
Enables desktop-focused protections:
- DebuggerDetection
- VirtualMachineDetection
- EmulatorDetection
- ClockTampering
- MemoryDumpDetection
- ProcessInjection
"mobile" - Mobile Applications
Enables mobile-focused protections:
- JailbreakDetection (iOS/Android root)
- DebuggerDetection
- EmulatorDetection
- ClockTampering
- MemoryDumpDetection
- HookingDetection
"videogame" - Game Applications
Enables game-focused protections:
- DebuggerDetection
- MemoryDumpDetection
- SpeedHackDetection
- CheatEngineDetection
"custom" - Manual Configuration
No default protections. Specify all protections manually.
Logging Configuration
{
"logging": {
"level": "warning",
"console": true,
"debug": false,
"file": {
"enabled": true,
"path": "logs/monitor.log",
"maxSizeMB": 10,
"maxFiles": 5
},
"bytehideLogs": {
"enabled": false,
"token": "${BYTEHIDE_LOGS_TOKEN}",
"persist": true,
"filePath": "logs/bytehide-logs-offline.json",
"maskSensitiveData": ["password", "token", "apiKey"]
}
}
}{
"logging": {
"level": "warning",
"console": true,
"debug": false,
"file": {
"enabled": true,
"path": "logs/monitor.log",
"maxSizeMB": 10,
"maxFiles": 5
},
"bytehideLogs": {
"enabled": false,
"token": "${BYTEHIDE_LOGS_TOKEN}",
"persist": true,
"filePath": "logs/bytehide-logs-offline.json",
"maskSensitiveData": ["password", "token", "apiKey"]
}
}
}Logging Fields
| Field | Type | Default | Description |
|---|---|---|---|
level | string | "info" | "trace", "debug", "info", "warning", "error" |
console | boolean | false | Enable console logging (stdout) |
debug | boolean | false | Enable debug output |
file | object | - | File logging configuration |
bytehideLogs | object | - | ByteHide Logs integration |
File Logging
| Field | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Enable file logging |
path | string | "logs/bytehide-monitor.log" | Log file path |
maxSizeMB | number | 10 | Max file size before rotation |
maxFiles | number | 5 | Number of backup files |
ByteHide Logs Integration
Requires the ByteHide Logger integration.
| Field | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Enable ByteHide Logs |
token | string | - | ByteHide Logs API token |
persist | boolean | true | Persist logs locally when offline |
filePath | string | - | Offline persistence path |
maskSensitiveData | array | - | Patterns to mask (e.g., ["password"]) |
Cloud Configuration (Web Applications)
Advanced settings for web/API applications:
{
"cloud": {
"rateLimit": {
"enabled": true,
"maxRequests": 100,
"windowSizeInMS": 60000
},
"anomalyDetection": {
"enabled": true,
"detectIpChanges": true,
"detectUserAgentChanges": true,
"detectSuspiciousPatterns": true
},
"endpoints": [
{
"method": "POST",
"route": "/api/admin/*",
"protections": {
"SqlInjection": { "enabled": true, "action": "block" }
}
},
{
"method": "*",
"route": "/health",
"forceProtectionOff": true
}
]
}
}{
"cloud": {
"rateLimit": {
"enabled": true,
"maxRequests": 100,
"windowSizeInMS": 60000
},
"anomalyDetection": {
"enabled": true,
"detectIpChanges": true,
"detectUserAgentChanges": true,
"detectSuspiciousPatterns": true
},
"endpoints": [
{
"method": "POST",
"route": "/api/admin/*",
"protections": {
"SqlInjection": { "enabled": true, "action": "block" }
}
},
{
"method": "*",
"route": "/health",
"forceProtectionOff": true
}
]
}
}Rate Limiting
| Field | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Enable rate limiting |
maxRequests | number | 100 | Max requests per window |
windowSizeInMS | number | 60000 | Time window in milliseconds |
Anomaly Detection
| Field | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Enable anomaly detection |
detectIpChanges | boolean | true | Detect IP address changes |
detectUserAgentChanges | boolean | true | Detect User-Agent changes |
detectSuspiciousPatterns | boolean | true | Detect suspicious patterns |
Endpoint-Specific Configuration
Override protections for specific routes:
| Field | Type | Description |
|---|---|---|
method | string | "GET", "POST", "PUT", "DELETE", "*" (all) |
route | string | Route pattern (e.g., "/api/users/{id}", "/admin/*") |
forceProtectionOff | boolean | Disable ALL protections for this endpoint |
protections | object | Endpoint-specific protection overrides |
rateLimit | object | Endpoint-specific rate limit |
Environment Variables
You can reference environment variables in any string value using ${VARIABLE_NAME} syntax:
{
"projectToken": "${BYTEHIDE_TOKEN}",
"logging": {
"bytehideLogs": {
"token": "${BYTEHIDE_LOGS_TOKEN}"
}
}
}{
"projectToken": "${BYTEHIDE_TOKEN}",
"logging": {
"bytehideLogs": {
"token": "${BYTEHIDE_LOGS_TOKEN}"
}
}
}This avoids hardcoding sensitive values in configuration files.
Token Resolution Order
The project token is resolved in this order:
BYTEHIDE_MONITOR_TOKENenvironment variableBYTEHIDE_TOKENenvironment variableprojectTokenvalue in the JSON file
Complete Example
Desktop application with comprehensive configuration:
{
"name": "My Production App",
"enabled": true,
"projectToken": "${BYTEHIDE_TOKEN}",
"preset": "desktop",
"debugResponses": false,
"throwOnConnectionFailure": false,
"logging": {
"level": "warning",
"console": false,
"file": {
"enabled": true,
"path": "logs/monitor.log",
"maxSizeMB": 50,
"maxFiles": 10
}
},
"protections": {
"DebuggerDetection": {
"enabled": true,
"action": "close"
},
"VirtualMachineDetection": {
"enabled": true,
"action": "log"
},
"ClockTampering": {
"enabled": true,
"action": "close"
},
"MemoryDumpDetection": {
"enabled": true,
"action": "erase"
},
"ProcessInjection": {
"enabled": true,
"action": "close"
}
}
}{
"name": "My Production App",
"enabled": true,
"projectToken": "${BYTEHIDE_TOKEN}",
"preset": "desktop",
"debugResponses": false,
"throwOnConnectionFailure": false,
"logging": {
"level": "warning",
"console": false,
"file": {
"enabled": true,
"path": "logs/monitor.log",
"maxSizeMB": 50,
"maxFiles": 10
}
},
"protections": {
"DebuggerDetection": {
"enabled": true,
"action": "close"
},
"VirtualMachineDetection": {
"enabled": true,
"action": "log"
},
"ClockTampering": {
"enabled": true,
"action": "close"
},
"MemoryDumpDetection": {
"enabled": true,
"action": "erase"
},
"ProcessInjection": {
"enabled": true,
"action": "close"
}
}
}Web application with cloud features:
{
"name": "My Web API",
"enabled": true,
"projectToken": "${BYTEHIDE_TOKEN}",
"preset": "cloud",
"autoIntegration": true,
"debugResponses": false,
"logging": {
"level": "info",
"console": true,
"bytehideLogs": {
"enabled": true,
"token": "${BYTEHIDE_LOGS_TOKEN}",
"persist": true,
"maskSensitiveData": ["password", "token", "apiKey", "secret"]
}
},
"protections": {
"SqlInjection": { "enabled": true, "action": "block" },
"CrossSiteScripting": { "enabled": true, "action": "block" },
"PathTraversal": { "enabled": true, "action": "block" },
"CommandInjection": { "enabled": true, "action": "block" },
"SSRF": { "enabled": true, "action": "block" },
"LlmPromptInjection": { "enabled": true, "action": "log" }
},
"cloud": {
"rateLimit": {
"enabled": true,
"maxRequests": 1000,
"windowSizeInMS": 60000
},
"anomalyDetection": {
"enabled": true,
"detectIpChanges": true,
"detectUserAgentChanges": true,
"detectSuspiciousPatterns": true
},
"endpoints": [
{
"method": "*",
"route": "/health",
"forceProtectionOff": true
},
{
"method": "POST",
"route": "/api/admin/*",
"rateLimit": {
"enabled": true,
"maxRequests": 10,
"windowSizeInMS": 60000
}
},
{
"method": "POST",
"route": "/api/public/search",
"protections": {
"SqlInjection": { "enabled": true, "action": "block" },
"NoSqlInjection": { "enabled": true, "action": "block" }
}
}
]
}
}{
"name": "My Web API",
"enabled": true,
"projectToken": "${BYTEHIDE_TOKEN}",
"preset": "cloud",
"autoIntegration": true,
"debugResponses": false,
"logging": {
"level": "info",
"console": true,
"bytehideLogs": {
"enabled": true,
"token": "${BYTEHIDE_LOGS_TOKEN}",
"persist": true,
"maskSensitiveData": ["password", "token", "apiKey", "secret"]
}
},
"protections": {
"SqlInjection": { "enabled": true, "action": "block" },
"CrossSiteScripting": { "enabled": true, "action": "block" },
"PathTraversal": { "enabled": true, "action": "block" },
"CommandInjection": { "enabled": true, "action": "block" },
"SSRF": { "enabled": true, "action": "block" },
"LlmPromptInjection": { "enabled": true, "action": "log" }
},
"cloud": {
"rateLimit": {
"enabled": true,
"maxRequests": 1000,
"windowSizeInMS": 60000
},
"anomalyDetection": {
"enabled": true,
"detectIpChanges": true,
"detectUserAgentChanges": true,
"detectSuspiciousPatterns": true
},
"endpoints": [
{
"method": "*",
"route": "/health",
"forceProtectionOff": true
},
{
"method": "POST",
"route": "/api/admin/*",
"rateLimit": {
"enabled": true,
"maxRequests": 10,
"windowSizeInMS": 60000
}
},
{
"method": "POST",
"route": "/api/public/search",
"protections": {
"SqlInjection": { "enabled": true, "action": "block" },
"NoSqlInjection": { "enabled": true, "action": "block" }
}
}
]
}
}Advanced Interval Configuration
For desktop/mobile protections, you can specify check intervals:
{
"protections": {
"DebuggerDetection": {
"enabled": true,
"action": "close",
"intervalMs": 30000
},
"VirtualMachineDetection": {
"enabled": true,
"action": "log",
"intervalMs": 120000
},
"ClockTampering": {
"enabled": true,
"action": "close",
"intervalMs": 300000
}
}
}{
"protections": {
"DebuggerDetection": {
"enabled": true,
"action": "close",
"intervalMs": 30000
},
"VirtualMachineDetection": {
"enabled": true,
"action": "log",
"intervalMs": 120000
},
"ClockTampering": {
"enabled": true,
"action": "close",
"intervalMs": 300000
}
}
}Recommended intervals:
- DebuggerDetection: 30000ms (30 seconds)
- VirtualMachineDetection: 120000ms (2 minutes, runs once typically)
- ClockTampering: 300000ms (5 minutes)
- MemoryDumpDetection: 60000ms (1 minute)
- JailbreakDetection: 120000ms (2 minutes, runs once typically)
Performance Impact
Lower intervals mean more frequent checks but higher CPU usage. Balance security needs with performance requirements.
Next Steps
Cloud Configuration
Configure protections from the web dashboard with real-time sync
Configuration API
Code-based configuration for custom actions and programmatic control
Protection Modules
Complete reference of all available protection modules
Actions
All action types and when to use each one