Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

fix: ignore inherited keys in repository provider host lookup

Rafael Callejaf8513310c0b2
diff --git a/archify.zip b/archify.zip
index a71810dc..904ce281 100644
Binary files a/archify.zip and b/archify.zip differ
diff --git a/archify/renderers/shared/repository-location.mjs b/archify/renderers/shared/repository-location.mjs
index 3d81fe47..7a36226d 100644
--- a/archify/renderers/shared/repository-location.mjs
+++ b/archify/renderers/shared/repository-location.mjs
@@ -29,7 +29,7 @@ export function parseRepositoryRemote(value, { authored = false, provider: provi
if (authored && protocol !== 'ssh:' && (url.username || url.password)) return null;
const hostname = url.hostname.toLowerCase();
if (!hostname) return null;
- const provider = PROVIDER_HOSTS[hostname] || (providerHint === 'gitlab' ? 'gitlab' : null);
+ const provider = Object.hasOwn(PROVIDER_HOSTS, hostname) ? PROVIDER_HOSTS[hostname] : providerHint === 'gitlab' ? 'gitlab' : null;
const last = segments.length - 1;
if (provider) segments[last] = segments[last].replace(provider === 'github' ? /\.git$/i : /\.git$/, '');
if (!segments[last] || segments[last] === '.' || segments[last] === '..') return null;
diff --git a/test/repository-evidence.test.mjs b/test/repository-evidence.test.mjs
index cc18fcf6..65f5480f 100644
--- a/test/repository-evidence.test.mjs
+++ b/test/repository-evidence.test.mjs
@@ -267,6 +267,9 @@ test('self-managed GitLab links require an explicit provider and keep endpoint i
}
for (const [repository, remote, code] of [
[{ url }, url, 'repository-evidence/links-unsupported'],
+ // Inherited object keys are not forge hosts.
+ [{ url: 'https://constructor/Platform/evidence-repo' }, 'https://constructor/Platform/evidence-repo', 'repository-evidence/links-unsupported'],
+ [{ url: 'https://__proto__/Platform/evidence-repo' }, 'https://__proto__/Platform/evidence-repo', 'repository-evidence/links-unsupported'],
[{ url: 'https://github.com/example/evidence-repo', provider: 'gitlab' }, 'https://github.com/example/evidence-repo', 'repository-evidence/provider-invalid'],
[{ url: 'http://git.example.internal/Platform/evidence-repo', provider: 'gitlab' }, 'http://git.example.internal/Platform/evidence-repo', 'repository-evidence/links-unsupported'],
[{ url, provider: 'gitlab' }, 'ssh://[email protected]:2222/Platform/Services/evidence-repo.git', 'repository-evidence/origin-mismatch'],