Skip to content

Commit dd587fd

Browse files
Merge pull request #85 from getkirby/develop
1.6.0
2 parents e1d1856 + 293c50f commit dd587fd

File tree

6 files changed

+130
-70
lines changed

6 files changed

+130
-70
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
timeout-minutes: 5
1010
strategy:
1111
matrix:
12-
php: ["8.1", "8.2", "8.3"]
12+
php: ["8.1", "8.2", "8.3", "8.4"]
1313
env:
1414
extensions: mbstring, pcov
1515
ini: pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\""

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ This should print the Kirby CLI version and a list of available commands
6666
- kirby register
6767
- kirby remove:command
6868
- kirby roots
69+
- kirby security
6970
- kirby unzip
7071
- kirby upgrade
7172
- kirby uuid:generate
@@ -300,7 +301,8 @@ return [
300301
- **[Forum](https://forum.getkirby.com)** – Whenever you get stuck, don't hesitate to reach out for questions and support.
301302
- **[Discord](https://chat.getkirby.com)** – Hang out and meet the community.
302303
- **[YouTube](https://youtube.com/kirbyCasts)** - Watch the latest video tutorials visually with Bastian.
303-
- **[Mastodon](https://mastodon.social/@getkirby)** – Spread the word.
304+
- **[Mastodon](https://mastodon.social/@getkirby)** – Follow us in the Fediverse.
305+
- **[Bluesky](https://bsky.app/profile/getkirby.com)** – Follow us on Bluesky.
304306
- **[Instagram](https://www.instagram.com/getkirby/)** – Share your creations: #madewithkirby.
305307

306308
---

bootstrap.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ function bootstrap(): string|null
1212
// avoid any output in the CLI
1313
$_ENV['KIRBY_RENDER'] = false;
1414

15-
if (empty($_ENV['KIRBY_HOST']) === false) {
16-
$_SERVER['SERVER_NAME'] = $_ENV['KIRBY_HOST'];
17-
$_SERVER['HTTP_HOST'] = $_ENV['KIRBY_HOST'];
15+
if ($host = getenv('KIRBY_HOST')) {
16+
$_SERVER['SERVER_NAME'] = $host;
17+
$_SERVER['HTTP_HOST'] = $host;
1818
}
1919

2020
ob_start();

commands/security.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
use Kirby\CLI\CLI;
6+
use Kirby\Http\Remote;
7+
use Kirby\Http\Url;
8+
use Kirby\Toolkit\I18n;
9+
10+
return [
11+
'description' => 'Performs security checks of the site',
12+
'command' => static function (CLI $cli): void {
13+
$kirby = $cli->kirby();
14+
$system = $kirby->system();
15+
$updateStatus = $system->updateStatus();
16+
$messages = [
17+
...array_column($updateStatus?->messages() ?? [], 'text'),
18+
...$updateStatus->exceptionMessages()
19+
];
20+
21+
if ($kirby->option('debug', false) === true) {
22+
$messages[] = I18n::translate('system.issues.debug');
23+
}
24+
25+
if ($kirby->environment()->https() !== true) {
26+
$messages[] = I18n::translate('system.issues.https');
27+
}
28+
29+
// checks exposable urls of the site
30+
// works only site url is absolute since can't get it in CLI mode
31+
// and CURL won't work for relative urls
32+
if (Url::isAbsolute($kirby->url())) {
33+
$urls = [
34+
'content' => $system->exposedFileUrl('content'),
35+
'git' => $system->exposedFileUrl('git'),
36+
'kirby' => $system->exposedFileUrl('kirby'),
37+
'site' => $system->exposedFileUrl('site')
38+
];
39+
40+
foreach ($urls as $key => $url) {
41+
if (empty($url) === false && Remote::get($url)->code() < 400) {
42+
$messages[] = I18n::translate('system.issues.' . $key);
43+
}
44+
}
45+
} else {
46+
$messages[] = 'Could not check for exposed folders as the site URL is not absolute';
47+
}
48+
49+
if (empty($messages) === false) {
50+
foreach ($messages as $message) {
51+
$cli->error('> ' . $message);
52+
}
53+
} else {
54+
$cli->success('Basic security checks were successful, please review https://getkirby.com/docs/guide/security for additional best practices.');
55+
}
56+
}
57+
];

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "getkirby/cli",
33
"description": "Kirby command line interface",
44
"license": "MIT",
5-
"version": "1.5.0",
5+
"version": "1.6.0",
66
"keywords": [
77
"kirby",
88
"cms",
@@ -24,11 +24,11 @@
2424
"source": "https://github.com/getkirby/cli"
2525
},
2626
"require": {
27-
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
27+
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
2828
"ext-zip": "*",
2929
"composer-runtime-api": "^2.2",
30-
"guzzlehttp/guzzle": "^7.8",
31-
"league/climate": "^3.8.2"
30+
"guzzlehttp/guzzle": "^7.9.2",
31+
"league/climate": "^3.10.0"
3232
},
3333
"autoload": {
3434
"psr-4": {

0 commit comments

Comments
 (0)