fix injection bugs in table editor

This commit is contained in:
2018-08-12 21:58:42 +02:00
parent b716260a53
commit 7ae41b368e
6 changed files with 13 additions and 26 deletions
+2 -15
View File
@@ -37,23 +37,14 @@ class BladeExtensionsProvider extends ServiceProvider
return "<?= e(app()->make('\\Faker\\Generator')->$method($params)) ?>";
});
// csrf token for forms
Blade::directive('formCsrf', function () {
return '<?= csrf_field() ?>';
});
// json encode
Blade::directive('json', function ($x) {
return "<?= json_encode(($x), JSON_UNESCAPED_SLASHES) ?>";
return "<?= toJSON($x) ?>";
});
// json encode, escaped
Blade::directive('jsone', function ($x) {
if (config('app.pretty_json')) {
return "<?= e(json_encode(($x), JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)) ?>";
} else {
return "<?= e(json_encode(($x), JSON_UNESCAPED_SLASHES)) ?>";
}
return "<?= e(toJSON($x)) ?>";
});
// selected if cond true
@@ -66,10 +57,6 @@ class BladeExtensionsProvider extends ServiceProvider
return "<?= ($x) ? 'checked' : '' ?>";
});
Blade::if('admin', function () {
return \Auth::user()->isAdmin();
});
Blade::if('set', function ($x) {
return config($x) != '';
});