A credential-injecting TLS-intercepting proxy. Route HTTPS traffic through Gatekeeper and it transparently injects authentication headers based on hostname matching. Clients never see raw credentials.
# Start the proxy
gatekeeper --config gatekeeper.yaml
# In another terminal — credential injected automatically
curl --proxy http://127.0.0.1:9080 --cacert ca.crt https://api.github.com/userNo GITHUB_TOKEN in the command. No secrets in environment variables. The token is resolved from the configured source and injected at the network layer.
go install github.com/majorcontext/gatekeeper/cmd/gatekeeper@latestRequires: Go 1.25+
- Client sends
CONNECT host:443through the proxy - Proxy terminates TLS using a dynamically-generated certificate for that host
- Proxy reads the plaintext request, injects the matching credential as an HTTP header
- Request is forwarded to the real server over a separate TLS connection
- Response streams back to the client
The proxy needs a CA certificate to sign per-host certificates. Generate one with the included script:
cd examples && ./gen-ca.shproxy:
host: 127.0.0.1
port: 9080
tls:
ca_cert: ca.crt
ca_key: ca.key
credentials:
- host: api.github.com
header: Authorization
grant: github
source:
type: env
var: GITHUB_TOKEN
network:
policy: permissive
log:
level: info
format: textsource:
type: env
var: GITHUB_TOKENsource:
type: static
value: "Bearer sk-..."source:
type: aws-secretsmanager
secret: prod/api-key
region: us-east-1Generates short-lived installation tokens from a GitHub App private key. Tokens refresh automatically in the background at 75% of TTL.
source:
type: github-app
app_id: "12345"
installation_id: "67890"
private_key_path: ./key.pem # or use private_key_envSee examples/gatekeeper-github-app.yaml for a complete example.
Control which hosts the proxy will forward traffic to:
network:
policy: strict # deny all except explicitly allowed
allow:
- "api.github.com"
- "*.anthropic.com"Policies: permissive (allow all), strict (deny all, allow listed).
Gatekeeper supports OpenTelemetry for traces, metrics, and logs. No YAML configuration needed — use standard OTEL_* environment variables:
export OTEL_EXPORTER_OTLP_ENDPOINT=https://your-collector:4318
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer <token>"
gatekeeper --config gatekeeper.yamlGatekeeper is a Go module. Import the proxy engine directly for custom integrations:
import (
"github.com/majorcontext/gatekeeper/proxy"
)
ca, _ := proxy.LoadCA(certPEM, keyPEM)
p := proxy.NewProxy()
p.SetCA(ca)
p.SetCredentialWithGrant("api.github.com", "Authorization", "Bearer xxx", "github")Moat uses Gatekeeper this way — importing the proxy and adding per-run credential scoping via a daemon layer.
go build ./... # build
go test -race ./... # test
go vet ./... # lintMIT — see LICENSE.