backupdrill 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/restore-engine.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ export type RestoreTargetKind = "sandbox" | "supabase";
|
|
|
5
5
|
export declare function normalizeHost(hostname: string): string;
|
|
6
6
|
/**
|
|
7
7
|
* 从连接串提取 Supabase 项目 ref(纯函数):直连主机 `db.<ref>.supabase.co` 或
|
|
8
|
-
* pooler 用户名
|
|
8
|
+
* pooler 用户名 `<role>.<ref>`(默认 postgres,BackupDrill 免密接入建的 backupdrill_* 角色
|
|
9
|
+
* 同样走 Supavisor,租户身份只看最后一段 ref;角色名限小写字母/数字/下划线,与 Postgres 标识符
|
|
10
|
+
* 未加引号时的折叠规则一致)。放在引擎层:备份端(写 manifest.sourceProjectRef)
|
|
9
11
|
* 与恢复端(同源阻断)共用同一个身份判定。非 Supabase 形态返回 null。
|
|
10
12
|
*/
|
|
11
13
|
export declare function projectRefOf(connString: string): string | null;
|
package/dist/restore-engine.js
CHANGED
|
@@ -18,7 +18,9 @@ export function normalizeHost(hostname) {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* 从连接串提取 Supabase 项目 ref(纯函数):直连主机 `db.<ref>.supabase.co` 或
|
|
21
|
-
* pooler 用户名
|
|
21
|
+
* pooler 用户名 `<role>.<ref>`(默认 postgres,BackupDrill 免密接入建的 backupdrill_* 角色
|
|
22
|
+
* 同样走 Supavisor,租户身份只看最后一段 ref;角色名限小写字母/数字/下划线,与 Postgres 标识符
|
|
23
|
+
* 未加引号时的折叠规则一致)。放在引擎层:备份端(写 manifest.sourceProjectRef)
|
|
22
24
|
* 与恢复端(同源阻断)共用同一个身份判定。非 Supabase 形态返回 null。
|
|
23
25
|
*/
|
|
24
26
|
export function projectRefOf(connString) {
|
|
@@ -29,7 +31,7 @@ export function projectRefOf(connString) {
|
|
|
29
31
|
return direct[1];
|
|
30
32
|
// 用户名必须先解码再匹配:URL 解析器保留百分号编码,而 pg/libpq 会解码——
|
|
31
33
|
// postgres%2Eref 在驱动眼里就是 postgres.ref,不解码 = 身份判定可被编码绕过
|
|
32
|
-
const pooled = decodeURIComponent(url.username).match(/^
|
|
34
|
+
const pooled = decodeURIComponent(url.username).match(/^[a-z0-9_]+\.([a-z0-9]{16,})$/);
|
|
33
35
|
if (pooled)
|
|
34
36
|
return pooled[1];
|
|
35
37
|
return null;
|
package/package.json
CHANGED