Repository navigation
Conversation
…paces klangkd runs the PKCE authorization for a proxied forge on the host, keeps the access and refresh tokens per workspace and forge host, and injects them into a reverse proxy that containers reach at /forge-proxy/<host>/ with their workspace JWT. The browser-delegate relay refuses container-built authorization flows, PAT prompts and credential-cache reads for a proxied forge, so a container cannot obtain a forge credential through the bridge either. Policy is explicit and refuses everything by default: - forge_proxy_features: read, git-read, git-push, issues, issue-edit, site-create, collaborators, api-passthrough, or '*'. - forge_proxy_allowed_repos: owner/repo, owner/*, or '*', with ':ro' (reads only) and ':issues' (reads plus issue work) suffixes. - forge_proxy_template_repos / forge_proxy_template_owners / forge_proxy_collaborator_accounts for site creation from a template and read-only collaborators. A push that deletes a ref is refused, compressed pushes are refused so the ref updates stay inspectable, paths with encoding or URL delimiters are refused, and forge error bodies on API routes are replaced with a local error. Provider entries accept an optional OAuth scope.
This branch has not been deployed
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.
Summary
Workspaces never hold a git-forge OAuth token. klangkd runs the PKCE authorization for a proxied forge on the host, keeps the access and refresh tokens per workspace and forge host, and injects them into a reverse proxy that containers reach at
/forge-proxy/<host>/...with their workspace JWT. This follows the same pattern as/llm-proxy/.git-credential-klangk forge-auth <host>starts the flow and the browser tab approves it. klangkd consumes the authorization code; it is never relayed to the container.forge_proxy_featuresnames the operations the proxy performs:read,git-read,git-push,issues,issue-edit,site-create,collaborators,api-passthrough, or*.forge_proxy_allowed_reposnames the repositories:owner/repo,owner/*, or*. A:rosuffix allows reads only;:issuesallows reads plus issue work.forge_proxy_template_reposandforge_proxy_template_ownersallow generating a repository from a listed template.forge_proxy_collaborator_accountsallows adding listed accounts as read-only collaborators.api-passthroughmode, a call whose path names no repository needs an unrestricted*rule.scope, and the granted scope is logged at authorization (never the token).Configuration
Add a
KLANGKWS_FEATURE_OAUTH_PROVIDERSentry for the host with"flow": "authorization_code_pkce"and, optionally, ascope.Testing
klangk/forge_proxy.pyandklangk/api/forge_proxy.pyhave 100% line and branch coverage. Pre-commit passes, xenon included.Open