Conversation
Add HTTPS credential support so the knowledge base can clone and sync private Git repositories that require a Personal Access Token, alongside the existing SSH identity flow. Backend: - New https_credentials table (GORM AutoMigrate) with CRUD in the store, biz, and server layers, mirroring the existing SSH identity design. - Per-host credential matching so a repo URL selects the right token by its host (glob patterns supported in the hosts field). - Token is injected via a temporary GIT_ASKPASS script with GIT_TERMINAL_ PROMPT=0; the askpass file is created owner-only (0600) and removed after use. The token is never embedded in the URL. - Tokens are write-only: stored server-side and never echoed back to the client (DTO exposes has_token only). - annotateGitError gains an HTTPS branch distinguishing "no credential configured for host" from "credential rejected", matching the SSH hints. Frontend: - HTTPSCredentialsCard on the Code repos page: list, add, edit, delete, with hosts matching and write-only token entry. - Repo-creation error hint points operators to configure an HTTPS credential when a private HTTPS repo has none. Tests cover buildHTTPSEnv askpass generation, buildGitAuthEnv routing, per-host matching, and an optional real-repo clone e2e smoke test that skips when no test repo env is provided.
Member
|
Reviewed the scope again. This PR does include UI changes, mainly on the Code repos / Knowledge repos page:
Before merge, please add screenshots for the affected interactions, not just backend test results. At minimum:
Dark mode is enough if this page is dark-only in the current product path; include light mode too if the page supports it. |
Contributor
Author
|
@singchia Added the UI screenshots. This page supports both light and dark, so both themes are included. Screenshots are attached below: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.










What
Adds HTTPS + Personal Access Token authentication for the knowledge base's
code-repo integration, so operators can clone/sync private Git repos over
HTTPS (e.g. a self-hosted GitLab) — alongside the existing SSH identity flow.
Why
Today the knowledge base can only authenticate to private repos via SSH keys.
Many environments hand out HTTPS PATs instead of deploy keys, so private
https://…repos can't be ingested. This closes that gap.How
Backend
https_credentialstable (GORM AutoMigrate) with CRUD across store / biz/ server layers, mirroring the existing SSH identity design for consistency.
patterns supported in the
hostsfield).GIT_ASKPASSscript withGIT_TERMINAL_PROMPT=0; the askpass file is owner-only (0600) and removedafter use. The token is never embedded in the URL.
has_tokenonly).annotateGitErrorgains an HTTPS branch distinguishing "no credential forhost" from "credential rejected", matching the existing SSH hints.
Frontend
HTTPSCredentialsCardon the Code repos page: list / add / edit / delete,hosts matching, write-only token entry.
private HTTPS repo has none.
Testing
go test ./internal/manager/biz/knowledge/... ./internal/manager/server/knowledge/...— passnpm run buildinweb/— passbuildHTTPSEnvaskpass generation,buildGitAuthEnvrouting, and per-host matching. An optional real-repo clone e2e smoke test
skips when no test-repo env is provided.
One logical change; commit follows Conventional Commits.
Author confirmation