Skip to content

Commit 362a8c1

Browse files
committed
fix: apply POLICY_DIR const only for built-in policies
1 parent 865b558 commit 362a8c1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/dispatch-handler/policy.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ const builtInPolicyMapping = {
4444
*/
4545
async function readPolicyFile(policyPath: string): Promise<ArrayBuffer> {
4646
try {
47-
return await fsp.readFile(
48-
path.join(process.env.POLICY_DIR as string, policyPath)
49-
);
47+
return await fsp.readFile(policyPath);
5048
} catch (error) {
5149
_logger.error({ error }, "Failed to read policy file");
5250

@@ -106,7 +104,12 @@ export async function evaluatePolicyForRequest(
106104
if (config.POLICY === "custom") {
107105
policyFile = await readPolicyFile(config.POLICY_PATH);
108106
} else {
109-
policyFile = await readPolicyFile(builtInPolicyMapping[config.POLICY_TYPE]);
107+
policyFile = await readPolicyFile(
108+
path.join(
109+
process.env.POLICY_DIR as string,
110+
builtInPolicyMapping[config.POLICY_TYPE]
111+
)
112+
);
110113
}
111114

112115
const policy = await loadPolicy(policyFile);

0 commit comments

Comments
 (0)