Policy Variables
Policy Variables reuse expression fragments across rules and policies.
For example, define package_registries as:
{registry.npmjs.org,files.pythonhosted.org,proxy.golang.org}Then reference it in a policy rule:
{
"ip": {
"connect": [
"all|%package_registries%|443"
]
}
}Inspect expansion in Preview. Authored content and history retain custom references; distributed content expands them, leaving runtime placeholders for each job.
Variable Scopes
| Scope | Where to manage it | Availability | Who can change it |
|---|---|---|---|
| System | Administration > Policy Variables | Every Team Server policy | Administrators |
| Policy | A policy’s Variables tab | Only that policy | Policy owners and Administrators |
| Runtime | Shown on a policy’s Variables tab | Supplied separately for every job | Runtime Sensor only |
Policy values override same-named system values case-insensitively. Original spelling is retained; prefer lowercase snake_case.
Runtime Variables
These names are reserved and cannot be defined as custom variables:
| Variable | Runtime value |
|---|---|
%workspace% | Job workspace directory |
%home% | Job user’s home directory, or <undefined> when the UID has no account entry |
%hostname% | Runtime Sensor host name |
%uid% | Numeric UID of the user that started the job |
%user% | Job user’s account name, or <undefined> when the UID has no account entry |
The Runtime Sensor binds these values at job start. See the Specification for failure behavior when a variable cannot be resolved.
Create a System Variable
- Open Administration > Policy Variables.
- Select New Variable.
- Enter a name and expression value.
- Review the preview, including every affected policy and any validation errors.
- Save the variable.
Changes that invalidate any saved policy are rejected.
Create or Override a Policy Variable
- Open Policies and select a policy you own.
- Open the Variables tab.
- Select New Variable, or view the system variables and choose Override.
- Enter the policy-specific value and review the preview.
- Save the change.
New policies and their variables save atomically; invalid variables prevent creation.
Deleting an override restores any inherited system value. Changes leaving unresolved references are rejected.
Names and Values
| Field | Requirement |
|---|---|
| Name | 1 to 128 ASCII letters, digits, or underscores; must start with a letter or underscore |
| Value | 1 to 8192 bytes and a valid policy-expression fragment |
A value can represent part of a component, a complete component, brace alternatives, or multiple pipe-delimited components:
/usr/bin/{curl,wget}
{/opt/cache,/var/cache/app}
all|allValues cannot reference other variables, including runtime variables.
The expanded shape must fit the operation: all|all supplies two components. Preview and validation check the expanded policy before saving.
Operational Guidance
- Use system variables for centrally maintained service addresses, tool paths, and organization-wide allowlists.
- Use policy variables for application-specific values or intentional overrides.
- Keep security-sensitive values narrow. A variable can broaden many rules and policies at once.
- Review every affected policy shown in the preview before changing a shared variable.
- Treat variable values as current configuration, not versioned policy content. Reverting a policy restores its authored content and resolves its references using the current system and policy variables.
- Do not store secrets in variables. Compiled policy content is distributed to Runtime Sensors.