1 | <?php |
||
5 | class NeverAllowed extends Resources |
||
6 | { |
||
7 | |||
8 | private $_never_allowed_reg_ex = [ |
||
9 | |||
10 | // default javascript |
||
11 | '(\(?document\)?|\(?window\)?(\.document)?)\.(location|on\w*)', |
||
12 | // data-attribute + base64 |
||
13 | "([\"'])?data\s*:[^\\1]*?base64[^\\1]*?,[^\\1]*?\\1?", |
||
14 | // remove Netscape 4 JS entities |
||
15 | '&\s*\{[^}]*(\}\s*;?|$)', |
||
16 | // old IE, old Netscape |
||
17 | 'expression\s*(\(|&\#40;)', |
||
18 | ]; |
||
19 | |||
20 | private $_never_allowed_on_events_afterwards = [ |
||
21 | 'onAbort', |
||
22 | 'onActivate', |
||
23 | 'onAttribute', |
||
24 | 'onAfterPrint', |
||
25 | 'onAfterScriptExecute', |
||
26 | 'onAfterUpdate', |
||
27 | 'onAnimationCancel', |
||
28 | 'onAnimationEnd', |
||
29 | 'onAnimationIteration', |
||
30 | 'onAnimationStart', |
||
31 | 'onAriaRequest', |
||
32 | 'onAutoComplete', |
||
33 | 'onAutoCompleteError', |
||
34 | 'onAuxClick', |
||
35 | 'onBeforeActivate', |
||
36 | 'onBeforeCopy', |
||
37 | 'onBeforeCut', |
||
38 | 'onBeforeDeactivate', |
||
39 | 'onBeforeEditFocus', |
||
40 | 'onBeforePaste', |
||
41 | 'onBeforePrint', |
||
42 | 'onBeforeScriptExecute', |
||
43 | 'onBeforeUnload', |
||
44 | 'onBeforeUpdate', |
||
45 | 'onBegin', |
||
46 | 'onBlur', |
||
47 | 'onBounce', |
||
48 | 'onCancel', |
||
49 | 'onCanPlay', |
||
50 | 'onCanPlayThrough', |
||
51 | 'onCellChange', |
||
52 | 'onChange', |
||
53 | 'onClick', |
||
54 | 'onClose', |
||
55 | 'onCommand', |
||
56 | 'onCompassNeedsCalibration', |
||
57 | 'onContextMenu', |
||
58 | 'onControlSelect', |
||
59 | 'onCopy', |
||
60 | 'onCueChange', |
||
61 | 'onCut', |
||
62 | 'onDataAvailable', |
||
63 | 'onDataSetChanged', |
||
64 | 'onDataSetComplete', |
||
65 | 'onDblClick', |
||
66 | 'onDeactivate', |
||
67 | 'onDeviceLight', |
||
68 | 'onDeviceMotion', |
||
69 | 'onDeviceOrientation', |
||
70 | 'onDeviceProximity', |
||
71 | 'onDrag', |
||
72 | 'onDragDrop', |
||
73 | 'onDragEnd', |
||
74 | 'onDragEnter', |
||
75 | 'onDragLeave', |
||
76 | 'onDragOver', |
||
77 | 'onDragStart', |
||
78 | 'onDrop', |
||
79 | 'onDurationChange', |
||
80 | 'onEmptied', |
||
81 | 'onEnd', |
||
82 | 'onEnded', |
||
83 | 'onError', |
||
84 | 'onErrorUpdate', |
||
85 | 'onExit', |
||
86 | 'onFilterChange', |
||
87 | 'onFinish', |
||
88 | 'onFocus', |
||
89 | 'onFocusIn', |
||
90 | 'onFocusOut', |
||
91 | 'onFormChange', |
||
92 | 'onFormInput', |
||
93 | 'onFullScreenChange', |
||
94 | 'onFullScreenError', |
||
95 | 'onGotPointerCapture', |
||
96 | 'onHashChange', |
||
97 | 'onHelp', |
||
98 | 'onInput', |
||
99 | 'onInvalid', |
||
100 | 'onKeyDown', |
||
101 | 'onKeyPress', |
||
102 | 'onKeyUp', |
||
103 | 'onLanguageChange', |
||
104 | 'onLayoutComplete', |
||
105 | 'onLoad', |
||
106 | 'onLoadedData', |
||
107 | 'onLoadedMetaData', |
||
108 | 'onLoadStart', |
||
109 | 'onLoseCapture', |
||
110 | 'onLostPointerCapture', |
||
111 | 'onMediaComplete', |
||
112 | 'onMediaError', |
||
113 | 'onMessage', |
||
114 | 'onMouseDown', |
||
115 | 'onMouseEnter', |
||
116 | 'onMouseLeave', |
||
117 | 'onMouseMove', |
||
118 | 'onMouseOut', |
||
119 | 'onMouseOver', |
||
120 | 'onMouseUp', |
||
121 | 'onMouseWheel', |
||
122 | 'onMove', |
||
123 | 'onMoveEnd', |
||
124 | 'onMoveStart', |
||
125 | 'onMozFullScreenChange', |
||
126 | 'onMozFullScreenError', |
||
127 | 'onMozPointerLockChange', |
||
128 | 'onMozPointerLockError', |
||
129 | 'onMsContentZoom', |
||
130 | 'onMsFullScreenChange', |
||
131 | 'onMsFullScreenError', |
||
132 | 'onMsGestureChange', |
||
133 | 'onMsGestureDoubleTap', |
||
134 | 'onMsGestureEnd', |
||
135 | 'onMsGestureHold', |
||
136 | 'onMsGestureStart', |
||
137 | 'onMsGestureTap', |
||
138 | 'onMsGotPointerCapture', |
||
139 | 'onMsInertiaStart', |
||
140 | 'onMsLostPointerCapture', |
||
141 | 'onMsManipulationStateChanged', |
||
142 | 'onMsPointerCancel', |
||
143 | 'onMsPointerDown', |
||
144 | 'onMsPointerEnter', |
||
145 | 'onMsPointerLeave', |
||
146 | 'onMsPointerMove', |
||
147 | 'onMsPointerOut', |
||
148 | 'onMsPointerOver', |
||
149 | 'onMsPointerUp', |
||
150 | 'onMsSiteModeJumpListItemRemoved', |
||
151 | 'onMsThumbnailClick', |
||
152 | 'onOffline', |
||
153 | 'onOnline', |
||
154 | 'onOutOfSync', |
||
155 | 'onPage', |
||
156 | 'onPageHide', |
||
157 | 'onPageShow', |
||
158 | 'onPaste', |
||
159 | 'onPause', |
||
160 | 'onPlay', |
||
161 | 'onPlaying', |
||
162 | 'onPointerCancel', |
||
163 | 'onPointerDown', |
||
164 | 'onPointerEnter', |
||
165 | 'onPointerLeave', |
||
166 | 'onPointerLockChange', |
||
167 | 'onPointerLockError', |
||
168 | 'onPointerMove', |
||
169 | 'onPointerOut', |
||
170 | 'onPointerOver', |
||
171 | 'onPointerUp', |
||
172 | 'onPopState', |
||
173 | 'onProgress', |
||
174 | 'onPropertyChange', |
||
175 | 'onRateChange', |
||
176 | 'onReadyStateChange', |
||
177 | 'onReceived', |
||
178 | 'onRepeat', |
||
179 | 'onReset', |
||
180 | 'onResize', |
||
181 | 'onResizeEnd', |
||
182 | 'onResizeStart', |
||
183 | 'onResume', |
||
184 | 'onReverse', |
||
185 | 'onRowDelete', |
||
186 | 'onRowEnter', |
||
187 | 'onRowExit', |
||
188 | 'onRowInserted', |
||
189 | 'onRowsDelete', |
||
190 | 'onRowsEnter', |
||
191 | 'onRowsExit', |
||
192 | 'onRowsInserted', |
||
193 | 'onScroll', |
||
194 | 'onSearch', |
||
195 | 'onSeek', |
||
196 | 'onSeeked', |
||
197 | 'onSeeking', |
||
198 | 'onSelect', |
||
199 | 'onSelectionChange', |
||
200 | 'onSelectStart', |
||
201 | 'onStalled', |
||
202 | 'onStorage', |
||
203 | 'onStorageCommit', |
||
204 | 'onStart', |
||
205 | 'onStop', |
||
206 | 'onShow', |
||
207 | 'onSyncRestored', |
||
208 | 'onSubmit', |
||
209 | 'onSuspend', |
||
210 | 'onSynchRestored', |
||
211 | 'onTimeError', |
||
212 | 'onTimeUpdate', |
||
213 | 'onTrackChange', |
||
214 | 'onTransitionEnd', |
||
215 | 'onToggle', |
||
216 | 'onTouchCancel', |
||
217 | 'onTouchStart', |
||
218 | 'onTransitionCancel', |
||
219 | 'onTransitionEnd', |
||
220 | 'onUnload', |
||
221 | 'onURLFlip', |
||
222 | 'onUserProximity', |
||
223 | 'onVolumeChange', |
||
224 | 'onWaiting', |
||
225 | 'onWebKitAnimationEnd', |
||
226 | 'onWebKitAnimationIteration', |
||
227 | 'onWebKitAnimationStart', |
||
228 | 'onWebKitFullScreenChange', |
||
229 | 'onWebKitFullScreenError', |
||
230 | 'onWebKitTransitionEnd', |
||
231 | 'onWheel', |
||
232 | ]; |
||
233 | |||
234 | private $_never_allowed_str_afterwards = [ |
||
235 | 'FSCOMMAND', |
||
236 | '<script>', |
||
237 | '</script>', |
||
238 | ]; |
||
239 | |||
240 | private $_never_allowed_call_statements = [ |
||
241 | // default javascript |
||
242 | 'javascript', |
||
243 | // Java: jar-protocol is an XSS hazard |
||
244 | 'jar', |
||
245 | // Mac (will not run the script, but open it in AppleScript Editor) |
||
246 | 'applescript', |
||
247 | // IE: https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#VBscript_in_an_image |
||
248 | 'vbscript', |
||
249 | 'vbs', |
||
250 | // IE, surprise! |
||
251 | 'wscript', |
||
252 | // IE |
||
253 | 'jscript', |
||
254 | // https://html5sec.org/#behavior |
||
255 | 'behavior', |
||
256 | // old Netscape |
||
257 | 'mocha', |
||
258 | // old Netscape |
||
259 | 'livescript', |
||
260 | // default view source |
||
261 | 'view-source', |
||
262 | ]; |
||
263 | |||
264 | 6 | public function doNeverAllowedAfterwards($str) |
|
293 | |||
294 | 6 | public function doNeverAllowed($str) |
|
331 | |||
332 | 6 | private function neverAllowedStrings() |
|
353 | } |
This check marks property names that have not been written in camelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes
databaseConnectionString
.