Global Configuration & Environment Token Support for Shield
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.jsonThis 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.jsonProjects 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.csprojSecure 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=abc123export BYTEHIDE_SHIELD_TOKEN_PROJECTB=def456#or for allexport BYTEHIDE_SHIELD_TOKEN=def456If 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
Shield Global Configuration
Start using centralized configs and secure tokens today, flexible for monorepos, secure for CI/CD.
Start to use itNeed Help?
See the full documentation at:
