aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Security/CSP/ContentSecurityPolicy.php
blob: 890251db0407e11a479482a984cf1f9194c8c842 (plain)
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
<?php

declare(strict_types=1);
/**
 * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
 * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
 * SPDX-License-Identifier: AGPL-3.0-only
 */
namespace OC\Security\CSP;

/**
 * Class ContentSecurityPolicy extends the public class and adds getter and setters.
 * This is necessary since we don't want to expose the setters and getters to the
 * public API.
 *
 * @package OC\Security\CSP
 */
class ContentSecurityPolicy extends \OCP\AppFramework\Http\ContentSecurityPolicy {
	public function isInlineScriptAllowed(): bool {
		return $this->inlineScriptAllowed;
	}

	public function setInlineScriptAllowed(bool $inlineScriptAllowed): void {
		$this->inlineScriptAllowed = $inlineScriptAllowed;
	}

	public function isEvalScriptAllowed(): bool {
		return $this->evalScriptAllowed;
	}

	/**
	 * @deprecated 17.0.0 Unsafe eval should not be used anymore.
	 */
	public function setEvalScriptAllowed(bool $evalScriptAllowed): void {
		$this->evalScriptAllowed = $evalScriptAllowed;
	}

	public function isEvalWasmAllowed(): ?bool {
		return $this->evalWasmAllowed;
	}

	public function setEvalWasmAllowed(bool $evalWasmAllowed): void {
		$this->evalWasmAllowed = $evalWasmAllowed;
	}

	public function getAllowedScriptDomains(): array {
		return $this->allowedScriptDomains;
	}

	public function setAllowedScriptDomains(array $allowedScriptDomains): void {
		$this->allowedScriptDomains = $allowedScriptDomains;
	}

	public function isInlineStyleAllowed(): bool {
		return $this->inlineStyleAllowed;
	}

	public function setInlineStyleAllowed(bool $inlineStyleAllowed): void {
		$this->inlineStyleAllowed = $inlineStyleAllowed;
	}

	public function getAllowedStyleDomains(): array {
		return $this->allowedStyleDomains;
	}

	public function setAllowedStyleDomains(array $allowedStyleDomains): void {
		$this->allowedStyleDomains = $allowedStyleDomains;
	}

	public function getAllowedImageDomains(): array {
		return $this->allowedImageDomains;
	}

	public function setAllowedImageDomains(array $allowedImageDomains): void {
		$this->allowedImageDomains = $allowedImageDomains;
	}

	public function getAllowedConnectDomains(): array {
		return $this->allowedConnectDomains;
	}

	public function setAllowedConnectDomains(array $allowedConnectDomains): void {
		$this->allowedConnectDomains = $allowedConnectDomains;
	}

	public function getAllowedMediaDomains(): array {
		return $this->allowedMediaDomains;
	}

	public function setAllowedMediaDomains(array $allowedMediaDomains): void {
		$this->allowedMediaDomains = $allowedMediaDomains;
	}

	public function getAllowedObjectDomains(): array {
		return $this->allowedObjectDomains;
	}

	public function setAllowedObjectDomains(array $allowedObjectDomains): void {
		$this->allowedObjectDomains = $allowedObjectDomains;
	}

	public function getAllowedFrameDomains(): array {
		return $this->allowedFrameDomains;
	}

	public function setAllowedFrameDomains(array $allowedFrameDomains): void {
		$this->allowedFrameDomains = $allowedFrameDomains;
	}

	public function getAllowedFontDomains(): array {
		return $this->allowedFontDomains;
	}

	public function setAllowedFontDomains($allowedFontDomains): void {
		$this->allowedFontDomains = $allowedFontDomains;
	}

	/**
	 * @deprecated 15.0.0 use FrameDomains and WorkerSrcDomains
	 */
	public function getAllowedChildSrcDomains(): array {
		return $this->allowedChildSrcDomains;
	}

	/**
	 * @param array $allowedChildSrcDomains
	 * @deprecated 15.0.0 use FrameDomains and WorkerSrcDomains
	 */
	public function setAllowedChildSrcDomains($allowedChildSrcDomains): void {
		$this->allowedChildSrcDomains = $allowedChildSrcDomains;
	}

	public function getAllowedFrameAncestors(): array {
		return $this->allowedFrameAncestors;
	}

	/**
	 * @param array $allowedFrameAncestors
	 */
	public function setAllowedFrameAncestors($allowedFrameAncestors): void {
		$this->allowedFrameAncestors = $allowedFrameAncestors;
	}

	public function getAllowedWorkerSrcDomains(): array {
		return $this->allowedWorkerSrcDomains;
	}

	public function setAllowedWorkerSrcDomains(array $allowedWorkerSrcDomains): void {
		$this->allowedWorkerSrcDomains = $allowedWorkerSrcDomains;
	}

	public function getAllowedFormActionDomains(): array {
		return $this->allowedFormActionDomains;
	}

	public function setAllowedFormActionDomains(array $allowedFormActionDomains): void {
		$this->allowedFormActionDomains = $allowedFormActionDomains;
	}


	public function getReportTo(): array {
		return $this->reportTo;
	}

	public function setReportTo(array $reportTo): void {
		$this->reportTo = $reportTo;
	}

	public function isStrictDynamicAllowed(): bool {
		return $this->strictDynamicAllowed;
	}

	public function setStrictDynamicAllowed(bool $strictDynamicAllowed): void {
		$this->strictDynamicAllowed = $strictDynamicAllowed;
	}

	public function isStrictDynamicAllowedOnScripts(): bool {
		return $this->strictDynamicAllowedOnScripts;
	}

	public function setStrictDynamicAllowedOnScripts(bool $strictDynamicAllowedOnScripts): void {
		$this->strictDynamicAllowedOnScripts = $strictDynamicAllowedOnScripts;
	}
}