Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (codex): canonicalize only the documented ssh.github.com alias

[._.]/ Adam Eivy4ebd4bda1ace
diff --git a/server/lib/workTracker.js b/server/lib/workTracker.js
index d0d66b77d5..910c988acd 100644
--- a/server/lib/workTracker.js
+++ b/server/lib/workTracker.js
@@ -82,14 +82,15 @@ export function isGithubHost(host) {
* Canonicalizes GitHub's SSH-over-443 alias: a `[email protected]:443/owner/repo`
* remote parses to host `ssh.github.com`, but `gh --repo` reads the `HOST/` prefix
* as the API host, so `ssh.github.com/owner/repo` would query the SSH endpoint and
- * silently return nothing. Strip a leading `ssh.` so the selector names the real
- * API host (`ssh.github.com`→`github.com`, `ssh.github.example.com`→`github.example.com`).
+ * silently return nothing. Only `github.com` has a documented `ssh.` alias, and an
+ * enterprise host may legitimately begin with `ssh.` (`ssh.github.acme.example`),
+ * so canonicalize the exact known alias rather than stripping `ssh.` from any host.
* @param {{host?:string|null, fullName?:string|null}} origin
* @returns {string|null}
*/
export function githubRepoSpec(origin) {
if (!origin?.fullName || !isGithubHost(origin.host)) return null;
- const apiHost = origin.host.replace(/^ssh\./i, '');
+ const apiHost = /^ssh\.github\.com$/i.test(origin.host) ? 'github.com' : origin.host;
return `${apiHost}/${origin.fullName}`;
}
diff --git a/server/lib/workTracker.test.js b/server/lib/workTracker.test.js
index 4d3e33a07c..99009cb6e8 100644
--- a/server/lib/workTracker.test.js
+++ b/server/lib/workTracker.test.js
@@ -64,13 +64,19 @@ describe('githubRepoSpec', () => {
expect(githubRepoSpec({ host: 'github.acme.example', fullName: 'acme/app' }))
.toBe('github.acme.example/acme/app');
});
- it('canonicalizes the SSH-over-443 alias to the API host', () => {
+ it('canonicalizes only the documented github.com SSH-over-443 alias', () => {
// [email protected]:443/owner/repo → getOriginInfo host 'ssh.github.com';
// gh --repo reads the HOST/ prefix as the API host, so it must be github.com.
expect(githubRepoSpec({ host: 'ssh.github.com', fullName: 'atomantic/PortOS' }))
.toBe('github.com/atomantic/PortOS');
- expect(githubRepoSpec({ host: 'ssh.github.example.com', fullName: 'acme/app' }))
- .toBe('github.example.com/acme/app');
+ expect(githubRepoSpec({ host: 'SSH.GitHub.com', fullName: 'atomantic/PortOS' }))
+ .toBe('github.com/atomantic/PortOS');
+ });
+ it('preserves a genuine enterprise host that legitimately begins with ssh.', () => {
+ // Not the documented alias — its real API host IS ssh.github.acme.example,
+ // so stripping ssh. would misroute to a different/nonexistent server.
+ expect(githubRepoSpec({ host: 'ssh.github.acme.example', fullName: 'acme/app' }))
+ .toBe('ssh.github.acme.example/acme/app');
});
it('returns null for a non-GitHub host, a missing owner/repo, or no origin', () => {
expect(githubRepoSpec({ host: 'gitlab.com', fullName: 'group/proj' })).toBeNull();