Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/gittensory-ui/src/lib/miner-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ function sanitizeMinerCommand(command: string): string {
(_, prefix) => `${prefix}<local-path>`,
)
.replace(
/\b(?:wallet|hotkey|coldkey|mnemonic|raw[-_\s]?trust|private[-_\s]?reviewability|trust[-_\s]?score)\b(?:\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s"'`,;)]+))?/gi,
// Only redact actual `term=value` / `term: value` secret leakage. The assignment is required so
// that legitimate login/repo names containing these words (e.g. a repo named "wallet-adapter" or
// login "trust-score" -- already validated upstream) are not corrupted into broken commands.
/\b(?:wallet|hotkey|coldkey|mnemonic|raw[-_\s]?trust|private[-_\s]?reviewability|trust[-_\s]?score)\b\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s"'`,;)]+)/gi,
"[redacted]",
);
}
20 changes: 20 additions & 0 deletions test/unit/miner-dashboard-commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,24 @@ describe("miner dashboard command actions", () => {
/\/Users|\/home|wallet|hotkey|raw trust|private reviewability/i,
);
});

it("keeps legitimate repo/login names that contain sensitive words", () => {
const commands = buildMinerCommandActions({
login: "trust-score",
repoFullName: "metamask/wallet-adapter",
});

const preflight = commands.find((command) => command.id === "preflight");
expect(preflight).toMatchObject({
command:
"gittensory-mcp preflight --login trust-score --repo metamask/wallet-adapter --base origin/main --json",
copyable: true,
state: "ready",
});
// The real names survive; nothing is redacted out of a runnable command.
expect(preflight?.command).not.toContain("[redacted]");

const plan = commands.find((command) => command.id === "plan");
expect(plan).toMatchObject({ command: "gittensory-mcp agent plan --login trust-score --json", copyable: true });
});
});