8000 Error "entrypoint must be inside the project root" · Issue #82 · frida/frida-compile · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Error "entrypoint must be inside the project root" #82
Open
@federicodotta

Description

@federicodotta

Hi,

First of all, as usual, thanks for your great work.

I use frida-compile in a tool I wrote. Unfortunately, last versions of frida-compile raise the exception "entrypoint must be inside the project root".

I looked in the code and I found the cause. My tool does not compile the JS files from their folder, but from an external folder using the absolute path of frida compile, of the input JS file and of the output JS file (example: ""/ABS_PATH/frida-compile" -o "/ABS_PATH/output.js" "/ABS_PATH/input.js""). In the recent versions of frida-compile there is the a check that throws an error if "endpoint" does not starts with "projectRoot", but "projectRoot" is derived from the current working directory and causes my issue.

The code I mentioned is the following one:

cli.ts (lines 21-22)

    const projectRoot: string = process.cwd();
    const entrypoint: string = program.args[0];

compiler.ts (lines 214-228)

function deriveEntrypoint(options: Options): EntrypointName {
    const { projectRoot, entrypoint } = options;

    const input = crosspath.isAbsolute(entrypoint) ? entrypoint : crosspath.join(projectRoot, entrypoint);
    if (!input.startsWith(projectRoot)) {
        throw new Error("entrypoint must be inside the project root");
    }

    let output = input.substring(projectRoot.length);
    if (output.endsWith(".ts")) {
        output = output.substring(0, output.length - 2) + "js";
    }

    return { input, output };
}

Compilation outside the project root can cause troubles with recent frida-compile versions?

Thank you.

Federico

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0