Issues (69)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

templates/settings.personal.php (1 issue)

1
<?php
2
/**
3
 * CMS Pico - Create websites using Pico CMS for Nextcloud.
4
 *
5
 * @copyright Copyright (c) 2017, Maxence Lange (<[email protected]>)
6
 * @copyright Copyright (c) 2019, Daniel Rudolf (<[email protected]>)
7
 *
8
 * @license GNU AGPL version 3 or any later version
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU Affero General Public License as
12
 * published by the Free Software Foundation, either version 3 of the
13
 * License, or (at your option) any later version.
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
21
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
 */
23
24
use OCA\CMSPico\AppInfo\Application;
25
26
/** @var $_ array */
27
/** @var $l \OCP\IL10N */
28
script(Application::APP_NAME, [ 'pico', 'personal' ]);
0 ignored issues
show
Deprecated Code introduced by
The function script() has been deprecated: 24.0.0 - Use \OCP\Util::addScript ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

28
/** @scrutinizer ignore-deprecated */ script(Application::APP_NAME, [ 'pico', 'personal' ]);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
29
style(Application::APP_NAME, [ 'fontello', 'pico' ]);
30
31
?>
32
33
<article class="section">
34
	<h2><?php p($l->t('Pico CMS for Nextcloud')); ?></h2>
35
	<p class="settings-hint"><?php p($l->t(
36
		'Create and publish your own websites - with Pico CMS for Nextcloud!'
37
	)); ?></p>
38
39
	<div class="message large">
40
		<div class="icon icon-info-circled"></div>
41
		<div>
42
			<p><?php print_unescaped($l->t(
43
				'<a href="https://apps.nextcloud.com/apps/cms_pico">Pico CMS for Nextcloud</a> combines the power of '
44
						. '<a href="http://picocms.org/"><strong>Pico</strong></a> and Nextcloud to create simple, '
45
						. 'secure, shareable and amazingly powerful websites with just a few clicks. Pico is a '
46
						. 'stupidly simple, blazing fast, flat file CMS - making the web easy!'
47
			)); ?></p>
48
49
			<p><?php print_unescaped($l->t(
50
				'Start a blog, share your resume with the world, create a plan for world domination and only share it '
51
						. 'with the right friends or build a knowledge base and let the smart ones among your '
52
						. 'colleagues help out. Pico CMS for Nextcloud allows you to create and manage your own '
53
						. 'websites. Creating a new page with Pico is no more than creating a simple text file in your '
54
						. 'Nextcloud files. No config is required, no utterly complex management interfaces - just '
55
						. 'files. It\'s the perfect match with Nextcloud. Secure Sharing, Collaboration, Access '
56
						. 'Control - not just for your files, but also your websites, all made possible by Pico CMS '
57
						. 'for Nextcloud! Breaking the boundaries between your Mobile & Desktop devices and your '
58
						. 'Server.'
59
			)); ?></p>
60
61
			<p><?php print_unescaped($l->t(
62
				'A website consist of just a bunch of <code class="inline">.md</code> text files in your Nextcloud '
63
						. 'files. <code class="inline">.md</code> stands for <a href="https://www.markdownguide.org/">'
64
						. '<strong>Markdown</strong></a> - a super simple and intuitive markup to create headings, '
65
						. 'paragraphs, text formatting, lists, images and links. But don\'t despair - you don\'t have '
66
						. 'to learn yet another language if you don\'t want to. Try Nextcloud\'s '
67
						. '<a href="https://apps.nextcloud.com/apps/files_markdown">Markdown Editor</a> app to make '
68
						. 'easy things stupidly simple. Please note that Nextcloud\'s built-in Text editor is '
69
						. 'incompatible with Pico CMS for Nextcloud. But what about meta data like a page\'s title or '
70
						. 'release date? Guess right, it\'s all in one place. At the top of your Markdown files you '
71
						. 'can place a block with such meta data - called <a href="https://en.wikipedia.org/wiki/YAML">'
72
						. '<strong>YAML</strong></a> Front Matter. Creating websites cannot be easier…'
73
			)); ?></p>
74
75
			<p><?php print_unescaped($l->t(
76
				'You want to learn more about Pico CMS for Nextcloud? Easy! Just create your first personal website '
77
						. 'using the "sample_pico" template. Pico\'s sample contents will explain all you need to know…'
78
			)); ?></p>
79
80
			<p><?php p($l->t('You will be able to access your websites using URLs like the following:')); ?>
81
			<p class="followup indent"><a><?php p(rtrim($_['baseUrl'], '/') . '/' . $_['exampleSite']); ?></a></p>
82
		</div>
83
	</div>
84
85
	<?php if ($_['limitedUser']) { ?>
86
		<div class="message large error">
87
			<div class="icon icon-attention-circled"></div>
88
			<div>
89
				<p><?php p($l->t(
90
					'The Nextcloud admin limited access of Pico CMS for Nextcloud to certain groups. Unfortunately you '
91
							. 'don\'t have permission to create personal websites. You can still access websites of '
92
							. 'other users, possibly including private websites. If you had permission to create '
93
							. 'websites in the past, you don\'t have to worry about your data: Nothing is lost. '
94
							. 'However, nobody will be able to access your private websites and a "Website not found" '
95
							. 'error is shown instead.'
96
				)); ?></p>
97
			</div>
98
		</div>
99
	<?php } ?>
100
101
	<div id="picocms-websites" class="picocms-website-list"
102
			data-route="/apps/cms_pico/personal/websites"
103
			data-template="#picocms-websites-template"
104
			data-item-template="#picocms-websites-template-item"
105
			data-private-settings-template="#picocms-websites-template-private-settings"
106
			data-loading-template="#picocms-websites-template-loading"
107
			data-error-template="#picocms-websites-template-error"
108
			data-website-base-url="<?php p($_['baseUrl']); ?>">
109
		<div class="app-content-loading message large">
110
			<div class="icon loading"></div>
111
			<div>
112
				<p><?php p($l->t('Loading websites…')); ?></p>
113
			</div>
114
		</div>
115
	</div>
116
117
	<script id="picocms-websites-template" type="text/template"
118
			data-replaces="#picocms-websites">
119
		<table class="table">
120
			<thead>
121
				<tr>
122
					<th class="name-column"><?php p($l->t('Name')); ?></th>
123
					<th class="path-column"><?php p($l->t('Path')); ?></th>
124
					<th class="theme-column"><?php p($l->t('Theme')); ?></th>
125
					<th class="created-column"><?php p($l->t('Created')); ?></th>
126
				</tr>
127
			</thead>
128
			<tbody></tbody>
129
		</table>
130
	</script>
131
132
	<script id="picocms-websites-template-item" type="text/template"
133
			data-append-to="#picocms-websites > table > tbody">
134
		<tr>
135
			<td class="name-column">
136
				<div class="name-container">
137
					<div class="name">
138
						<p>{name}</p>
139
					</div>
140
					<div class="name-edit">
141
						<input class="input input-name" type="text" name="name"
142
							value="{name}" placeholder="{name}"
143
							minlength="<?php p($_['nameLengthMin']); ?>"
144
							maxlength="<?php p($_['nameLengthMax']); ?>" />
145
					</div>
146
					<div class="actions">
147
						<a class="action action-open has-tooltip" title="<?php p($l->t('Go to website')); ?>">
148
							<span class="icon-globe"></span>
149
							<span class="hidden-visually"><?php p($l->t('Go to website')); ?></span>
150
						</a>
151
						<a class="action action-files has-tooltip"
152
								title="<?php p($l->t('Go to website directory')); ?>">
153
							<span class="icon-folder"></span>
154
							<span class="hidden-visually"><?php p($l->t('Go to website directory')); ?></span>
155
						</a>
156
						<a class="action action-rename has-tooltip"
157
							title="<?php p($l->t('Edit website name')); ?>">
158
							<span class="icon-pencil"></span>
159
							<span class="hidden-visually"><?php p($l->t('Edit website name')); ?></span>
160
						</a>
161
						<a class="action action-private has-tooltip"
162
								title="<?php p($l->t('Edit private website settings')); ?>">
163
							<span class="icon-lock-open"></span>
164
							<span class="hidden-visually"><?php p($l->t('Edit private website settings')); ?></span>
165
						</a>
166
						<a class="action action-delete has-tooltip"
167
								title="<?php p($l->t('Delete website')); ?>">
168
							<span class="icon-trash"></span>
169
							<span class="hidden-visually"><?php p($l->t('Delete website')); ?></span>
170
						</a>
171
					</div>
172
					<div class="more">
173
						<div class="icon-ellipsis"></div>
174
						<span class="hidden-visually"><?php p($l->t('Actions')); ?></span>
175
176
						<div class="popovermenu">
177
							<ul>
178
								<li>
179
									<a class="action-open">
180
										<span class="icon-globe"></span>
181
										<span><?php p($l->t('Go to website')); ?></span>
182
									</a>
183
								</li>
184
								<li>
185
									<a class="action-files">
186
										<span class="icon-folder"></span>
187
										<span><?php p($l->t('Go to website directory')); ?></span>
188
									</a>
189
								</li>
190
								<li>
191
									<a class="action-rename">
192
										<span class="icon-pencil/span>
193
										<span><?php p($l->t('Edit website name')); ?></span>
194
									</a>
195
								</li>
196
								<li>
197
									<a class="action-private">
198
										<span class="icon-lock-open"></span>
199
										<span><?php p($l->t('Edit private website settings')); ?></span>
200
									</a>
201
								</li>
202
								<li>
203
									<span class="menuitem">
204
										<span class="icon icon-brush"></span>
205
										<select class="action-theme">
206
											<?php foreach ($_['themes'] as $themeData) { ?>
207
												<?php if ($themeData['compat']) { ?>
208
													<option value="<?php p($themeData['name']); ?>">
209
														<?php p($themeData['name']); ?>
210
													</option>
211
												<?php } ?>
212
											<?php } ?>
213
										</select>
214
									</span>
215
								</li>
216
								<li>
217
									<a class="action-delete">
218
										<span class="icon-trash"></span>
219
										<span><?php p($l->t('Delete website')); ?></span>
220
									</a>
221
								</li>
222
							</ul>
223
						</div>
224
					</div>
225
				</div>
226
			</td>
227
			<td class="path-column">
228
				<a class="action action-files has-tooltip" title="<?php p($l->t('Go to website directory')); ?>">
229
					<span class="icon-folder"></span>
230
					<span class="hidden-visually"><?php p($l->t('Go to website directory')); ?>:</span>
231
					{path}
232
				</a>
233
			</td>
234
			<td class="theme-column">
235
				<select class="action-theme">
236
					<?php foreach ($_['themes'] as $themeData) { ?>
237
						<?php if ($themeData['compat']) { ?>
238
							<option value="<?php p($themeData['name']); ?>"><?php p($themeData['name']); ?></option>
239
						<?php } ?>
240
					<?php } ?>
241
				</select>
242
			</td>
243
			<td class="created-column">
244
				<span class="live-relative-timestamp" data-timestamp="{creation}"></span>
245
			</td>
246
		</tr>
247
	</script>
248
249
	<script id="picocms-websites-template-private-settings" type="text/template">
250
		<form id="{id}" title="{title}" class="form">
251
			<p class="dialog-hint"><?php p($l->t(
252
				'Pico CMS for Nextcloud supports both public and private websites. Everyone can access public '
253
						. 'websites, no matter whether they are logged in or not. If you want to limit access to a '
254
						. 'certain subset of users, create a private website. All visitors of a private website must '
255
						. 'be logged in, otherwise a "Access forbidden" error is shown. Additionally one of the '
256
						. 'following conditions must be met: (1) the user has access to the website\'s source files '
257
						. '(i.e. the source folder is shared with the user), (2) the user is a member of one of the '
258
						. 'groups listed below, or (3) the user is a member of one of the groups specified in the '
259
						. 'YAML Front Matter of the requested page using the "access" meta value.'
260
			)); ?></p>
261
			<fieldset>
262
				<div class="label">
263
					<span><?php p($l->t('Website type')); ?></span>
264
				</div>
265
				<div class="content">
266
					<p>
267
						<input type="radio" id="picocms-websites-private-public" class="radio input-private-public"
268
								name="type" value="<?php p($_['typePublic']); ?>">
269
						<label for="picocms-websites-private-public">
270
							<?php p($l->t('Public website')); ?>
271
							<span class="note">– <?php p($l->t(
272
								'The website is publicly accessible and requires no authentication whatsoever.'
273
							)); ?></span>
274
						</label>
275
					</p>
276
					<p>
277
						<input type="radio" id="picocms-websites-private-private" class="radio input-private-private"
278
								name="type" value="<?php p($_['typePrivate']); ?>">
279
						<label for="picocms-websites-private-private">
280
							<?php p($l->t('Private website')); ?>
281
							<span class="note">– <?php p($l->t(
282
								'The website requires authentication, access is limited to a subset of all users.'
283
							)); ?></span>
284
						</label>
285
					</p>
286
				</div>
287
			</fieldset>
288
			<fieldset>
289
				<div class="label">
290
					<label class="select2-align" for="picocms-websites-private-groups">
291
						<?php p($l->t('Group access')); ?>
292
					</label>
293
				</div>
294
				<div class="content">
295
					<input type="hidden" class="input input-private-groups select2-placeholder"
296
							name="options[group_access]" value="" />
297
					<div class="message input select2-loading">
298
						<div class="icon icon-loading"></div>
299
						<div>
300
							<p><?php p($l->t('Loading groups…')); ?></p>
301
						</div>
302
					</div>
303
					<p class="note"><?php p($l->t(
304
						'Grant access to all members of the selected groups.'
305
					)); ?></p>
306
				</div>
307
			</fieldset>
308
		</form>
309
	</script>
310
311
	<script id="picocms-websites-template-loading" type="text/template"
312
			data-replaces="#picocms-websites">
313
		<div class="app-content-loading message large">
314
			<div class="icon loading"></div>
315
			<div>
316
				<p><?php p($l->t('Loading websites…')); ?></p>
317
			</div>
318
		</div>
319
	</script>
320
321
	<script id="picocms-websites-template-error" type="text/template"
322
			data-replaces="#picocms-websites">
323
		<div class="app-content-error message large">
324
			<div class="icon icon-attention-circled"></div>
325
			<div>
326
				<p><?php p($l->t(
327
					'An unexpected error occurred while performing this action. Please check Nextcloud\'s logs.'
328
				)); ?></p>
329
				<p class="error-details" style="display: none">
330
					<?php p($l->t('Error: {error}')); ?>
331
				</p>
332
				<p class="exception-details" style="display: none">
333
					<?php p($l->t('Encountered unexpected {exception}: {exceptionMessage}')); ?>
334
				</p>
335
			</div>
336
			<div class="action action-reload icon-arrows-cw has-tooltip" data-placement="left"
337
				title="<?php p($l->t('Reload websites list')); ?>">
338
				<span class="hidden-visually"><?php p($l->t('Reload websites list')); ?></span>
339
			</div>
340
		</div>
341
	</script>
342
</article>
343
344
<?php if (!$_['limitedUser']) { ?>
345
	<article class="section">
346
		<h2><?php p($l->t('Create a new website')); ?></h2>
347
		<p class="settings-hint"><?php p($l->t(
348
			'Just fill the form below to create your own personal website.'
349
		)); ?></p>
350
351
		<div id="picocms-website-form" class="picocms-website-form"
352
				data-route="/apps/cms_pico/personal/websites"
353
				data-error-template="#picocms-website-form-error">
354
			<form class="form">
355
				<fieldset>
356
					<div class="label">
357
						<label for="picocms-website-new-name"><?php p($l->t('Name')); ?></label>
358
					</div>
359
					<div class="content">
360
						<input id="picocms-website-new-name" class="input input-name" type="text" name="name" value=""
361
								placeholder="<?php p($l->t('My example website')); ?>"
362
								minlength="<?php p($_['nameLengthMin']); ?>"
363
								maxlength="<?php p($_['nameLengthMax']); ?>" />
364
						<p class="note">
365
							<?php p($l->t(
366
								'Here you can specify the name of your personal website. Your website\'s name will be '
367
										. 'used as website title, often shown in your website\'s header.'
368
							)); ?>
369
						</p>
370
						<div class="message input-error">
371
							<div class="icon icon-attention-circled"></div>
372
							<div class="input-name-error"></div>
373
						</div>
374
					</div>
375
				</fieldset>
376
377
				<fieldset>
378
					<div class="label">
379
						<label for="picocms-website-new-site"><?php p($l->t('Identifier')); ?></label>
380
					</div>
381
					<div class="content">
382
						<input id="picocms-website-new-site" class="input input-site" type="text" name="site" value=""
383
								placeholder="<?php p($_['exampleSite']); ?>"
384
								minlength="<?php p($_['siteLengthMin']); ?>"
385
								maxlength="<?php p($_['siteLengthMax']); ?>"
386
								pattern="<?php p($_['siteRegex']); ?>" />
387
						<p class="note">
388
							<?php p($l->t(
389
								'The identifier of your website prescribes both your website\'s address (URL) and the '
390
										. 'name of the directory your website\'s files (both pages and assets) will be '
391
										. 'stored in. A website\'s identifier must consist of lowercase alphanumeric '
392
										. 'characters, dashes and underscores (a-z, 0-9, - and _) only.'
393
							)); ?>
394
						</p>
395
						<div class="message input-error">
396
							<div class="icon icon-attention-circled"></div>
397
							<div class="input-site-error"></div>
398
						</div>
399
					</div>
400
				</fieldset>
401
402
				<fieldset>
403
					<div class="label">
404
						<label for="picocms-website-new-address"><?php p($l->t('Address')); ?></label>
405
					</div>
406
					<div class="content">
407
						<a id="picocms-website-new-address" class="input input-address">
408
							<?php p($_['baseUrl']); ?>
409
						</a>
410
						<p class="note">
411
							<?php p($l->t(
412
								'You will be able to access your website using the address (URL) shown above.'
413
							)); ?>
414
						</p>
415
					</div>
416
				</fieldset>
417
418
				<fieldset>
419
					<div class="label">
420
						<label for="picocms-website-new-path"><?php p($l->t('Path')); ?></label>
421
					</div>
422
					<div class="content">
423
						<input id="picocms-website-new-path" class="input input-path" type="button" name="path" value="/" />
424
						<p class="note">
425
							<?php p($l->t(
426
								'When creating a new website, Pico CMS for Nextcloud copies the website template to '
427
										. 'the following new directory in your Nextcloud.'
428
							)); ?>
429
						</p>
430
						<div class="message input-error">
431
							<div class="icon icon-attention-circled"></div>
432
							<div class="input-path-error"></div>
433
						</div>
434
					</div>
435
				</fieldset>
436
437
				<fieldset>
438
					<div class="label">
439
						<label for="picocms-website-new-theme"><?php p($l->t('Theme')); ?></label>
440
					</div>
441
					<div class="content">
442
						<select id="picocms-website-new-theme" class="input input-theme" name="theme">
443
							<?php foreach ($_['themes'] as $themeData) { ?>
444
								<?php if ($themeData['compat']) { ?>
445
									<option value="<?php p($themeData['name']); ?>"><?php p($themeData['name']); ?></option>
446
								<?php } ?>
447
							<?php } ?>
448
						</select>
449
						<p class="note">
450
							<?php p($l->t(
451
								'You can use one of the provided themes for some greater individuality and style. If '
452
										. 'you want to use another theme, ask your Nextcloud admin - it might be '
453
										. 'possible to add your favourite theme, too!'
454
							)); ?>
455
						</p>
456
						<div class="message input-error">
457
							<div class="icon icon-attention-circled"></div>
458
							<div class="input-theme-error"></div>
459
						</div>
460
					</div>
461
				</fieldset>
462
463
				<fieldset>
464
					<div class="label">
465
						<label for="picocms-website-new-template"><?php p($l->t('Template')); ?></label>
466
					</div>
467
					<div class="content">
468
						<select id="picocms-website-new-template" class="input input-template" name="template">
469
							<?php foreach ($_['templates'] as $templateData) { ?>
470
								<?php if ($templateData['compat']) { ?>
471
									<option value="<?php p($templateData['name']); ?>"><?php p($templateData['name']); ?></option>
472
								<?php } ?>
473
							<?php } ?>
474
						</select>
475
						<p class="note">
476
							<?php p($l->t(
477
								'Templates act as a starting point when creating a new website. All templates consist '
478
										. 'of a "content" directory (for your pages) and a "assets" directory (for '
479
										. 'your website\'s assets), which will be copied to the above folder in your '
480
										. 'Nextcloud.'
481
							)); ?>
482
						</p>
483
						<div class="message input-error">
484
							<div class="icon icon-attention-circled"></div>
485
							<div class="input-template-error"></div>
486
						</div>
487
					</div>
488
				</fieldset>
489
490
				<fieldset>
491
					<div class="content">
492
						<div class="message input-error">
493
							<div class="icon icon-attention-circled"></div>
494
							<div class="input-unknown-error"></div>
495
						</div>
496
497
						<input class="form-submit" type="submit"
498
								value="<?php p($l->t('Create new website')); ?>" />
499
						<button class="form-submit-loading icon-loading" disabled="disabled">
500
							<?php p($l->t('Loading…')); ?>
501
						</button>
502
					</div>
503
				</fieldset>
504
			</form>
505
		</div>
506
507
		<script id="picocms-website-form-error" type="text/template">
508
			<p><?php p($l->t(
509
				'An unexpected error occurred while performing this action. Please check Nextcloud\'s logs.'
510
			)); ?></p>
511
			<p class="error-details" style="display: none">
512
				<?php p($l->t('Error: {error}')); ?>
513
			</p>
514
			<p class="exception-details" style="display: none">
515
				<?php p($l->t('Encountered unexpected {exception}: {exceptionMessage}')); ?>
516
			</p>
517
		</script>
518
	</article>
519
<?php } ?>
520