mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-06 01:13:44 +02:00
* fix(secrets): scope message runtime resolution and harden doctor/status * docs: align message/doctor/status SecretRef behavior notes * test(cli): accept scoped targetIds wiring in secret-resolution coverage * fix(secrets): keep scoped allowedPaths isolation and tighten coverage gate * fix(secrets): avoid default-account coercion in scoped target selection * test(doctor): cover inactive telegram secretref inspect path * docs Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com> * changelog Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com> --------- Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com>
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import fs from "node:fs/promises";
|
|
import path from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const SECRET_TARGET_CALLSITES = [
|
|
"src/cli/memory-cli.ts",
|
|
"src/cli/qr-cli.ts",
|
|
"src/commands/agent.ts",
|
|
"src/commands/channels/resolve.ts",
|
|
"src/commands/channels/shared.ts",
|
|
"src/commands/message.ts",
|
|
"src/commands/models/load-config.ts",
|
|
"src/commands/status-all.ts",
|
|
"src/commands/status.scan.ts",
|
|
] as const;
|
|
|
|
function hasSupportedTargetIdsWiring(source: string): boolean {
|
|
return (
|
|
/targetIds:\s*get[A-Za-z0-9_]+\(\)/m.test(source) ||
|
|
/targetIds:\s*scopedTargets\.targetIds/m.test(source)
|
|
);
|
|
}
|
|
|
|
describe("command secret resolution coverage", () => {
|
|
it.each(SECRET_TARGET_CALLSITES)(
|
|
"routes target-id command path through shared gateway resolver: %s",
|
|
async (relativePath) => {
|
|
const absolutePath = path.join(process.cwd(), relativePath);
|
|
const source = await fs.readFile(absolutePath, "utf8");
|
|
expect(source).toContain("resolveCommandSecretRefsViaGateway");
|
|
expect(hasSupportedTargetIdsWiring(source)).toBe(true);
|
|
expect(source).toContain("resolveCommandSecretRefsViaGateway({");
|
|
},
|
|
);
|
|
});
|