Skip to content

Commit

Permalink
Release v4.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jan 4, 2022
1 parent 3216a21 commit 65ab17d
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 8 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)

Copyright (c) 2014-2019 British Columbia Institute of Technology
Copyright (c) 2019-2021 CodeIgniter Foundation
Copyright (c) 2019-2022 CodeIgniter Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 9 additions & 3 deletions app/Config/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use CodeIgniter\Filters\CSRF;
use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\Honeypot;
use CodeIgniter\Filters\InvalidChars;
use CodeIgniter\Filters\SecureHeaders;

class Filters extends BaseConfig
{
Expand All @@ -16,9 +18,11 @@ class Filters extends BaseConfig
* @var array
*/
public $aliases = [
'csrf' => CSRF::class,
'toolbar' => DebugToolbar::class,
'honeypot' => Honeypot::class,
'csrf' => CSRF::class,
'toolbar' => DebugToolbar::class,
'honeypot' => Honeypot::class,
'invalidchars' => InvalidChars::class,
'secureheaders' => SecureHeaders::class,
];

/**
Expand All @@ -31,10 +35,12 @@ class Filters extends BaseConfig
'before' => [
// 'honeypot',
// 'csrf',
// 'invalidchars',
],
'after' => [
'toolbar',
// 'honeypot',
// 'secureheaders',
],
];

Expand Down
2 changes: 1 addition & 1 deletion app/Config/Mimes.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public static function guessExtensionFromType(string $type, ?string $proposedExt
{
$type = trim(strtolower($type), '. ');

$proposedExtension = trim(strtolower($proposedExtension));
$proposedExtension = trim(strtolower($proposedExtension ?? ''));

if ($proposedExtension !== '') {
if (array_key_exists($proposedExtension, static::$mimes) && in_array($type, is_string(static::$mimes[$proposedExtension]) ? [static::$mimes[$proposedExtension]] : static::$mimes[$proposedExtension], true)) {
Expand Down
11 changes: 11 additions & 0 deletions app/Config/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ class Security extends BaseConfig
*/
public $csrfProtection = 'cookie';

/**
* --------------------------------------------------------------------------
* CSRF Token Randomization
* --------------------------------------------------------------------------
*
* Randomize the CSRF Token for added security.
*
* @var bool
*/
public $tokenRandomize = false;

/**
* --------------------------------------------------------------------------
* CSRF Token Name
Expand Down
12 changes: 12 additions & 0 deletions app/Config/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ class Toolbar extends BaseConfig
Events::class,
];

/**
* --------------------------------------------------------------------------
* Collect Var Data
* --------------------------------------------------------------------------
*
* If set to false var data from the views will not be colleted. Usefull to
* avoid high memory usage when there are lots of data passed to the view.
*
* @var bool
*/
public $collectVarData = true;

/**
* --------------------------------------------------------------------------
* Max History
Expand Down
2 changes: 1 addition & 1 deletion app/Views/errors/html/error_exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
<tbody>
<tr>
<td style="width: 10em">Path</td>
<td><?= esc($request->uri) ?></td>
<td><?= esc($request->getUri()) ?></td>
</tr>
<tr>
<td>HTTP Method</td>
Expand Down
1 change: 1 addition & 0 deletions env
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
#--------------------------------------------------------------------

# security.csrfProtection = 'cookie'
# security.tokenRandomize = false
# security.tokenName = 'csrf_token_name'
# security.headerName = 'X-CSRF-TOKEN'
# security.cookieName = 'csrf_cookie_name'
Expand Down
3 changes: 3 additions & 0 deletions tests/database/ExampleDatabaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Test\DatabaseTestTrait;
use Tests\Support\Database\Seeds\ExampleSeeder;
use Tests\Support\Models\ExampleModel;

/**
Expand All @@ -11,6 +12,8 @@ final class ExampleDatabaseTest extends CIUnitTestCase
{
use DatabaseTestTrait;

protected $seed = ExampleSeeder::class;

public function testModelFindAll()
{
$model = new ExampleModel();
Expand Down
7 changes: 5 additions & 2 deletions tests/session/ExampleSessionTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use CodeIgniter\Test\CIUnitTestCase;
use Config\Services;

/**
* @internal
Expand All @@ -9,7 +10,9 @@ final class ExampleSessionTest extends CIUnitTestCase
{
public function testSessionSimple()
{
$this->session->set('logged_in', 123);
$this->assertSame(123, $this->session->get('logged_in'));
$session = Services::session();

$session->set('logged_in', 123);
$this->assertSame(123, $session->get('logged_in'));
}
}

0 comments on commit 65ab17d

Please sign in to comment.