diff --git a/packages/cli/src/constructs/api-check.ts b/packages/cli/src/constructs/api-check.ts index dd67bec2..77e21ca9 100644 --- a/packages/cli/src/constructs/api-check.ts +++ b/packages/cli/src/constructs/api-check.ts @@ -356,8 +356,12 @@ export class ApiCheck extends Check { const deps: ScriptDependency[] = [] for (const { filePath, content } of parsed.dependencies) { + const relativePath = pathToPosix(path.relative(Session.basePath!, filePath)) + if (relativePath.startsWith('..')) { + throw new Error(`You cannot reference a dependency file above the Checkly config location folder. Please, modify "${relativePath}" path.`) + } deps.push({ - path: pathToPosix(path.relative(Session.basePath!, filePath)), + path: relativePath, content, }) }