Commit 5c84b76
committed
Switch from SpiderMonkey 1.7 to Duktape
pacparser currently vendors SpiderMonkey 1.7, a JavaScript engine that
predates the Obama presidency. There's been a ton of changes to
JavaScript and best practices when it comes to security and
portability, so using this old version of SM doesn't make sense anymore.
People are [trivially able to write exploits][ancientmonkey] against
this old version, and seeing as PAC files could come from untrusted
networks, that doesn't seem like a wise decision.
To replace it, I've used duktape, a popular compact and embeddable JS
runtime. There are a lot, but duktape seems popular; for example, polkit
switched from (newer) SpiderMonkey to duktape. The only change I've
needed to make to JS code is that RegExps don't seem to be callable
under duktape; they aren't under V8 either though, so this might have
been a Mozilla-ism.
The massively smaller codebase of duktape is hopefully better security
and maintainability wise, but also results in much smaller binaries. For
example, pactester goes from 1.5M to 687K on my system.
Passes unit tests on macOS. Not tested on Linux/Windows yet. However,
I'm not certain about i.e. string lifetimes with duktape. They didn't
seem clear with SpiderMonkey either though; perhaps it'd be an
opportunity to i.e. explicitly strdup them?
[ancientmonkey]: https://blog.pspaul.de/posts/ancient-monkey-pwning-a-17-year-old-version-of-spidermonkey/1 parent c4ac28b commit 5c84b76
File tree
165 files changed
+105939
-119116
lines changed- src
- pymod
- spidermonkey
- js
- src
- config
- CVS
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
165 files changed
+105939
-119116
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | 81 | | |
85 | 82 | | |
86 | 83 | | |
| |||
92 | 89 | | |
93 | 90 | | |
94 | 91 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
101 | 95 | | |
102 | | - | |
| 96 | + | |
103 | 97 | | |
104 | 98 | | |
105 | 99 | | |
106 | | - | |
107 | | - | |
| 100 | + | |
| 101 | + | |
108 | 102 | | |
109 | | - | |
110 | | - | |
111 | | - | |
| 103 | + | |
| 104 | + | |
112 | 105 | | |
113 | 106 | | |
114 | 107 | | |
| |||
149 | 142 | | |
150 | 143 | | |
151 | 144 | | |
152 | | - | |
| 145 | + | |
153 | 146 | | |
154 | 147 | | |
155 | 148 | | |
156 | | - | |
| 149 | + | |
157 | 150 | | |
158 | 151 | | |
159 | 152 | | |
| |||
165 | 158 | | |
166 | 159 | | |
167 | 160 | | |
168 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
| 53 | + | |
| 54 | + | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
| 101 | + | |
103 | 102 | | |
104 | 103 | | |
0 commit comments