Skip to content

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

fix: credentialed HTTPS origin 매칭 및 진단 redact

Changsu Seong9419d3f9e8a2
diff --git a/archify.zip b/archify.zip
index b75a9d23..a35351cd 100644
Binary files a/archify.zip and b/archify.zip differ
diff --git a/archify/renderers/shared/repository-evidence.mjs b/archify/renderers/shared/repository-evidence.mjs
index 23cb6383..29f0a77f 100644
--- a/archify/renderers/shared/repository-evidence.mjs
+++ b/archify/renderers/shared/repository-evidence.mjs
@@ -38,8 +38,17 @@ function gitValue(repoRoot, args, failure) {
return result.stdout.trim();
}
+function redactRemoteUrl(value) {
+ return String(value || '').replace(/^(https:\/\/)[^/@\s]+@/i, '$1REDACTED@');
+}
+
+function normalizeRemoteForSlug(value) {
+ // Strip HTTPS userinfo so credentialed remotes share identity with canonical URLs.
+ return String(value || '').trim().replace(/^https:\/\/[^/@\s]+@/i, 'https://');
+}
+
function githubSlug(value) {
- const raw = String(value || '').trim();
+ const raw = normalizeRemoteForSlug(value);
const match = raw.match(/^(?:https:\/\/github\.com\/|git@github\.com:|ssh:\/\/git@github\.com\/)([^/\s]+)\/([^/\s]+?)(?:\.git)?\/?$/i);
return match ? `${match[1]}/${match[2]}`.toLowerCase() : null;
}
@@ -139,9 +148,10 @@ export function verifyRepositoryEvidence(diagramType, diagram, repoRootInput) {
}
const origin = gitValue(realRoot, ['remote', 'get-url', 'origin'], 'Evidence repository must have an origin remote.');
if (githubSlug(origin) !== authoredSlug) {
- evidenceFailure('repository-evidence/origin-mismatch', `Evidence repository origin ${JSON.stringify(origin)} does not match ${JSON.stringify(repository.url)}.`, {
+ const safeOrigin = redactRemoteUrl(origin);
+ evidenceFailure('repository-evidence/origin-mismatch', `Evidence repository origin ${JSON.stringify(safeOrigin)} does not match ${JSON.stringify(repository.url)}.`, {
subject: { repoRoot: realRoot },
- evidence: { localOrigin: origin, authoredRepository: repository.url },
+ evidence: { localOrigin: safeOrigin, authoredRepository: repository.url },
supportedFixes: ['use the matching local checkout or correct the authored repository URL'],
});
}
diff --git a/archify/test/repository-evidence.test.mjs b/archify/test/repository-evidence.test.mjs
index 7df16e85..4be2d1e5 100644
--- a/archify/test/repository-evidence.test.mjs
+++ b/archify/test/repository-evidence.test.mjs
@@ -60,6 +60,8 @@ test('repository evidence accepts canonical HTTPS and common SSH remotes', () =>
const output = path.join(data.root, 'remote-form.html');
for (const remote of [
'https://github.com/example/evidence-repo.git/',
+ 'https://x-access-token:[email protected]/example/evidence-repo.git',
+ 'https://oauth2:[email protected]/example/evidence-repo',
'[email protected]:example/evidence-repo.git',
'ssh://[email protected]/example/evidence-repo.git',
]) {
@@ -127,6 +129,23 @@ test('repository evidence is opt-in and never appears in ordinary artifacts', ()
assert.doesNotMatch(svg, /source-evidence-beacon|data-source-evidence-count/);
});
+
+test('origin-mismatch diagnostics redact HTTPS remote userinfo', () => {
+ const data = fixture();
+ const output = path.join(data.root, 'must-stay.html');
+ fs.writeFileSync(output, 'trusted previous artifact');
+ git(data.root, 'remote', 'set-url', 'origin', 'https://user:[email protected]/example/other-repo.git');
+ const result = run(['deliver', 'architecture', data.input, output, '--repo-root', data.root, '--json']);
+ assert.equal(result.status, 1);
+ const receipt = JSON.parse(result.stdout);
+ const diagnostic = receipt.diagnostics.find((entry) => entry.code === 'repository-evidence/origin-mismatch');
+ assert.ok(diagnostic, 'expected origin-mismatch diagnostic');
+ assert.doesNotMatch(receipt.error, /not-a-real-token/);
+ assert.doesNotMatch(JSON.stringify(receipt.diagnostics), /not-a-real-token/);
+ assert.match(diagnostic.evidence.localOrigin, /^https:\/\/REDACTED@github\.com\/example\/other-repo\.git$/);
+ assert.equal(fs.readFileSync(output, 'utf8'), 'trusted previous artifact');
+});
+
test('evidence fails closed without a root, on wrong origin, missing blobs, or impossible lines', () => {
const data = fixture();
const output = path.join(data.root, 'must-stay.html');