修复:避免在连接导出和日志中泄露敏感信息 / avoid leaking connection credentials in exports and logs (#16)

* fix: redact ssh password from connection exports

* test: cover redacted connection targets

* fix: avoid logging connection credentials

* fix(redis): support stream value preview
This commit is contained in:
Sugar
2026-04-30 15:44:53 +08:00
committed by GitHub
parent 9e58fefab8
commit ac76aadbed
8 changed files with 266 additions and 18 deletions
+1
View File
@@ -73,6 +73,7 @@ function typeColor(type: string): string {
case "set": return "text-purple-500";
case "zset": return "text-amber-500";
case "hash": return "text-orange-500";
case "stream": return "text-teal-500";
default: return "text-muted-foreground";
}
}
+14
View File
@@ -234,6 +234,20 @@ onMounted(load);
</div>
</div>
<!-- Stream (readonly) -->
<div v-else-if="data.key_type === 'stream'" class="flex-1 overflow-auto">
<div class="px-4 py-1 text-xs text-muted-foreground border-b">
{{ t('redis.entries', { count: Array.isArray(data.value) ? data.value.length : 0 }) }}
</div>
<div v-for="entry in data.value" :key="entry.id" class="px-4 py-2 border-b text-sm font-mono hover:bg-accent/50">
<div class="mb-1 text-xs text-muted-foreground">{{ entry.id }}</div>
<div v-for="(val, field) in entry.fields" :key="String(field)" class="grid grid-cols-[minmax(6rem,0.35fr)_1fr] gap-3 py-0.5">
<span class="truncate text-blue-500">{{ field }}</span>
<span class="truncate text-muted-foreground">{{ val }}</span>
</div>
</div>
</div>
<!-- Unknown -->
<div v-else class="flex-1 overflow-auto p-4">
<pre class="font-mono text-sm whitespace-pre-wrap">{{ formatValue(data.value) }}</pre>
+1
View File
@@ -173,6 +173,7 @@ export default {
items: "{count} items",
fields: "{count} fields",
members: "{count} members",
entries: "{count} entries",
noExpiry: "no expiry",
},
mongo: {
+1
View File
@@ -171,6 +171,7 @@ export default {
items: "{count} 个元素",
fields: "{count} 个字段",
members: "{count} 个成员",
entries: "{count} 条记录",
noExpiry: "永不过期",
},
mongo: {
+1 -1
View File
@@ -459,7 +459,7 @@ export const useConnectionStore = defineStore("connection", () => {
const { writeTextFile } = await import("@tauri-apps/plugin-fs");
const path = await save({ filters: [{ name: "JSON", extensions: ["json"] }], defaultPath: "dbx-connections.json" });
if (!path) return;
const data = connections.value.map((c) => ({ ...c, password: "" }));
const data = connections.value.map((c) => ({ ...c, password: "", ssh_password: "" }));
await writeTextFile(path, JSON.stringify(data, null, 2));
}