Skip to content

Commit f1bae26

Browse files
committed
Merge branch 'dev'
2 parents dd2861b + eb225cc commit f1bae26

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.0.4 - 2021-07-09 [CRITICAL]
2+
### Fixed
3+
- Fix security vulnerability
4+
15
## 3.0.3 - 2019-11-25
26
### Fixed
37
- Fix error when first file is not `*.log` (via [@sebschaefer](https://github.com/sebschaefer))

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ether/logs",
33
"description": "Access logs from the CP",
4-
"version": "3.0.3",
4+
"version": "3.0.4",
55
"type": "craft-plugin",
66
"minimum-stability": "dev",
77
"require": {

src/Controller.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22

33
namespace ether\logs;
44

5+
use Craft;
6+
57
class Controller extends \craft\web\Controller
68
{
79

810
public function actionStream ()
911
{
10-
$logsDir = \Craft::getAlias('@storage/logs');
11-
$logFile = \Craft::$app->request->getParam('log');
12-
$currentLog = \Craft::$app->request->get('log', $logFile);
12+
$logsDir = Craft::getAlias('@storage/logs');
13+
$logFile = Craft::$app->request->getParam('log');
14+
$currentLog = basename(Craft::$app->request->get('log', $logFile));
15+
16+
if (strpos($currentLog, '.log') === false)
17+
return '<p>You can only access <code>.log</code> files!</p>';
18+
1319
$log = file_get_contents($logsDir . '/' . $currentLog);
1420

1521
exit($log);

src/templates/view.twig

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<form>
2-
<select id="__logSwitch">
3-
{% for file in logFiles %}
4-
<option{{ file == currentLog ? ' selected' }}>{{ file }}</option>
5-
{% endfor %}
6-
</select>
2+
<label class="select">
3+
<select id="__logSwitch">
4+
{% for file in logFiles %}
5+
<option{{ file == currentLog ? ' selected' }}>{{ file }}</option>
6+
{% endfor %}
7+
</select>
8+
</label>
79
</form>
810

911
<hr style="margin-bottom:0">

0 commit comments

Comments
 (0)