Skip to content
Open
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
14 changes: 10 additions & 4 deletions src/lib/task-origin-validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ export async function buildAndValidateSignature(options: TaskOriginVerifyOptions

// Validate paths are within the allowed directory if specified
if (allowedDir) {
assertWithinDir(taskFolderPath, allowedDir);
assertWithinDir(signatureFile, allowedDir);
const resolvedTaskFolderPath = await fs.realpath(taskFolderPath);
const resolvedSignatureFile = await fs.realpath(signatureFile);

assertWithinDir(resolvedTaskFolderPath, allowedDir);
assertWithinDir(resolvedSignatureFile, allowedDir);
}

// Extract the bundle containing both the signature and certificate chain
Expand Down Expand Up @@ -254,8 +257,11 @@ export async function verifyTaskOrigin(options: TaskOriginVerifyOptions): Promis

// Validate paths are within the allowed directory if specified
if (allowedDir) {
assertWithinDir(taskFolderPath, allowedDir);
assertWithinDir(signatureFile, allowedDir);
const resolvedTaskFolderPath = await fs.realpath(taskFolderPath);
const resolvedSignatureFile = await fs.realpath(signatureFile);

assertWithinDir(resolvedTaskFolderPath, allowedDir);
assertWithinDir(resolvedSignatureFile, allowedDir);
}

// Make sure that the task folder path and signature file exist
Expand Down