From 9dae1c4052455a3147654d742eaf2f0474492e2a Mon Sep 17 00:00:00 2001 From: Nahuel Alejandro Ramos Date: Thu, 17 Aug 2023 13:19:29 -0300 Subject: [PATCH] chore: add bad reference error [gh-800] --- packages/cli/src/constructs/api-check.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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, }) }