PromptGate 0.8 — changelog
Archived from CHANGELOG.md, which keeps the unreleased changes and, until the next release, the latest one.
[0.8.1] - 2026-11-20
Section titled “[0.8.1] - 2026-11-20”- Claude Code with a Claude subscription. Claude Code signed in with
Pro or Max sends an OAuth access token (
sk-ant-oat…), which Anthropic accepts only asAuthorization: Bearer. Passthrough sent every Anthropic key asx-api-key, so each request came back 401 and Claude Code retried until it gave up. Subscription tokens now go out as bearer tokens; API keys are unchanged. Live-tested with Claude Code 2.1 on a subscription.
[0.8.0] - 2026-10-23
Section titled “[0.8.0] - 2026-10-23”The API Gateway release: agents and apps call more than models and MCP
servers — GitHub, Jira, Salesforce, an internal service — and until now
every one of them carried long-lived tokens and bypassed the log.
PromptGate now serves those APIs on /api/<name>/… behind the same
pg_ keys: the API’s credential — a static header or an OAuth token —
lives only in PromptGate, every call is logged and rate-limited, the
guardrails read request bodies and answers, and an SSRF check at dial
time keeps configured URLs from becoming a door into the network
PromptGate runs in. OAuth connections hold the tokens — 30 providers
with v1’s mistakes fixed (PKCE sent, the right client authentication,
refresh tokens at all), sealed with AES-256-GCM, renewed before they
expire — for APIs and for remote MCP servers, which with oauth: auto
find their authorization server and register PromptGate by themselves.
Own implementation, no OAuth module.
- API Gateway (
internal/apigw) onsurfaces.api_gateway.mount:/api/<name>/<path>goes to the API’surljoined with<path>,pg_keys only (keys[].apis), the caller’s credentials,X-Forwarded-*andX-PromptGate-*headers never reach the API; traversal in any encoding refused (encoded slashes kept), method allowlist, streaming in both directions with flushing for event streams, request/response caps, redirects passed back unfollowed, retries for idempotent methods,X-PromptGate-Request-Id, one error shape; APIs reload live. - OAuth connections, part 1 — OAuth:
oauth.connections(preset,grantauthorization_code/client_credentials, client credentials,scopes, tenantconfig, URL overrides,token_auth,pkce,params) andoauth.redirect_url, validated on load; 30 built-in presets (promptgate oauth presets) with v1’s mistakes fixed: PKCE S256 sent, Basic client authentication where the provider wants it, Google/Dropbox offline access, Figma’s refresh endpoint, every tenant field used and checked; tokens stored in the request log database (schema v15) sealed with AES-256-GCM (PROMPTGATE_SECRET_KEYor a generatedsecret.key), pending authorizations only as the hash of their state. - OAuth connections, part 2: the authorization code flow with PKCE
(
promptgate oauth connect, the web UI’s/oauth/callbackor a loopback listener of the command), state bound to the web UI user and single-use; client credentials; renewal a minute before expiry, one renewal for concurrent requests, renewal after a 401; needs reconnect with the reason when the provider refuses the refresh token or the secret key changed; RFC 7009 revocation onoauth disconnect;oauth list,refresh,prune; token endpoints reached through the SSRF check, never following redirects. - OAuth connections in use:
apis.<name>.oauthandmcp.servers.<name>.oauthsend the connection’s token asAuthorization(never the caller’s), renew it once and resend after a 401 (API request bodies are kept for that); an API’surldefaults to its preset’s API; without a token the API Gateway answers 502oauth_unavailablewith the command to run.promptgate mcp servers|tools|calluse the stored tokens too. - Quality gate: pgfuzz’s new
apiprobe runs inscripts/pgfuzz-gate.sh(stages api-access, api-headers, api-paths, api-ssrf, api-size, api-requests, api-answers — 25 stages in all); API Gateway benchmarks (go test -bench APICall ./internal/apigw, a load run in bench/results): a plain call costs about 0.25 ms at the median over calling the API directly. - Web UI: APIs (list with today’s calls, errors and p50; a page per API with its credentials, OAuth state, recent calls and masked definition; YAML editor; disable, enable, delete) and Connections (state, expiry, who uses each; connect, renew, disconnect; new connections from the 30 presets) under API Gateway; the key form limits keys to APIs; an MCP server’s page shows its OAuth state with a Connect button; the OAuth result page leads to the connections.
promptgate apis list|call(call runs one request through the API Gateway’s rules in-process, without a pg_ key),keys create --api, an APIS column inkeys list; control plane toolsapis,oauth_connections,api_setandapi_delete— agents can’t set credentials,privateor move a credentialed API — andkey_createtakesapis;mcp importgives remote servers without credentialsoauth: auto.- MCP authorization discovery:
mcp.servers.<name>.oauth: autofinds the authorization server from the 401’sresource_metadataor the well-known URIs (RFC 9728), reads its metadata (RFC 8414 / OpenID), registers PromptGate as a client (RFC 7591, public with PKCE), sendsresource(RFC 8707) with every request and refuses servers without PKCE S256;promptgate oauth connect mcp:<server>; 2025-03-26 servers without metadata are tried at their origin. Named connections getresourcetoo. security.ssrf.mcp: truechecks remote MCP servers’ addresses; a changed SSRF setting reconnects them at once.- Guardrails on API Gateway bodies: global rules,
guardrails.apis.<api>, then the key’s; requests read as roleassistant, answers as roletool; JSON (every string value) and text bodies, binary bodies and event streams pass uninspected; redaction restored in the answer; blocks answer 422 (request) or 502 (answer withheld), compressed text bodies the guards can’t read are refused (415 / 502);ip_allowlistandtime_windowapply to every call. The web UI’s guardrails page has the new scope. - API Gateway requests in the request log (surface
api: API as provider, method as model, path without query as route; refused requests too),logs --surface api,stats --by api|method(--surface api), own per-minute totals (store schema v14,api_rollups) kept out of model stats and cost;limits.apis(per API, shared by all keys,"*"), 429 withRetry-After; Prometheuspromptgate_api_requests_total,promptgate_api_request_duration_seconds,promptgate_ssrf_blocked_total; console lines, the web UI’s log filter, the limits page and the control plane’sstats,logsandlimit_setknow the new surface. - API Gateway configuration:
apis.<name>(url,methods, header policyforward/block/setwith${ENV}and{{ key }},{{ user }},{{ request_id }}, timeouts, body caps,query,retries,private,forwarded),surfaces.api_gateway.mount(default/api) andkeys[].apis— see API Gateway. - SSRF protection (
internal/netguard): outbound connections are checked at dial time on the resolved address — loopback, private, link-local and metadata, CGNAT, multicast and reserved ranges, IPv4 in mapped/NAT64/6to4 form — so DNS rebinding can’t get through; exceptions insecurity.ssrf.allow.
Changed
Section titled “Changed”- The API Gateway also refuses
..;path segments (..;jsessionid=x), which Tomcat and other servlet containers read as..; streamed answers reuse their copy buffers (17 instead of 52 KB per call). - A remote MCP server whose OAuth connection has no token yet gets its requests without one; its 401 then says what to run.
- The secret key file is created only when an OAuth connection first needs it, written whole and linked into place — concurrent first starts agree on one key and never read a half-written file.
- Surface mounts are checked pairwise for overlaps (three surfaces now).
Performance
Section titled “Performance”Release run, on a machine kept busy by unrelated projects (load average 13–24): the proxy path is unchanged code and measures as v0.7.0 does within the run’s noise (0.30 ms at the median at one client in the steadier round, 52–53 MB RSS); an API Gateway call with guardrails on both bodies costs 0.26–0.27 ms at the median over calling the API directly, 0.24 ms without — see bench/results.