Skip to content

Gatekeeper

Feature flags for PowerShell projects.

PowerShell Gallery PowerShell Gallery Version GitHub Workflow Status PowerShell Gallery

Gatekeeper lets you control feature rollouts using JSON-based feature flags with a rule engine. Define properties, write rules, and evaluate them against device context -- all in PowerShell.

Read the full documentation

Install

Install-Module Gatekeeper

Works on Windows, Linux, and macOS with PowerShell 5.1+.

Quick example

# Define what properties matter to your org
$props = New-PropertySet -Name 'MyProps' -Properties @(
    (New-Property -Name 'Environment' -Type string -EnumValues @('Production', 'Staging', 'Dev'))
    (New-Property -Name 'IsCompliant' -Type boolean)
)

# Create a rule: allow only compliant staging devices
$conditions = New-ConditionGroup -Operator AllOf -Conditions @(
    (New-Condition -Property 'Environment' -Operator Equals -Value 'Staging')
    (New-Condition -Property 'IsCompliant' -Operator Equals -Value 'true')
)
$rule = New-Rule -Name 'Compliant Staging' -Effect Allow -Conditions $conditions

# Create the flag (deny by default)
$flag = New-FeatureFlag -Name 'NewDashboard' -DefaultEffect Deny -Rules $rule

# Evaluate against a device's context
$context = @{ Environment = 'Staging'; IsCompliant = $true }
Test-FeatureFlag -FeatureFlag $flag -PropertySet $props -Context $context
# Returns: True

Why Gatekeeper?

  • JSON-native -- flags are JSON files validated by JSON Schema
  • Pluggable context -- you define properties and context; Gatekeeper doesn't assume your environment
  • Safe by default -- returns $false unless an explicit Allow rule matches
  • No external runtime dependencies -- just PowerShell and a JSON file
  • Cross-platform -- Windows, Linux, macOS

Security

Logging Script values in your Configuration.psd1 are executed as code with the caller's full privileges -- a Script string is either inline PowerShell that gets compiled and run, or a path to a local .ps1 file that gets loaded and run (UNC / remote paths are rejected). Keep your configuration files (and any referenced .ps1 scripts) writable only by trusted users. See Logging for details.

Documentation

Topic Description
Getting Started Install and evaluate your first flag
Concepts Data model, terminology, and how evaluation works
Creating Flags Build properties, conditions, rules, and flags
Configuration Multi-level configuration system
Logging Audit and warning script setup
Command Reference All exported cmdlets

Contributing

See the CHANGELOG for version history.