-
Notifications
You must be signed in to change notification settings - Fork 400
Expand file tree
/
Copy pathallowed-helpers.ts
More file actions
194 lines (175 loc) · 3.29 KB
/
allowed-helpers.ts
File metadata and controls
194 lines (175 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/**
* Explicitly allowed Handlebars helpers from the `handlebars-helpers` package.
*
* Each key is a group name (matching `handlebars-helpers/lib/<group>`),
* and the value is the list of helper names to register from that group.
*
* To disallow a helper, remove it from the array.
* To disallow an entire group, remove or comment out the entry.
* Groups not listed here are never loaded.
*/
export const ALLOWED_HELPERS: Record<string, string[]> = {
// --- array ---
array: [
"after",
"arrayify",
"before",
"eachIndex",
"filter",
"first",
"forEach",
"inArray",
"isArray",
"itemAt",
"join",
"equalsLength",
"last",
"length",
"map",
"pluck",
"reverse",
"some",
"sort",
"sortBy",
"withAfter",
"withBefore",
"withFirst",
"withGroup",
"withLast",
"withSort",
"unique",
],
// --- code (embed removed) ---
code: ["gist", "jsfiddle"],
// --- collection ---
collection: ["isEmpty", "iterate"],
// --- comparison ---
comparison: [
"and",
"compare",
"contains",
"default",
"eq",
"gt",
"gte",
"has",
"isFalsey",
"isTruthy",
"ifEven",
"ifNth",
"ifOdd",
"is",
"isnt",
"lt",
"lte",
"neither",
"not",
"or",
"unlessEq",
"unlessGt",
"unlessLt",
"unlessGteq",
"unlessLteq",
],
// --- date ---
date: ["year", "moment", "date"],
// --- fs: removed entirely ---
// --- html ---
html: ["attr", "css", "js", "sanitize", "ul", "ol", "thumbnailImage"],
// --- i18n ---
i18n: ["i18n"],
// --- inflection ---
inflection: ["inflect", "ordinalize"],
// --- logging: removed entirely ---
// --- markdown: removed entirely ---
// --- match: removed entirely ---
// --- math ---
math: [
"abs",
"add",
"avg",
"ceil",
"divide",
"floor",
"minus",
"modulo",
"multiply",
"plus",
"random",
"remainder",
"round",
"subtract",
"sum",
"times",
],
// --- misc ---
misc: ["option", "noop", "withHash"],
// --- number ---
number: [
"bytes",
"addCommas",
"phoneNumber",
"toAbbr",
"toExponential",
"toFixed",
"toFloat",
"toInt",
"toPrecision",
],
// --- object (extend, merge removed – prototype pollution risk) ---
object: ["JSONparse"],
// --- path (resolve removed) ---
path: ["absolute", "dirname", "relative", "basename", "stem", "extname", "segments"],
// --- regex ---
regex: ["toRegex", "test"],
// --- string ---
string: [
"append",
"camelcase",
"capitalize",
"capitalizeAll",
"center",
"chop",
"dashcase",
"dotcase",
"downcase",
"ellipsis",
"hyphenate",
"isString",
"lowercase",
"occurrences",
"pascalcase",
"pathcase",
"plusify",
"prepend",
"raw",
"remove",
"removeFirst",
"replace",
"replaceFirst",
"sentence",
"snakecase",
"split",
"startsWith",
"titleize",
"trim",
"trimLeft",
"trimRight",
"truncate",
"truncateWords",
"upcase",
"uppercase",
],
// --- url ---
url: [
"encodeURI",
"escape",
"decodeURI",
"url_encode",
"url_decode",
"urlResolve",
"urlParse",
"stripQuerystring",
"stripProtocol",
],
};