Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(github): redact credentials from github_repo_analyze remoteUrl (#4577)

rUv27b48e6ba4d0
diff --git a/v3/@claude-flow/cli/__tests__/github-repo-analyze-dotted-name.test.ts b/v3/@claude-flow/cli/__tests__/github-repo-analyze-dotted-name.test.ts
index fa4d2a9189..95350a0119 100644
--- a/v3/@claude-flow/cli/__tests__/github-repo-analyze-dotted-name.test.ts
+++ b/v3/@claude-flow/cli/__tests__/github-repo-analyze-dotted-name.test.ts
@@ -69,3 +69,17 @@ describe('github_repo_analyze owner/repo from the origin remote', () => {
expect(r.repository).toBe('acme/widgets');
});
});
+
+describe('github_repo_analyze never echoes credentials from the origin remote', () => {
+ it.each([
+ ['https://x-access-token:[email protected]/ruvnet/ruflo.git', 'https://github.com/ruvnet/ruflo.git'],
+ ['https://oauth2:p@[email protected]/acme/next.js.git', 'https://gitlab.com/acme/next.js.git'],
+ ['ssh://[email protected]/ruvnet/ruflo.git', 'ssh://github.com/ruvnet/ruflo.git'],
+ ['[email protected]:ruvnet/ruflo.git', '[email protected]:ruvnet/ruflo.git'],
+ ])('%s is reported as %s', async (remoteUrl, expected) => {
+ gitWithRemote(remoteUrl);
+ const r = await analyze();
+ expect(r.remoteUrl).toBe(expected);
+ expect(JSON.stringify(r)).not.toMatch(/SECRET|p@ss/);
+ });
+});
diff --git a/v3/@claude-flow/cli/src/mcp-tools/github-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/github-tools.ts
index 97c58ba18b..7abc5fcc94 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/github-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/github-tools.ts
@@ -142,6 +142,15 @@ function sanitizeLabels(value: unknown): string[] | null {
return out;
}
+/**
+ * Drop userinfo from a URL-form remote (`https://user:token@host/o/r`) so a
+ * credential embedded in the origin URL never reaches tool output. scp-form
+ * remotes (`git@host:o/r`) carry no secret and are returned unchanged.
+ */
+export function redactRemoteUrl(url: string): string {
+ return url.replace(/^([a-z][a-z0-9+.-]*:\/\/)[^/]*@/i, '$1');
+}
+
/** Check if gh CLI is available */
function hasGhCli(): boolean {
return run('gh --version') !== null;
@@ -219,7 +228,7 @@ export const githubTools: MCPTool[] = [
repository: repoKey,
branch: repoInfo.branch,
metrics: repoInfo.metrics,
- remoteUrl: remoteUrl || null,
+ remoteUrl: remoteUrl ? redactRemoteUrl(remoteUrl) : null,
lastAnalyzed: repoInfo.lastAnalyzed,
};
}