mirror of
https://github.com/stablyai/orca.git
synced 2026-10-18 08:03:22 +00:00
Fix gh CLI GHES host pinning and rate-limit scope leaks
- Pin `--host` on every gh call site so a process-level GH_HOST can't silently redirect requests, and qualify `-R`/`-R=` repo shorthand alongside the existing `--repo=` handling. - Check the target scope for an active rate-limit block before each WSL/native or host fallback retry, not just on the initial attempt, so a blocked scope can't be hit again through a fallback path. - Compute idempotency once per call instead of re-deriving it after fallback reassigns args.
This commit is contained in:
@@ -49,14 +49,13 @@ export function isGitHubDotComRepository(repository: GitHubApiRepository): boole
|
||||
return !repository.host || repository.host.toLowerCase() === 'github.com'
|
||||
}
|
||||
|
||||
// Why: the gh runner host-qualifies argv (`--hostname`, `HOST/OWNER/REPO`)
|
||||
// from `options.host`, so merging this into a call's exec options is the one
|
||||
// step a call site needs to target GHES. github.com stays unset to keep gh's
|
||||
// default-host resolution (and existing argv) unchanged.
|
||||
// Why: the gh runner host-qualifies argv from `options.host`, so every known
|
||||
// host must be carried through. Pinning github.com prevents a process-level
|
||||
// GH_HOST from silently redirecting an otherwise unambiguous API request.
|
||||
export function githubHostExecOptions(repository: GitHubApiRepository | null | undefined): {
|
||||
host?: string
|
||||
} {
|
||||
return repository?.host && !isGitHubDotComRepository(repository) ? { host: repository.host } : {}
|
||||
return repository?.host ? { host: repository.host } : {}
|
||||
}
|
||||
|
||||
export function githubRepositoryWebHost(repository: GitHubApiRepository): string {
|
||||
|
||||
Reference in New Issue
Block a user