Passed
Push — master ( 198b41...933826 )
by Julius
14:31 queued 13s
created

ContentSecurityPolicy::setStrictDynamicAllowed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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