From 18772a01928fdd6410626d13bba1b0a82c1c2842 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 26 Jun 2018 23:18:58 +0200 Subject: Don't store CSRF _token in logs --- app/RandomLog.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/RandomLog.php b/app/RandomLog.php index a90018c..f0fefb9 100644 --- a/app/RandomLog.php +++ b/app/RandomLog.php @@ -26,10 +26,17 @@ class RandomLog extends Model { public $timestamps = false; protected $fillable = ['request', 'response']; - public static function boot() { + public static function boot() { static::creating(function ($model) { $model->created_at = $model->freshTimestamp(); }); } + public function setRequestAttribute($value) { + $value = json_decode($value, true); + unset($value['_token']); + $value = json_encode($value); + $this->attributes['request'] = $value; + } + } -- cgit v1.2.3