Add support for proxying requests with API keys from proxy records - #885
Open
KallynGowdy wants to merge 2 commits into
Open
KallynGowdy wants to merge 2 commits into
KallynGowdy wants to merge 2 commits into
Conversation
Adds a `proxy` resource kind and a `ProxyController` so that experiences
can call services that are secured by an API key without ever shipping the
API key to the browser.
Proxy records store the `host` that requests are sent to along with a `data`
object that describes the properties to apply to the target request. The
supported properties are `body.{property}`, `headers.authorization`, and
`headers.authorization.bearer`. Every other property is rejected, and a proxy
that sets body properties rejects requests that don't contain JSON data.
Actions:
- `os.recordProxy()` / `POST /api/v2/records/proxy`
- `os.getProxy()` / `GET /api/v2/records/proxy`
- `os.listProxies()`, `os.listProxiesByMarker()` / `GET /api/v2/records/proxy/list`
- `os.eraseProxy()` / `DELETE /api/v2/records/proxy`
- `os.proxyRequest()` / `POST /api/v2/records/proxy/request`
Security:
- Proxies are `private` by default. The `publicRead` marker grants `proxy.run`
so that anyone can call the proxy without being able to read its data.
- Proxy hosts are resolved to IP addresses before requests are sent and the
connection is pinned to the verified address so that a proxy cannot be used
to reach services on the internal network.
Also adds proxy subscription features, Prisma/SQLite stores and migrations,
and the `invalid_proxy_host` and `proxy_request_failed` error codes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EMZ8tRmuQR7TqXWzH48gND
…hema Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EMZ8tRmuQR7TqXWzH48gND
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
proxyresource kind and aProxyControllerso that experiencescan call services that are secured by an API key without ever shipping the
API key to the browser.
Proxy records store the
hostthat requests are sent to along with adataobject that describes the properties to apply to the target request. The
supported properties are
body.{property},headers.authorization, andheaders.authorization.bearer. Every other property is rejected, and a proxythat sets body properties rejects requests that don't contain JSON data.
Actions:
os.recordProxy()/POST /api/v2/records/proxyos.getProxy()/GET /api/v2/records/proxyos.listProxies(),os.listProxiesByMarker()/GET /api/v2/records/proxy/listos.eraseProxy()/DELETE /api/v2/records/proxyos.proxyRequest()/POST /api/v2/records/proxy/requestSecurity:
privateby default. ThepublicReadmarker grantsproxy.runso that anyone can call the proxy without being able to read its data.
connection is pinned to the verified address so that a proxy cannot be used
to reach services on the internal network.
Also adds proxy subscription features, Prisma/SQLite stores and migrations,
and the
invalid_proxy_hostandproxy_request_failederror codes.Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01EMZ8tRmuQR7TqXWzH48gND