0
Fork 0
mirror of https://github.com/oblien/openship.git synced 2026-11-16 06:57:12 +00:00
openship/apps/api/test/modules/github/tokenFor.test.ts
Saim Shafique a22de88cb5
fix(github): resolve server credentials safely for repository scans (#1632)
* fix(github): fall back to a writable connected server's stored credential when no local server exists

Repository preparation borrowed a server's stored GitHub credential only
from the organization's canonical local server. Self-hosted setups whose
deploy target is a connected SSH server with its own stored PAT could
deploy but not scan the same private repo: with no server selected, the
fallback found no local server and preparation failed with
GITHUB_TOKEN_REQUIRED.

When no server is selected and the organization has no local server, use
the oldest connected deployment server the caller has write access to
that holds a stored token credential, the same set a real deploy can use.
Repository access, same-organization, server write permission, and
read-only local-read limits are unchanged. Explicit server selection is
unchanged.

Fixes #1630

* fix(github): require server selection for ambiguous repository credentials

* fix(dashboard): keep repository recovery server selection manual

---------

Co-authored-by: Hydra <abdelhamedmo59@gmail.com>
2026-11-06 15:59:57 +02:00

413 lines
19 KiB