Skip to main content
Changelog >

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.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:

VariablePriorityDescription
BYTEHIDE_SHIELD_TOKEN_PROJECTNAME๐Ÿ”ผ 1Token for a specific project (e.g. MYAPP)
BYTEHIDE_SHIELD_TOKEN๐Ÿ”ฝ 2Global fallback token
projectToken in JSON config๐Ÿ”ฝ 3JSON-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:

  1. BYTEHIDE_SHIELD_TOKEN_{PROJECTNAME}
  2. 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:

๐Ÿ‘‰ https://www.bytehide.com/docs