Overview
The panic mode endpoint allows administrators to immediately suspend or restore the gitGost service. When activated, all push attempts are rejected with an explanatory message. This feature is designed to mitigate bot submissions, coordinated spam, or other abusive activity.Endpoint
Authentication
The endpoint accepts two forms of authentication:- Static password - The
PANIC_PASSWORDenvironment variable configured during deployment - Single-use action token - Time-limited tokens (10 minutes TTL) generated for ntfy alert action buttons
Request Body
Admin password for panic mode control. Must match the
PANIC_PASSWORD environment variable.Single-use action token generated by the system. Expires after 10 minutes.
true- Activate panic mode (suspend service)false- Deactivate panic mode (restore service)
You must provide either
password or token, but not both.Response
Current state of panic mode after the request.
Human-readable status:
"activated" or "deactivated".Behavior When Active
When panic mode is activated:- All push requests to
/v1/gh/:owner/:repo/git-receive-packare immediately rejected - Users receive a Git protocol error message:
- The service status endpoint (
/api/status) returns{"panic_mode": true} - The deployment badge shows “suspended” in red
Rate Limiting
The admin endpoints enforce strict rate limiting:- 10 requests per minute per IP
- Exceeding this limit returns
429 Too Many Requests
Examples
Shell Aliases
For convenience, add these aliases to your~/.zshrc or ~/.bashrc:
ntfy Integration
When abusive activity is detected, the system sends alerts to the configured ntfy admin topic with action buttons:- Activate Panic - Immediately suspend the service
- Close Burst PRs - Close all PRs created during the attack window
- Deactivate Panic - Restore normal operation
Implementation Details
Fromhandlers.go:789-815:
Related Endpoints
- Rollback Burst - Close PRs created during an attack
- Health Check - Check current panic mode state