]> git.agnieray.net Git - galette.git/commitdiff
Add CSRF Middleware
authorJohan Cwiklinski <johan@x-tnd.be>
Mon, 8 Nov 2021 22:36:58 +0000 (23:36 +0100)
committerJohan Cwiklinski <trasher@x-tnd.be>
Tue, 9 Nov 2021 21:54:50 +0000 (22:54 +0100)
Add csrf inputs on all forms
Use an exception rather than default blank page
Add CSRF check on ajax post requests
Make CSRF token persistent to ease with ajax calls

49 files changed:
galette/composer.json
galette/composer.lock
galette/includes/dependencies.php
galette/includes/main.inc.php
galette/lib/Galette/Middleware/SmartyCsrf.php [new file with mode: 0644]
galette/templates/default/admintools.tpl
galette/templates/default/advanced_search.tpl
galette/templates/default/ajouter_contribution.tpl
galette/templates/default/ajouter_transaction.tpl
galette/templates/default/attendance_sheet_details.tpl
galette/templates/default/change_passwd.tpl
galette/templates/default/common_scripts.tpl
galette/templates/default/config_fields.tpl
galette/templates/default/config_lists.tpl
galette/templates/default/confirm_removal.tpl
galette/templates/default/directlink.tpl
galette/templates/default/edit_paymenttype.tpl
galette/templates/default/edit_title.tpl
galette/templates/default/editer_champ.tpl
galette/templates/default/editer_intitule.tpl
galette/templates/default/export.tpl
galette/templates/default/forms_types/csrf.tpl [new file with mode: 0644]
galette/templates/default/gestion_adherents.tpl
galette/templates/default/gestion_contributions.tpl
galette/templates/default/gestion_intitules.tpl
galette/templates/default/gestion_mailings.tpl
galette/templates/default/gestion_paymentstypes.tpl
galette/templates/default/gestion_pdf_content.tpl
galette/templates/default/gestion_textes.tpl
galette/templates/default/gestion_titres.tpl
galette/templates/default/gestion_transactions.tpl
galette/templates/default/group.tpl
galette/templates/default/history.tpl
galette/templates/default/import.tpl
galette/templates/default/import_model.tpl
galette/templates/default/index.tpl
galette/templates/default/liste_membres.tpl
galette/templates/default/lostpasswd.tpl
galette/templates/default/mailing_adherents.tpl
galette/templates/default/mass_add_contribution.tpl
galette/templates/default/mass_change_members.tpl
galette/templates/default/mass_choose_type.tpl
galette/templates/default/member.tpl
galette/templates/default/plugin_initdb.tpl
galette/templates/default/preferences.tpl
galette/templates/default/reminder.tpl
galette/templates/default/saved_searches.tpl
galette/templates/default/traduire_libelles.tpl
galette/templates/default/trombinoscope.tpl

index f33d8d0058ffe551de593e1e72b8eb7d4ed273ee..b9d724476072f4abc2f50214f557876d1494d6d4 100644 (file)
@@ -50,7 +50,8 @@
         "doctrine/annotations": "^1.8",
         "laminas/laminas-servicemanager": "3.7",
         "symfony/polyfill-php80": "^1.23",
-        "ezyang/htmlpurifier": "^4.13"
+        "ezyang/htmlpurifier": "^4.13",
+        "slim/csrf": "0.8.3"
     },
     "require-dev": {
         "atoum/atoum": "dev-master",
index 79e9819a4e3fa41a916ec577219a14c04dd4a7c3..511eb07ece61c1a4cc08e6124042a5438ae1bd33 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "47d56d47701d9038105bd93cf3b44a02",
+    "content-hash": "be12f467246cd29921b64f8f84dc17a8",
     "packages": [
         {
             "name": "akrabat/rka-slim-session-middleware",
             },
             "time": "2021-04-09T13:42:10+00:00"
         },
+        {
+            "name": "paragonie/random_compat",
+            "version": "v9.99.100",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/paragonie/random_compat.git",
+                "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a",
+                "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">= 7"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "4.*|5.*",
+                "vimeo/psalm": "^1"
+            },
+            "suggest": {
+                "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
+            },
+            "type": "library",
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Paragon Initiative Enterprises",
+                    "email": "security@paragonie.com",
+                    "homepage": "https://paragonie.com"
+                }
+            ],
+            "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
+            "keywords": [
+                "csprng",
+                "polyfill",
+                "pseudorandom",
+                "random"
+            ],
+            "support": {
+                "email": "info@paragonie.com",
+                "issues": "https://github.com/paragonie/random_compat/issues",
+                "source": "https://github.com/paragonie/random_compat"
+            },
+            "time": "2020-10-15T08:29:30+00:00"
+        },
         {
             "name": "php-di/invoker",
             "version": "2.3.2",
             },
             "time": "2017-10-23T01:57:42+00:00"
         },
+        {
+            "name": "slim/csrf",
+            "version": "0.8.3",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/slimphp/Slim-Csrf.git",
+                "reference": "5f2bcf5d89adf86dc0455a32bea84d912ab466a7"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/slimphp/Slim-Csrf/zipball/5f2bcf5d89adf86dc0455a32bea84d912ab466a7",
+                "reference": "5f2bcf5d89adf86dc0455a32bea84d912ab466a7",
+                "shasum": ""
+            },
+            "require": {
+                "paragonie/random_compat": "^1.1|^2.0|^9.99",
+                "php": ">=5.5.0",
+                "psr/http-message": "^1.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.0",
+                "slim/slim": "~3.0"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Slim\\Csrf\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Josh Lockhart",
+                    "email": "hello@joshlockhart.com",
+                    "homepage": "http://joshlockhart.com"
+                }
+            ],
+            "description": "Slim Framework 3 CSRF protection middleware",
+            "homepage": "http://slimframework.com",
+            "keywords": [
+                "csrf",
+                "framework",
+                "middleware",
+                "slim"
+            ],
+            "support": {
+                "issues": "https://github.com/slimphp/Slim-Csrf/issues",
+                "source": "https://github.com/slimphp/Slim-Csrf/tree/master"
+            },
+            "time": "2018-08-22T16:12:18+00:00"
+        },
         {
             "name": "slim/flash",
             "version": "0.4.0",
index 8cf6b47d92a267a7e9054a6d487b8f3542081845..c1e86bebb0d94ed55a41ddee1d0dbdadac5b2bd0 100644 (file)
@@ -432,6 +432,31 @@ $container->set(
         )
 );
 
+$container->set(
+    'csrf',
+    function (ContainerInterface $c) {
+        $storage = null;
+        $guard = new \Slim\Csrf\Guard(
+            'csrf',
+            $storage,
+            null,
+            200,
+            16,
+            true
+        );
+
+        $guard->setFailureCallable(function ($request, $response, $next) {
+            Analog::log(
+                'CSRF check has failed',
+                Analog::CRITICAL
+            );
+            throw new \RuntimeException(_T('Failed CSRF check!'));
+        });
+
+        return $guard;
+    }
+);
+
 //For bad existing globals can be used...
 global $translator, $i18n;
 if (
index 7c1f190fcb12e620fd363a82b4b07cfde64371c5..013bbbc5c936d80d07cbdf0f937216b6c6fbb27b 100644 (file)
@@ -92,6 +92,8 @@ $app->add($session);
 
 // Set up dependencies
 require GALETTE_ROOT . '/includes/dependencies.php';
+$app->add(new \Galette\Middleware\SmartyCsrf($app->getContainer()));
+$app->add($app->getContainer()->get('csrf'));
 
 if ($needs_update) {
     $app->add(
diff --git a/galette/lib/Galette/Middleware/SmartyCsrf.php b/galette/lib/Galette/Middleware/SmartyCsrf.php
new file mode 100644 (file)
index 0000000..2305f50
--- /dev/null
@@ -0,0 +1,96 @@
+<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Galette CSRF middleware
+ *
+ * PHP version 5
+ *
+ * Copyright © 2021 The Galette Team
+ *
+ * This file is part of Galette (http://galette.tuxfamily.org).
+ *
+ * Galette is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Galette is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Galette. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category  Core
+ * @package   Galette
+ *
+ * @author    Johan Cwiklinski <johan@x-tnd.be>
+ * @copyright 2021 The Galette Team
+ * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
+ * @link      http://galette.tuxfamily.org
+ * @since     Available since 0.9.6dev - 2021-11-08
+ */
+
+namespace Galette\Middleware;
+
+use Psr\Http\Message\ServerRequestInterface as Request;
+use Psr\Http\Message\ResponseInterface as Response;
+use Analog\Analog;
+use DI\Container;
+
+/**
+ * Galette CSRF middleware
+ *
+ * @category  Middleware
+ * @name      SmartyCsrf
+ * @package   Galette
+ * @author    Johan Cwiklinski <johan@x-tnd.be>
+ * @copyright 2020 The Galette Team
+ * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
+ * @link      http://galette.tuxfamily.org
+ * @since     Available since 0.9.4dev - 2020-05-06
+ */
+class SmartyCsrf
+{
+    private $smarty;
+    private $csrf;
+
+    /**
+     * Constructor
+     *
+     * @param Container $container Container instance
+     */
+    public function __construct(Container $container)
+    {
+        $view = $container->get('Slim\Views\Smarty');
+        $this->smarty = $view->getSmarty();
+        $this->csrf = $container->get('csrf');
+    }
+
+    /**
+     * Middleware invokable class
+     *
+     * @param  \Psr\Http\Message\ServerRequestInterface $request  PSR7 request
+     * @param  \Psr\Http\Message\ResponseInterface      $response PSR7 response
+     * @param  callable                                 $next     Next middleware
+     *
+     * @return \Psr\Http\Message\ResponseInterface
+     */
+    public function __invoke(Request $request, Response $response, $next): Response
+    {
+        $nameKey = $this->csrf->getTokenNameKey();
+        $valueKey = $this->csrf->getTokenValueKey();
+        $name = $request->getAttribute($nameKey);
+        $value = $request->getAttribute($valueKey);
+
+        $this->smarty->assign('csrf_name_key', $nameKey);
+        $this->smarty->assign('csrf_value_key', $valueKey);
+        $this->smarty->assign('csrf_name', $name);
+        $this->smarty->assign('csrf_value', $value);
+
+        return $next($request, $response);
+    }
+}
index b1a9028d601f73f494f03bc3ad980e7b52c000dc..e72ac324bdd84d66e9b7b09014c75f31b1c3b475 100644 (file)
             </p>
         </fieldset>
         <div class="button-container">
-            <button ype="submit" class="action">
+            <button type="submit" class="action">
                 <i class="fas fa-database" aria-hidden="true"></i>
                 {_T string="Go"}
             </button>
+            {include file="forms_types/csrf.tpl"}
         </div>
     </form>
 {/block}
index 4c8767959b4654d28296c4963592beb42f6e6648..1aa267893bcfe47d8d1c452d148c6eb935e0da0d 100644 (file)
                 <input type="hidden" name="advanced_filtering" value="true" />
                 <input type="submit" class="inline" value="{_T string="Filter"}"/>
                 <input type="submit" name="clear_adv_filter" class="inline" value="{_T string="Clear filter"}"/>
+                {include file="forms_types/csrf.tpl"}
             </div>
         </form>
 {/block}
index 69cb889be1c80b6493afdde1a3d331cefcce0cdb..42ee6c91fd400f17239d3db2cc04ecad23332068 100644 (file)
             <input type="hidden" name="trans_id" value="{if $contribution->transaction neq NULL}{$contribution->transaction->id}{/if}"/>
         </div>
     {/if}
+            {include file="forms_types/csrf.tpl"}
         </form>
 {else} {* No members *}
     <div class="center" id="warningbox">
index 18a3ddde14451dca464ecd2c81bc7ccc0e8ec50c..2f34546e46b29116c3eb824c8dad2e9e9ecac717 100644 (file)
@@ -46,6 +46,7 @@
             </button>
             <input type="hidden" name="trans_id" value="{$transaction->id}"/>
             <input type="hidden" name="valid" value="1"/>
+            {include file="forms_types/csrf.tpl"}
         </div>
         <p>{_T string="NB : The mandatory fields are in"} <span class="required">{_T string="red"}</span></p>
         </form>
index a52d37ffb06ca31b664556c5cfad59bde6a6cd22..bd9c2254e34e92b038316fcdfecaa28aa9c850d4 100644 (file)
@@ -31,6 +31,7 @@
 {foreach $selection as $member}
                 <input type="hidden" name="selection[]" value="{$member}"/>
 {/foreach}
+                {include file="forms_types/csrf.tpl"}
             </p>
         </fieldset>
 {if not $ajax}
index c793ad2cb56dddbe4c965b3a5dc71377533206d5..187200b217a8732deb7d4b31f1b5f9ba16898210 100644 (file)
@@ -16,5 +16,6 @@
                 </table>
                 <input type="submit" name="change_passwd" value="{_T string="Change my password"}"/>
                 <input type="hidden" name="hash" value="{$hash}"/>
+                {include file="forms_types/csrf.tpl"}
         </form>
 {/block}
index f4e1dc719d6597301485fd65b10066bc714680d5..499a7e8099db30337ea19ac9db9588283158c7d3 100644 (file)
@@ -1,5 +1,23 @@
         <script type="text/javascript">
+            function csrfSafeMethod(method) {
+                // these HTTP methods do not require CSRF protection
+                return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
+            }
+
             $(function(){
+                $.ajaxPrefilter(function(options, originalOptions, jqXHR){
+                    if (options.type.toLowerCase() === "post") {
+                        // initialize `data` to empty string if it does not exist
+                        options.data = options.data || "";
+
+                        // add leading ampersand if `data` is non-empty
+                        options.data += options.data?"&":"";
+
+                        // add csrf
+                        options.data += encodeURIComponent("{$csrf_name_key}") + "=" + encodeURIComponent("{$csrf_name}") + "&" + encodeURIComponent("{$csrf_value_key}") + "=" + encodeURIComponent("{$csrf_value}")
+                    }
+                });
+
                 $.datepicker.setDefaults($.datepicker.regional['{$galette_lang}']);
     {if $galette_lang eq 'en'}
                 $.datepicker.setDefaults({
index 12849db7aa74bdb00d399c981a2c56bbafe43717..dd51a0a38fde10d31c66b05c75839b2eae94504b 100644 (file)
@@ -55,6 +55,7 @@
             <button type="submit" class="action">
                 <i class="fas fa-save fa-fw"></i> {_T string="Save"}
             </button>
+            {include file="forms_types/csrf.tpl"}
         </div>
     </form>
 {/block}
index c36e0716ed11926a4de0a7d19564ab6ffd04a13b..0968a6a6b4ecd060e288d81916fd087dc2438024 100644 (file)
@@ -57,6 +57,7 @@
                 <i class="fas fa-save fa-fw"></i> {_T string="Save"}
             </button>
         </div>
+        {include file="forms_types/csrf.tpl"}
     </form>
 {/block}
 
index fc2157b3ecc8be8f83f1c845401fe713e74232d7..1fff7ebe94489c7d00694409b869e6a34256ce59 100644 (file)
@@ -30,6 +30,7 @@
                 <input type="hidden" name="{$key}" value="{$value}"/>
                 {/if}
             {/foreach}
+            {include file="forms_types/csrf.tpl"}
         </div>
     </form>
     </div>
index de22d55c362f0f42974721568dc1cc50d251946a..d4efc92bf6bee27e524d6f90a7dfc2a8beb2f8ad 100644 (file)
@@ -9,6 +9,7 @@
                     <input type="submit" name="directlink" value="{_T string="Get my document"}" />
                     <input type="hidden" name="valid" value="1"/>
                     <input type="hidden" name="hash" value="{$hash}"/>
+                    {include file="forms_types/csrf.tpl"}
                 </section>
             </form>
 {/block}
index ec40599ae9a74113114829537dea19975e4021bd..bc6dccf2c8d286e3b4d277072948cd94301f42b3 100644 (file)
@@ -16,6 +16,7 @@
             </button>
             <input type="submit" name="cancel" value="{_T string="Cancel"}"/>
             <input type="hidden" name="id" id="id" value="{$ptype->id}"/>
+            {include file="forms_types/csrf.tpl"}
         </div>
      </form>
 {/block}
index 157d8a7ebd49d7c28ad6333c1a4f2cee98463cea..178b05c066886c83b32ba34b56957b5024a9f03c 100644 (file)
@@ -20,6 +20,7 @@
                 </button>
                 <input type="submit" name="cancel" value="{_T string="Cancel"}"/>
                 <input type="hidden" name="id" id="id" value="{$title->id}"/>
+                {include file="forms_types/csrf.tpl"}
             </div>
      </form>
 {/block}
index 29e7a029fbeb9ca5c7e0075ec894611d31eb8567..41fbeb54b0d00b7991d5d4a1fba1c0eb87b6272c 100644 (file)
@@ -71,6 +71,7 @@
                 <button type="submit" class="action">
                     <i class="fas fa-save fa-fw"></i> {_T string="Save"}
                 </button>
+                {include file="forms_types/csrf.tpl"}
             </div>
 
      </form>
index 18a4ad1e2cddc518f158092e11a18ea6feec32b1..ef23748cfc81af96c57a3e40ec9e66c07c6187f8 100644 (file)
@@ -39,6 +39,7 @@
             <i class="fas fa-save"></i>
             {_T string="Save"}
         </button>
+        {include file="forms_types/csrf.tpl"}
     </div>
     </div>
 </form>
index 43719b7aefadfa47ddb7313e9a4465b617158107..5d9e14fed6d0d44100e83c5cb93f3c36fc2e3fdc 100644 (file)
                 </fieldset>
             <div class="button-container">
                 <input type="submit" name="valid" value="{_T string="Continue"}"/>
+                {include file="forms_types/csrf.tpl"}
             </div>
         </form>
 {/block}
diff --git a/galette/templates/default/forms_types/csrf.tpl b/galette/templates/default/forms_types/csrf.tpl
new file mode 100644 (file)
index 0000000..c9744bd
--- /dev/null
@@ -0,0 +1,2 @@
+<input type="hidden" name="{$csrf_name_key}" value="{$csrf_name}"/>
+<input type="hidden" name="{$csrf_value_key}" value="{$csrf_value}"/>
\ No newline at end of file
index fc8ae326b800682fa828e5bc5b44d38dae421c40..7d67ccc136611c4650c14f09ab1b344cc7e8e65c 100644 (file)
@@ -104,6 +104,7 @@ We have to use a template file, so Smarty will do its work (like replacing varia
             </p>
             <pre id="sql_qry" class="hidden">{$filters->query}</pre>
 {/if}
+            {include file="forms_types/csrf.tpl"}
         </div>
         <div class="infoline">
             {_T string="%count member" plural="%count members" count=$nb_members pattern="/%count/" replace=$nb_members}
@@ -354,7 +355,7 @@ We have to use a template file, so Smarty will do its work (like replacing varia
     {/if}
         </ul>
 {/if}
-
+            {include file="forms_types/csrf.tpl"}
         </form>
 {if $nb_members != 0}
         <div id="legende" title="{_T string="Legend"}">
@@ -511,6 +512,7 @@ We have to use a template file, so Smarty will do its work (like replacing varia
                     }
 
                     if (this.id == 'masscontributions') {
+                        event.preventDefault();
                         $.ajax({
                             url: '{path_for name="batch-memberslist"}',
                             type: "POST",
index 8e34f2a968232bc79ca45cf64963d2c0b5fcd501..0064f29fb651880adc573dc5936ad75b184b378e 100644 (file)
@@ -61,6 +61,7 @@
                 </select>
                 <noscript> <span><input type="submit" value="{_T string="Change"}" /></span></noscript>
             </div>
+            {include file="forms_types/csrf.tpl"}
         </div>
         </form>
         <form action="{path_for name="batch-contributionslist" data=["type" => "contributions"]}" method="post" id="listform">
                 <button type="submit" id="csv" name="csv">
                     <i class="fas fa-file-csv fa-fw"></i> {_T string="Export as CSV"}
                 </button>
+                {include file="forms_types/csrf.tpl"}
             </li>
         </ul>
     {/if}
index 4b99a7885306d51ad48842b058d53183852533d3..17be135f71c760e4870d38fabf8bd1f0b1296e6a 100644 (file)
@@ -4,6 +4,7 @@
 <form action="{path_for name="doAddEntitled" data=["class" => $url_class]}" method="post" class="tabbed">
 <div id="intitules_tabs">
     {include file="gestion_intitule_content.tpl"}
+    {include file="forms_types/csrf.tpl"}
 </div>
 </form>
 {/block}
index 74ac867ec8499ff900c119c1459443cde90ad521..0ea3812603aa906b8c92935ed21bdd54d04a9ea1 100644 (file)
@@ -45,6 +45,7 @@
                         {html_options options=$nbshow_options selected=$numrows}
                     </select>
                     <noscript> <span><input type="submit" value="{_T string="Change"}" /></span></noscript>
+                    {include file="forms_types/csrf.tpl"}
                 </td>
             </tr>
         </table>
index 3c8821696033ffea61142ecb36d66cf6939d2667..cbab043a35a5a8c670ac49d9d3245e01428f5a9e 100644 (file)
@@ -77,6 +77,7 @@
             {/foreach}
                     </tbody>
                 </table>
+            {include file="forms_types/csrf.tpl"}
         </form>
 {/block}
 
index d8956fcc9d81d663c86aeafdf708754337b4e442..f13b6bed7786e8a69e4c5f4a94b2b23035014854 100644 (file)
@@ -50,6 +50,7 @@
                 <button type="submit" class="action">
                     <i class="fas fa-save fa-fw"></i> {_T string="Save"}
                 </button>
+                {include file="forms_types/csrf.tpl"}
             </div>
         </form>
         {include file="replacements_legend.tpl" legends=$model->getLegend() cur_ref=$model->id}
\ No newline at end of file
index 1fdde520cb99b7866695499fe242d5d52fe62d2a..b1a8ea8d81d920dd5afcc4b4515c93cf08bcf2a4 100644 (file)
@@ -18,6 +18,7 @@
                     {/foreach}
                 </select>
                 <noscript> <span><input type="submit" value="{_T string="Change"}" /></span></noscript>
+            {include file="forms_types/csrf.tpl"}
         </form>
         </div>
 
@@ -42,6 +43,7 @@
             <button type="submit" class="action">
                 <i class="fas fa-save fa-fw"></i> {_T string="Save"}
             </button>
+            {include file="forms_types/csrf.tpl"}
         </div>
         </form>
         {include file="replacements_legend.tpl" legends=$texts->getLegend() cur_ref=$cur_ref}
index 762e32dea2ee52a49f59475b7deba5e468f3c2bd..dca09bf6af9b5539a57cf111d86250305426b2ef 100644 (file)
@@ -74,6 +74,7 @@
             {/foreach}
                     </tbody>
                 </table>
+            {include file="forms_types/csrf.tpl"}
         </form>
 {/block}
 
index 69273777eb0e4b779d9115e04161efbcc85932fc..f4e046f8ce0e5a8d42f891c58c03f81cfcff8353 100644 (file)
@@ -37,6 +37,7 @@
                         {html_options options=$nbshow_options selected=$numrows}
                     </select>
                     <noscript> <span><input type="submit" value="{_T string="Change"}" /></span></noscript>
+                    {include file="forms_types/csrf.tpl"}
                 </td>
             </tr>
         </table>
index a918089ca03335627c53a6159e6be92e95e03d05..522692f50b5301e3ed8758131a1ef689695bbe30 100644 (file)
@@ -86,6 +86,7 @@
                 {_T string="Group PDF"}
             </a>
             <input type="hidden" name="id_group" id="id_group" value="{$group->getId()}"/>
+            {include file="forms_types/csrf.tpl"}
         </div>
         <p>{_T string="NB : The mandatory fields are in"} <span class="required">{_T string="red"}</span></p>
         </form>
index f97961dc7884fc49756cb8e2017b8de7ab173e08..9fcc75c2bcc9cf516d8261348888bfdf8479503d 100644 (file)
@@ -50,6 +50,7 @@
                     {html_options options=$nbshow_options selected=$numrows}
                 </select>
                 <noscript> <span><input type="submit" value="{_T string="Change"}" /></span></noscript>
+                {include file="forms_types/csrf.tpl"}
             </div>
         </div>
     </form>
index 3f9f3d3514bdeb8b407489c45b5d0b31a5a12bc3..7d473e69837f5a0dd862efb984a4a2cab4aadb6f 100644 (file)
@@ -61,6 +61,7 @@
                             <i class="fas fa-file-import"></i>
                             {_T string="Import"}
                         </button>
+                        {include file="forms_types/csrf.tpl"}
                     </div>
 {else}
                     <p>{_T string="No import file actually exists."}<br/>{_T string="Use upload form below to send a new file on server, or copy it directly in the imports directory."}</p>
@@ -81,6 +82,7 @@
                             <i class="fas fa-upload" aria-hidd="true"></i>
                             {_T string="Upload file"}
                         </button>
+                        {include file="forms_types/csrf.tpl"}
                     </div>
                 </div>
             </fieldset>
index 29313db488b25eab6dbab4ba1d934bdd313e324b..f0b23358d9922ea3693554f6d39e58f72854a382 100644 (file)
@@ -75,6 +75,7 @@
                 <i class="fas fa-save" aria-hidden="true"></i>
                 {_T string="Store new model"}
             </button>
+            {include file="forms_types/csrf.tpl"}
         </div>
         </form>
     </div>
index c032dfe89d3e1eff6c8e546f2cf4280e7af0e786..710a8d9869393caa842688d788a2d22918f97708 100644 (file)
@@ -17,6 +17,7 @@
                     </table>
                     <input type="submit" value="{_T string="Login"}" />
                     <input type="hidden" name="ident" value="1" />
+                    {include file="forms_types/csrf.tpl"}
                 </section>
                 </form>
 {/block}
index e70c4cbdf4b18dc2ce6bba6c0a044140342db0e5..d8d9cf4ccd8bf7a43c12eda69afe949592f6f11b 100644 (file)
@@ -12,6 +12,7 @@
                         {html_options options=$nbshow_options selected=$numrows}
                     </select>
                     <noscript> <span><input type="submit" value="{_T string="Change"}" /></span></noscript>
+                    {include file="forms_types/csrf.tpl"}
                 </td>
             </tr>
         </table>
index ccb455fb3d0dbd3194b03f28f856d99c836ddf73..e137d23fe1ef21bf83206344a5f6d7cb7ec8bc76 100644 (file)
@@ -8,6 +8,7 @@
                     </p>
                     <input type="submit" name="lostpasswd" value="{_T string="Recover password"}" />
                     <input type="hidden" name="valid" value="1"/>
+                    {include file="forms_types/csrf.tpl"}
                 </section>
                 </form>
 {/block}
index d787c9a72248742c65b775d1d5508b6f2344c486..e460566492e1e13fbb9913f6152de2dd535193c5 100644 (file)
                     </p>
                 </div>
         {/if}
-
+            {include file="forms_types/csrf.tpl"}
             </section>
         </div>
         </form>
index 6e053518b0776d1be744ab86e0ee632e6947b5f7..88c6be4712e796dffb77a22def9a5fe2d2251354 100644 (file)
@@ -18,6 +18,7 @@
                 <input type="hidden" name="{$key}" value="{$value}"/>
                 {/if}
             {/foreach}
+            {include file="forms_types/csrf.tpl"}
         </div>
     </form>
     </div>
index e4edf532fd87c91c539413cc94824527cd678c92..ebde247bbc0f22fcdb9e84152e7246c03c717252 100644 (file)
@@ -59,6 +59,7 @@
                 <input type="hidden" name="{$key}" value="{$value}"/>
                 {/if}
             {/foreach}
+            {include file="forms_types/csrf.tpl"}
         </div>
     </form>
     </div>
index 89b131e86b668a4e75746dadfd8dcfd403a3561b..3404103cc33421f800ef646712291d7ba77cede5 100644 (file)
@@ -27,6 +27,7 @@
                 <input type="hidden" name="{$key}" value="{$value}"/>
                 {/if}
             {/foreach}
+            {include file="forms_types/csrf.tpl"}
         </div>
     </form>
     </div>
index ed5e07883564f817f251b8c5bdf99c61bbfe87fd..f65ab1499e6d496280f4bed71012a4e6af072446 100644 (file)
                     {/if}
                 {/if}
             {/foreach}
-
+            {include file="forms_types/csrf.tpl"}
             <a href="#" id="back2top">{_T string="Back to top"}</a>
         </div>
         </form>
index c09d3cd83841dce92ea5200407917e2621ab6690..f4e98031625b151cac1d729bf31bc1f1b8fb399d 100644 (file)
             <a href="{path_for name="plugins"}" class="button" id="btnback"><i class="fas fa-backward"></i> {_T string="Back to plugins managment page"}</a>
     {/if}
 {/if}
+            {include file="forms_types/csrf.tpl"}
         </p>
     </form>
     </div>
index 2d7da82d5e266cc89b238c7569d0159498f34d88..aea003fd84023eeb1375f2331350bfaf25b62b4f 100644 (file)
             </button>
         </div>
         <p>{_T string="NB : The mandatory fields are in"} <span class="required">{_T string="red"}</span></p>
+        {include file="forms_types/csrf.tpl"}
         </form>
 
         {include file="telemetry.tpl" part="dialog"}
index 11eeae377b466e6db350dff821bc02990ed96a12..f6237ecaa3d7ee779c8062dc918700b11c1b97b0 100644 (file)
@@ -32,6 +32,7 @@
                     <i class="fas fa-rocket" aria-hidden="true"></i>
                     {_T string="Send"}
                 </button>
+                {include file="forms_types/csrf.tpl"}
             </div>
         </form>
 {foreach from=$previews key=key item=preview}
index eb0cc32a6b81431d0666b0189883517c6d292adf..97389f0175d20a7ba471a46f45a19dbbe4881cad 100644 (file)
@@ -57,6 +57,7 @@
 {/foreach}
                     </tbody>
                 </table>
+            {include file="forms_types/csrf.tpl"}
         </form>
 {/block}
 
index 02833973e9871170761c493d940ec94267eeb933..ee8e89dfc6b774284cb2e28c85fc7571261c4761 100644 (file)
@@ -11,6 +11,7 @@
                             {html_options values=$orig output=$orig selected=$text_orig}
                         </select>
                         <noscript> <span><input type="submit" value="{_T string="Change"}" /></span></noscript>
+                        {include file="forms_types/csrf.tpl"}
                     </p>
                 </form>
     {/if}
@@ -37,6 +38,7 @@
                 <button type="submit" name="trans" class="action">
                     <i class="fas fa-save fa-fw"></i> {_T string="Save"}
                 </button>
+                {include file="forms_types/csrf.tpl"}
             </div>
         </form>
 {else}
index 1b8043cf739a4355994fc5df220814dc1e6d80c3..adac06c5f5510ff94ab460c28ba0c3d847a7e6c5 100644 (file)
@@ -12,6 +12,7 @@
                     {html_options options=$nbshow_options selected=$numrows}
                 </select>
                 <noscript> <span><input type="submit" value="{_T string="Change"}" /></span></noscript>
+                {include file="forms_types/csrf.tpl"}
             </td>
         </tr>
     </table>