Skip to content

feat: expose the repository clone URL and its auth headers - #135

Merged
Meldiron merged 1 commit into
mainfrom
feat-clone-surface
Aug 19, 2026
Merged

feat: expose the repository clone URL and its auth headers#135
Meldiron merged 1 commit into
mainfrom
feat-clone-surface

Conversation

@Meldiron

Copy link
Copy Markdown
Contributor

What does this PR do?

A provider without archive downloads reports supportsRepositoryArchives() === false, but the library gave consumers nothing to clone with — the authenticated URL existed only inside generateCloneCommand(), as an embedded-credential string in a shell command.

This adds two methods next to the capability:

  • getRepositoryCloneUrl($owner, $repositoryName) — the Git HTTPS URL, without credentials. Base Git throws (mirroring getRepositoryPresignedUrl()); Origin overrides.
  • getRepositoryCloneHeaders() — the headers that authenticate a fetch of that URL (Origin: Authorization: Basic x-access-token:<installation token>), empty when none are needed.

Credentials ride a header rather than URL userinfo so tokens never surface in the errors and logs that echo URLs verbatim.

First consumer: Appwrite's deployment pipeline hands these to the orchestrator's new clone artifact for providers that serve content over Git HTTPS only (Origin).

Test Plan

  • Pint and PHPStan (level 8, src + tests) pass.
  • Origin integration suite remains skipped upstream (fixtures cannot be provisioned automatically); the override mirrors authenticatedCloneUrl(), which the skipped suite covers.

🤖 Generated with Claude Code

A provider without archive downloads answers supportsRepositoryArchives()
with false, but gave consumers nothing to clone with - the authenticated
URL lived inside generateCloneCommand() only. getRepositoryCloneUrl() and
getRepositoryCloneHeaders() hand out the pieces separately, credentials
on a header rather than the URL, for consumers that clone through
infrastructure of their own (the orchestrator's clone artifact).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a provider-level contract for retrieving a credential-free repository clone URL and separate authentication headers, with an Origin implementation using HTTP Basic authentication.

  • Adds default clone URL and header methods to the shared Git adapter.
  • Exposes Origin's Git HTTPS endpoint without URL userinfo credentials.
  • Returns the installation token through an Authorization header instead.

Confidence Score: 4/5

The PR appears safe to merge, with the non-blocking recommendation to add focused coverage for the new clone URL and authentication-header contract.

The implementation preserves Origin's existing clone target while moving credentials into a Basic Authorization header; no current functional failure was established, but the new public authentication behavior is untested and the Origin integration suite is skipped.

Files Needing Attention: src/VCS/Adapter/Git/Origin.php

Important Files Changed

Filename Overview
src/VCS/Adapter/Git.php Adds an optional clone URL/header contract using the established throwing-default capability pattern.
src/VCS/Adapter/Git/Origin.php Implements a credential-free clone URL and matching Basic Authorization header correctly, but leaves the security-sensitive behavior without automated coverage.

Fix all with Greploop Fix All in Claude Code Fix All in Codex

Prompt To Fix All With AI
### Issue 1
src/VCS/Adapter/Git/Origin.php:1714-1732
**Clone authentication contract lacks coverage**

These new public methods define security-sensitive URL and authentication behavior, but no focused test verifies that credentials stay out of the URL, path components are encoded, and the installation token produces the expected Basic header. Since Origin's live integration suite is skipped, regressions can cause private clones to fail or expose credentials without being detected.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "feat: expose the repository clone URL an..." | Re-trigger Greptile

Comment thread src/VCS/Adapter/Git/Origin.php
Meldiron added a commit to appwrite/appwrite that referenced this pull request Aug 19, 2026
Deployments::createFromVcs() owns the choice every call site used to
spell out: providers with archive downloads keep handing the sidecar a
presigned tarball URL, and a provider without them (the upcoming
Origin) is cloned by the sidecar itself over Git HTTPS, through the
orchestrator's new clone artifact. Credentials ride a header via the
adapter's new clone surface, never the URL.

Depends on open-runtimes/orchestrator (clone artifact),
open-runtimes/sdk-for-php#12 and utopia-php/vcs#135; composer pins the
two library branches until they are tagged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@Meldiron Meldiron left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Meldiron
Meldiron merged commit ee39289 into main Aug 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants