Enterprise Security & Approval Gates¶
To ensure that AI agents and automated systems do not trigger unauthorized production releases, ChangeSharp implements strict security gates. This is particularly critical when using the MCP (Model Context Protocol) integration.
🛡️ Release Safety Philosophy¶
In an enterprise environment, the tool that calculates the version should not necessarily be the one that has the permission to push the final artifacts without human oversight.
ChangeSharp enforces this via two primary mechanisms:
1. Mandatory Dry-Run (--dry-run)¶
The perform_release tool in the MCP server and the release command in the CLI support a dry-run mode.
- Behavior: It performs all calculations (version derivation, fragment aggregation) but does not modify any files and does not push any tags.
- Output: It returns a machine-readable (JSON) and human-readable summary of what would happen.
- Enforcement: In high-security environments, the MCP server can be configured to only allow dry-runs, forcing the actual release to be performed by a human or a specialized CI runner.
2. Approval Enforcement (--require-approval)¶
When running in an automated environment, ChangeSharp can be set to require an explicit approval token or flag.
- MCP Integration: The
perform_releasetool will fail if an AI agent attempts to run it without thedryRun: trueparameter, unless an environment variableCHANGESHARP_ALLOW_UNSAFE_RELEASE=trueis explicitly set in the server configuration. - Human-in-the-loop: The recommended workflow is for the AI agent to propose a release via
dry-run, and then a human triggers the final pipeline step in the CI/CD UI (e.g., GitHub Actions environment approval).
3. Protected CI Environment with Required Reviewers (Recommended)¶
A workflow_dispatch trigger alone is not a real review — clicking "Run workflow" does not force anyone to look at what will be released. To make the human-in-the-loop gate meaningful on GitHub, use a protected environment with required reviewers, split into two jobs:
prepare— runs on every push tomainand on manual dispatch. It computes the release plan (next version + aggregated changelog segment) and surfaces it:- on push: as the run's job summary (always visible in Actions);
- on manual dispatch: as a commit comment with the full plan.
release— manual only (workflow_dispatch),environment: releasewith required reviewers, andneeds: prepare. The run pauses at the environment gate; a human reviews the plan comment and explicitly approves before release + NuGet push + tag + GitHub release happen.
GitHub setup (one time): Settings → Environments → New environment → release → Protection rules → Required reviewers (add yourself/team). A dispatch run with fragments then waits for your approval.
🧩 AI Agent Workflow with Gates¶
- Agent: "I've finished the feature. I'll prepare a release."
- Agent: Calls
perform_release(dryRun: true). - ChangeSharp: Returns: "Next version: 1.2.0. Changes: Added X, Fixed Y."
- Agent: "The release is ready. Please approve the release of version 1.2.0 in the CI pipeline."
- Human: Reviews the changelog and clicks "Approve" in GitHub/GitLab.
⚙️ Configuration¶
Security gates can be configured in changesharp.json:
{
"Security": {
"RequireApproval": true,
"AllowAgentRelease": false,
"DryRunByDefault": true
}
}
DryRunByDefault: If true,changesharp releasewithout--dry-rundefaults to dry-run (CLI only).RequireApproval/AllowAgentRelease: Gates the MCPperform_releasetool. IfRequireApprovalis true orAllowAgentReleaseis false, any non-dry-run release request is rejected unless the environment variableCHANGESHARP_ALLOW_UNSAFE_RELEASE=trueis set.
Note: the CLI
releasecommand does not readRequireApproval/AllowAgentRelease. It only honors the explicit--require-approvalflag (sameCHANGESHARP_ALLOW_UNSAFE_RELEASEenv var). To gate CLI releases via config, setDryRunByDefaultand rely on a human or CI runner to perform the final release.