fix: make postgresql actually usable (4 critical bugs)

- CORS whitelist only allowed origin localhost:5173; browsers send Origin
  on same-origin POST too, so every deployment on any other port/origin
  got empty 403 on ALL POST/PUT/DELETE (curl tests masked it) - now
  echoes any origin (bearer-token auth, no cookie CSRF surface)
- connection_tester pg DSN had a literal *** password placeholder - pg
  connection test and query path could never authenticate
- instance detail endpoints (databases/tables/db-schema/table-detail)
  ran MySQL SHOW statements against pg - added pg branches
  (pg_database/pg_class/information_schema/pg_indexes, search_path
  semantics, PRI detection); schema filter uses non-system schemas
- frontend normalizeDbType missed the literal 'postgresql' value so pg
  instances were treated as mysql (backtick quoting, no column hints);
  genSql no longer emits db.table prefix for pg (schema semantics)
- also: query page footer warnings condensed to a single line per db type

verified live: mysql table tree/context menu/preview-execute; pg table
tree/columns/PK, double-click preview with masking working (email/phone
masked), query history persisted
This commit is contained in:
Logan.Li committed 2026-10-26 19:47:08 +08:00
1 parent c8155e2d33
commit 2c96902fbd
7 files changed
+183 -37

No files matched your search

-8
View File
@@ -540,14 +540,6 @@ export default function QueriesPage() {
onPageChange={handleExecute}
/>
)}
{/* -- 安全提示 -- */}
<div className="shrink-0 px-4 pb-3">
<div className="flex items-center gap-2 px-3 py-2 bg-yellow-500/5 border border-yellow-500/15 rounded-lg text-xs text-[var(--dg-text-muted)]">
<AlertTriangle className="w-3.5 h-3.5 text-yellow-400 shrink-0" />
查询结果中的敏感字段将自动脱敏。MySQL/PG 仅支持 SELECT 查询,Redis/MongoDB 支持只读命令。
</div>
</div>
</div>
{/* end 编辑器+结果区 */}
</div>