1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
/** |
4
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc. |
5
|
|
|
* |
6
|
|
|
* @author Lukas Reschke <[email protected]> |
7
|
|
|
* @author Thomas Citharel <[email protected]> |
8
|
|
|
* |
9
|
|
|
* @license AGPL-3.0 |
10
|
|
|
* |
11
|
|
|
* This code is free software: you can redistribute it and/or modify |
12
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
13
|
|
|
* as published by the Free Software Foundation. |
14
|
|
|
* |
15
|
|
|
* This program is distributed in the hope that it will be useful, |
16
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18
|
|
|
* GNU Affero General Public License for more details. |
19
|
|
|
* |
20
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
21
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
22
|
|
|
* |
23
|
|
|
*/ |
24
|
|
|
namespace OC\Security\CSP; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Class ContentSecurityPolicy extends the public class and adds getter and setters. |
28
|
|
|
* This is necessary since we don't want to expose the setters and getters to the |
29
|
|
|
* public API. |
30
|
|
|
* |
31
|
|
|
* @package OC\Security\CSP |
32
|
|
|
*/ |
33
|
|
|
class ContentSecurityPolicy extends \OCP\AppFramework\Http\ContentSecurityPolicy { |
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @return boolean |
36
|
|
|
*/ |
37
|
|
|
public function isInlineScriptAllowed(): bool { |
38
|
|
|
return $this->inlineScriptAllowed; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param boolean $inlineScriptAllowed |
43
|
|
|
*/ |
44
|
|
|
public function setInlineScriptAllowed(bool $inlineScriptAllowed) { |
45
|
|
|
$this->inlineScriptAllowed = $inlineScriptAllowed; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @return boolean |
50
|
|
|
*/ |
51
|
|
|
public function isEvalScriptAllowed(): bool { |
52
|
|
|
return $this->evalScriptAllowed; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @param boolean $evalScriptAllowed |
57
|
|
|
*/ |
58
|
|
|
public function setEvalScriptAllowed(bool $evalScriptAllowed) { |
59
|
|
|
$this->evalScriptAllowed = $evalScriptAllowed; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return array |
64
|
|
|
*/ |
65
|
|
|
public function getAllowedScriptDomains(): array { |
66
|
|
|
return $this->allowedScriptDomains; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @param array $allowedScriptDomains |
71
|
|
|
*/ |
72
|
|
|
public function setAllowedScriptDomains(array $allowedScriptDomains) { |
73
|
|
|
$this->allowedScriptDomains = $allowedScriptDomains; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return boolean |
78
|
|
|
*/ |
79
|
|
|
public function isInlineStyleAllowed(): bool { |
80
|
|
|
return $this->inlineStyleAllowed; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @param boolean $inlineStyleAllowed |
85
|
|
|
*/ |
86
|
|
|
public function setInlineStyleAllowed(bool $inlineStyleAllowed) { |
87
|
|
|
$this->inlineStyleAllowed = $inlineStyleAllowed; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return array |
92
|
|
|
*/ |
93
|
|
|
public function getAllowedStyleDomains(): array { |
94
|
|
|
return $this->allowedStyleDomains; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @param array $allowedStyleDomains |
99
|
|
|
*/ |
100
|
|
|
public function setAllowedStyleDomains(array $allowedStyleDomains) { |
101
|
|
|
$this->allowedStyleDomains = $allowedStyleDomains; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @return array |
106
|
|
|
*/ |
107
|
|
|
public function getAllowedImageDomains(): array { |
108
|
|
|
return $this->allowedImageDomains; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @param array $allowedImageDomains |
113
|
|
|
*/ |
114
|
|
|
public function setAllowedImageDomains(array $allowedImageDomains) { |
115
|
|
|
$this->allowedImageDomains = $allowedImageDomains; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return array |
120
|
|
|
*/ |
121
|
|
|
public function getAllowedConnectDomains(): array { |
122
|
|
|
return $this->allowedConnectDomains; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @param array $allowedConnectDomains |
127
|
|
|
*/ |
128
|
|
|
public function setAllowedConnectDomains(array $allowedConnectDomains) { |
129
|
|
|
$this->allowedConnectDomains = $allowedConnectDomains; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @return array |
134
|
|
|
*/ |
135
|
|
|
public function getAllowedMediaDomains(): array { |
136
|
|
|
return $this->allowedMediaDomains; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @param array $allowedMediaDomains |
141
|
|
|
*/ |
142
|
|
|
public function setAllowedMediaDomains(array $allowedMediaDomains) { |
143
|
|
|
$this->allowedMediaDomains = $allowedMediaDomains; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @return array |
148
|
|
|
*/ |
149
|
|
|
public function getAllowedObjectDomains(): array { |
150
|
|
|
return $this->allowedObjectDomains; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @param array $allowedObjectDomains |
155
|
|
|
*/ |
156
|
|
|
public function setAllowedObjectDomains(array $allowedObjectDomains) { |
157
|
|
|
$this->allowedObjectDomains = $allowedObjectDomains; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @return array |
162
|
|
|
*/ |
163
|
|
|
public function getAllowedFrameDomains(): array { |
164
|
|
|
return $this->allowedFrameDomains; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* @param array $allowedFrameDomains |
169
|
|
|
*/ |
170
|
|
|
public function setAllowedFrameDomains(array $allowedFrameDomains) { |
171
|
|
|
$this->allowedFrameDomains = $allowedFrameDomains; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @return array |
176
|
|
|
*/ |
177
|
|
|
public function getAllowedFontDomains(): array { |
178
|
|
|
return $this->allowedFontDomains; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @param array $allowedFontDomains |
183
|
|
|
*/ |
184
|
|
|
public function setAllowedFontDomains($allowedFontDomains) { |
185
|
|
|
$this->allowedFontDomains = $allowedFontDomains; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* @return array |
190
|
|
|
* @deprecated 15.0.0 use FrameDomains and WorkerSrcDomains |
191
|
|
|
*/ |
192
|
|
|
public function getAllowedChildSrcDomains(): array { |
193
|
|
|
return $this->allowedChildSrcDomains; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
/** |
197
|
|
|
* @param array $allowedChildSrcDomains |
198
|
|
|
* @deprecated 15.0.0 use FrameDomains and WorkerSrcDomains |
199
|
|
|
*/ |
200
|
|
|
public function setAllowedChildSrcDomains($allowedChildSrcDomains) { |
201
|
|
|
$this->allowedChildSrcDomains = $allowedChildSrcDomains; |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
/** |
205
|
|
|
* @return array |
206
|
|
|
*/ |
207
|
|
|
public function getAllowedFrameAncestors(): array { |
208
|
|
|
return $this->allowedFrameAncestors; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @param array $allowedFrameAncestors |
213
|
|
|
*/ |
214
|
|
|
public function setAllowedFrameAncestors($allowedFrameAncestors) { |
215
|
|
|
$this->allowedFrameAncestors = $allowedFrameAncestors; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
public function getAllowedWorkerSrcDomains(): array { |
219
|
|
|
return $this->allowedWorkerSrcDomains; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
public function setAllowedWorkerSrcDomains(array $allowedWorkerSrcDomains) { |
223
|
|
|
$this->allowedWorkerSrcDomains = $allowedWorkerSrcDomains; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
public function getReportTo(): array { |
227
|
|
|
return $this->reportTo; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
public function setReportTo(array $reportTo) { |
231
|
|
|
$this->reportTo = $reportTo; |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
} |
235
|
|
|
|
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.