JuliusBrussee/caveman · error
githubapp: invalid request path
Error message
githubapp: invalid request path
What it means
SSRF guard in App.do: the request path failed the single-host absolute-path checks (url.ParseRequestURI error, absolute URL, embedded host, or userinfo). The caller-supplied path argument is at fault.
Source
Thrown at shared/platform/githubapp/githubapp.go:358
// DoToken issues an authenticated GitHub REST call with an installation token and
// returns the status + raw body for the caller to parse. It is the reusable
// primitive the worker's PR opener builds the Git Data API flow on, so every
// GitHub egress goes through the one SSRF-guarded client + fixed base host.
func (a *App) DoToken(ctx context.Context, token, method, path string, body any) (int, []byte, error) {
return a.do(ctx, "Bearer "+token, method, path, body)
}
func (a *App) do(ctx context.Context, authorization, method, path string, body any) (int, []byte, error) {
if !strings.HasPrefix(path, "/") || strings.HasPrefix(path, "//") || strings.Contains(path, "\\") {
return 0, nil, fmt.Errorf("githubapp: request path must be a single-host absolute path")
}
base, err := url.Parse(a.baseURL)
if err != nil || base.Scheme == "" || base.Host == "" || base.User != nil {
return 0, nil, fmt.Errorf("githubapp: invalid base URL")
}
relative, err := url.ParseRequestURI(path)
if err != nil || relative.IsAbs() || relative.Host != "" || relative.User != nil {
return 0, nil, fmt.Errorf("githubapp: invalid request path")
}
target, err := url.Parse(a.baseURL + path)
if err != nil || target.Scheme != base.Scheme || !strings.EqualFold(target.Host, base.Host) || target.User != nil {
return 0, nil, fmt.Errorf("githubapp: request path escaped configured host")
}
var reader io.Reader
if body != nil {
b, err := json.Marshal(body)
if err != nil {
return 0, nil, fmt.Errorf("githubapp: marshal request: %w", err)
}
reader = bytes.NewReader(b)
}
req, err := http.NewRequestWithContext(ctx, method, target.String(), reader)
if err != nil {
return 0, nil, fmt.Errorf("githubapp: build request: %w", err)
}
req.Header.Set("Authorization", authorization)View on GitHub (pinned to 766dce6b13)
Solutions
- Pass only relative paths starting with '/' with no scheme, host, or user components
- URL-escape dynamic segments (owner/name) before building the path
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at shared/platform/githubapp/githubapp.go:358 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/dad02bcd2592b6d8.
Report an issue: GitHub.