From 54afdb04eebfc9153816ae95e990f950ea56b7f1 Mon Sep 17 00:00:00 2001 From: Shahar Yakir Date: Tue, 12 Mar 2024 10:06:41 +0000 Subject: [PATCH] fixed injection --- src/source-verifier/func-source-verifier.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/source-verifier/func-source-verifier.ts b/src/source-verifier/func-source-verifier.ts index a3f76f7..dee0f61 100644 --- a/src/source-verifier/func-source-verifier.ts +++ b/src/source-verifier/func-source-verifier.ts @@ -14,6 +14,9 @@ import { fiftToCodeCell } from "./fift-source-verifier"; import { FuncCompilerVersion } from "@ton-community/contract-verifier-sdk"; import { binaryPath } from "../binaries"; +const semverRegex = () => + /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-(0|[1-9A-Za-z-][0-9A-Za-z-]*)(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/; + function prepareFuncCommand( executable: string, funcArgs: string, @@ -40,6 +43,10 @@ async function compileFuncToCodeHash( commandLine: string, tmpDir: string, ) { + if (!semverRegex().test(funcVersion)) { + throw new Error(`Invalid func version: ${funcVersion}`); + } + const fiftOutFile = "output.fif"; const executable = path.join(process.cwd(), binaryPath, funcVersion, "func"); const funcCmd = prepareFuncCommand(executable, funcArgs, fiftOutFile, commandLine);