karakun / OpenWebStart

Run Web Start based applications after the release of Java 11
https://openwebstart.com
Other
417 stars 48 forks source link

PAC File interpretation of shExpMatch return wrong results #571

Open JGRSAGA opened 7 months ago

JGRSAGA commented 7 months ago

We are running into issues with PAC Files that uses the shExpMatch Function and uses the Brackets '(' as the first character in the expression. If we use "shExpMatch(host,"(.example.com|example.com)") the result of a test against "my host.example.com" as the host will return "false" even if all other PAC-File checkers are return true. The reason is, that the expression resulting from the shExpMatch Function will use the first '(' as a Literal and escape this with (. The result will then be ^(..example.com|example.com)$

As a quick workaround I tested // If Expression starts with '(', remove leading and trailing Brackets

    if (shExp[0] === "(") {
        shExp = shExp.substring(1,shExp.length-1);
    }

which seems to work as expected.