What’s New
ByteHide Shield now supports a global configuration file and environment-based project tokens, allowing for centralized control and secure token management.
Configuration Options
You can now choose between two configuration strategies:
1. Per-project configuration (classic)
Each project contains its own configuration file:
/ProjectA/bytehide.shield.json
/ProjectB/bytehide.shield.json
This method remains fully supported and takes priority if present.
2. Global configuration (new)
A single file at the solution root handles multiple projects:
/MySolution/bytehide.shield.global.json
Projects are identified by name or .csproj
path.
โ๏ธ There is no “better” option โ use what fits your workflow:
- Use per-project configs when teams manage projects independently.
- Use a global config when centralizing protection rules or toggling apps on/off in one place.
Recommended Project Structure
/MySolution
โโโ bytehide.shield.global.json <-- global configuration
โโโ ProjectA/
โ โโโ ProjectA.csproj
โโโ ProjectB/
โ โโโ ProjectB.csproj
Secure Token Management with Environment Variables
Project tokens can now be loaded from environment variables โ avoiding hardcoding secrets in your .json
configs.
Supported variables:
Variable | Priority | Description |
---|---|---|
BYTEHIDE_SHIELD_TOKEN_PROJECTNAME | ๐ผ 1 | Token for a specific project (e.g. MYAPP ) |
BYTEHIDE_SHIELD_TOKEN | ๐ฝ 2 | Global fallback token |
projectToken in JSON config | ๐ฝ 3 | JSON-defined token (used only if no env var) |
Example:
export BYTEHIDE_SHIELD_TOKEN_PROJECTA=abc123
export BYTEHIDE_SHIELD_TOKEN_PROJECTB=def456
#or for all
export BYTEHIDE_SHIELD_TOKEN=def456
If no projectToken
is defined in config, Shield will attempt to load:
BYTEHIDE_SHIELD_TOKEN_{PROJECTNAME}
BYTEHIDE_SHIELD_TOKEN
If none are found, the build will fail with an informative error.
Global Config Example (bytehide.shield.global.json
)
{
"globalOptions": {
"enabled": true,
"throwOnError": true,
"copyMagicKey": false
},
"projects": [
{
"name": "ProjectA",
"path": "src/ProjectA/ProjectA.csproj",
"preset": "optimized",
"protections": {
"control-flow": {},
"anti-debug": {}
}
},
{
"name": "ProjectB",
"enabled": false
}
]
}
"path"
is used to identify the project"name"
IS NOT used to identify the project, itโs only an internal name to identify the configuration applied (for your information)- Any setting not defined per project inherits from
globalOptions
- If both local and global configs are found, the local config takes precedence
Need Help?
See the full documentation at: