harden(authority): add pre-scale diagnostics and request safety

This commit is contained in:
Youzini-afk
2026-04-28 22:28:21 +08:00
parent aa62efe5b9
commit 2dee3cd8ff
9 changed files with 644 additions and 49 deletions

View File

@@ -260,6 +260,18 @@ async function testAdapterBasics() {
assert.deepEqual(readResult.payload, { hello: "world" });
const deleteResult = await adapter.delete("user/files/demo.json");
assert.equal(deleteResult.deleted, true);
await assert.rejects(
() => adapter.writeJson("../secret.json", {}),
/Unsafe Authority Blob path/,
);
await assert.rejects(
() => adapter.readJson("user/files/%2e%2e/secret.json"),
/Unsafe Authority Blob path/,
);
await assert.rejects(
() => adapter.stat("C:/Users/demo.json"),
/Unsafe Authority Blob path/,
);
}
async function testAuthorityBlobFailOpenFallsBackToUserFiles() {