Polyman Documentation - v3.1.0
    Preparing search index...

    Function insideProblem

    • Resolves a path from Config.json against the problem folder and refuses anything that lands outside it, so a crafted Config.json cannot make polyman read (and upload) files like ../../.ssh/id_rsa. Names that merely start with two dots, like ..notes.tex, are allowed.

      Parameters

      • problemDir: string

        Problem directory path

      • rel: string

        Path from Config.json, relative to the problem folder

      Returns string

      The absolute path, guaranteed to be inside problemDir

      If the path resolves outside the problem folder

      insideProblem('/p', 'solutions/main.cpp'); // '/p/solutions/main.cpp'
      insideProblem('/p', '../x'); // throws