feat(gitea): add --clone-url-base flag for clone URL rewriting #1

Closed
eblume wants to merge 1 commit from feature/upstream/clone-url-base into main
Owner

When scanning a self-hosted Gitea/Forgejo instance, the API may return clone URLs with a different hostname than the one you want to clone from (e.g., public ROOT_URL vs internal endpoint behind a reverse proxy).

This adds --clone-url-base to the scan gitea subcommand, which rewrites the scheme, host, and port of clone URLs returned by the API while preserving the path.

Example:

kingfisher scan gitea \
  --api-url https://forge.internal.example.com/api/v1/ \
  --clone-url-base https://forge.internal.example.com/ \
  --user eblume

Includes unit tests for the URL rewriting function and an integration test using wiremock to verify the full enumeration path.

When scanning a self-hosted Gitea/Forgejo instance, the API may return clone URLs with a different hostname than the one you want to clone from (e.g., public ROOT_URL vs internal endpoint behind a reverse proxy). This adds `--clone-url-base` to the `scan gitea` subcommand, which rewrites the scheme, host, and port of clone URLs returned by the API while preserving the path. **Example:** ``` kingfisher scan gitea \ --api-url https://forge.internal.example.com/api/v1/ \ --clone-url-base https://forge.internal.example.com/ \ --user eblume ``` Includes unit tests for the URL rewriting function and an integration test using wiremock to verify the full enumeration path.
feat(gitea): add --clone-url-base flag for clone URL rewriting
Some checks are pending
ClusterFuzzLite PR fuzzing / PR (address) (pull_request) Waiting to run
CI Pull Request / Linux x64 (pull_request) Waiting to run
CI Pull Request / Linux arm64 (pull_request) Waiting to run
CI Pull Request / macOS arm64 (pull_request) Waiting to run
CI Pull Request / Windows arm64 (pull_request) Waiting to run
CI Pull Request / Windows x64 (pull_request) Waiting to run
c24dc0dc27
When scanning a self-hosted Gitea/Forgejo instance, the API may be
reachable at a different hostname than the git clone endpoint (e.g.,
internal API vs. public clone URL behind a reverse proxy). The
--clone-url-base flag rewrites the scheme, host, and port of clone
URLs returned by the API, preserving the path.

Example:
  kingfisher scan gitea \
    --api-url https://forge.internal.example.com/api/v1/ \
    --clone-url-base https://forge.internal.example.com/ \
    --user eblume

This avoids routing clone traffic through an external proxy when the
API and git endpoints share the same internal host but the instance's
ROOT_URL points to the public endpoint.

Includes unit tests for the URL rewriting function and an integration
test using wiremock to verify the full enumeration path.
eblume force-pushed feature/upstream/clone-url-base from c24dc0dc27
Some checks are pending
ClusterFuzzLite PR fuzzing / PR (address) (pull_request) Waiting to run
CI Pull Request / Linux x64 (pull_request) Waiting to run
CI Pull Request / Linux arm64 (pull_request) Waiting to run
CI Pull Request / macOS arm64 (pull_request) Waiting to run
CI Pull Request / Windows arm64 (pull_request) Waiting to run
CI Pull Request / Windows x64 (pull_request) Waiting to run
to 677c7a5d5f
Some checks failed
ClusterFuzzLite PR fuzzing / PR (address) (pull_request) Has been cancelled
CI Pull Request / Linux x64 (pull_request) Has been cancelled
CI Pull Request / Linux arm64 (pull_request) Has been cancelled
CI Pull Request / macOS arm64 (pull_request) Has been cancelled
CI Pull Request / Windows arm64 (pull_request) Has been cancelled
CI Pull Request / Windows x64 (pull_request) Has been cancelled
2026-03-29 08:28:38 -07:00
Compare
forgejo-actions force-pushed feature/upstream/clone-url-base from 677c7a5d5f
Some checks failed
ClusterFuzzLite PR fuzzing / PR (address) (pull_request) Has been cancelled
CI Pull Request / Linux x64 (pull_request) Has been cancelled
CI Pull Request / Linux arm64 (pull_request) Has been cancelled
CI Pull Request / macOS arm64 (pull_request) Has been cancelled
CI Pull Request / Windows arm64 (pull_request) Has been cancelled
CI Pull Request / Windows x64 (pull_request) Has been cancelled
to 4d5ce57a12 2026-03-29 22:00:35 -07:00
Compare
eblume closed this pull request 2026-03-30 07:26:53 -07:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
eblume/kingfisher!1
No description provided.