Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions assistant/src/__tests__/checker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,25 @@ describe("Permission Checker", () => {
});
expect(risk).toBe(RiskLevel.High);
});

test("file_read of legacy signing key is high risk even when BASE_DATA_DIR relocates getProtectedDir()", async () => {
const savedBaseDataDir = process.env.BASE_DATA_DIR;
process.env.BASE_DATA_DIR = "/tmp/fake-instance-signing-key-test";
try {
const risk = await classifyRisk("file_read", {
path: join(
homedir(),
".vellum",
"protected",
"actor-token-signing-key",
),
});
expect(risk).toBe(RiskLevel.High);
} finally {
if (savedBaseDataDir === undefined) delete process.env.BASE_DATA_DIR;
else process.env.BASE_DATA_DIR = savedBaseDataDir;
}
});
});

// file_write is always low (sandboxed)
Expand Down
16 changes: 11 additions & 5 deletions assistant/src/permissions/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -966,11 +966,17 @@ function isActorTokenSigningKeyPath(
if (!filePath) return false;
const cwd = workingDir ?? process.cwd();
const resolvedPath = resolve(cwd, filePath);
const signingKeyPaths = [
join(getProtectedDir(), "actor-token-signing-key"),
join(getDeprecatedDir(), "actor-token-signing-key"),
resolve(cwd, "deprecated", "actor-token-signing-key"),
];
// Include both the per-instance protected dir AND the legacy global
// ~/.vellum/protected path so upgraded machines with a host-wide signing
// key still classify reads as High risk.
const signingKeyPaths = Array.from(
new Set([
join(homedir(), ".vellum", "protected", "actor-token-signing-key"),
join(getProtectedDir(), "actor-token-signing-key"),
join(getDeprecatedDir(), "actor-token-signing-key"),
resolve(cwd, "deprecated", "actor-token-signing-key"),
]),
);
return signingKeyPaths.includes(resolvedPath);
}

Expand Down
Loading