Skip to content

Commit 80f1387

Browse files
committed
Update
- Fixed : striping tags that are inputed by the end user.
1 parent a7dbdd7 commit 80f1387

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

app/Forms/UserProfileForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function processAttribute( $request )
5959

6060
foreach( $request->input( 'attribute' ) as $key => $value ) {
6161
if ( in_array( $key, $allowedInputs ) ) {
62-
$user->$key = preg_replace( '#<script(.*?)>(.*?)</script>#is', '', $value );
62+
$user->$key = strip_tags( $value );
6363
}
6464
}
6565

app/Http/Controllers/Dashboard/CrudController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function crudPost( String $namespace, CrudPostRequest $request )
120120
* all script tags
121121
*/
122122
if ( ! empty( $entry->$name ) ) {
123-
$entry->$name = preg_replace( '#<script(.*?)>(.*?)</script>#is', null, $entry->$name );
123+
$entry->$name = strip_tags( $entry->$name );
124124
}
125125
}
126126

@@ -243,7 +243,7 @@ public function crudPut( String $namespace, $id, CrudPutRequest $request )
243243
* all script tags
244244
*/
245245
if ( ! empty( $entry->$name ) ) {
246-
$entry->$name = preg_replace( '#<script(.*?)>(.*?)</script>#is', null, $entry->$name );
246+
$entry->$name = strip_tags( $entry->$name );
247247
}
248248
}
249249

app/Services/Options.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function beforeSave( $option )
154154
* sanitizing input to remove
155155
* all script tags
156156
*/
157-
$option->value = preg_replace( '#<script(.*?)>(.*?)</script>#is', '', $option->value );
157+
$option->value = strip_tags( $option->value );
158158

159159
return $option;
160160
}

app/Services/UserOptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function beforeSave( $option )
2727
* sanitizing input to remove
2828
* all script tags
2929
*/
30-
$option->value = preg_replace( '#<script(.*?)>(.*?)</script>#is', '', $option->value );
30+
$option->value = strip_tags( $option->value );
3131

3232
return $option;
3333
}

0 commit comments

Comments
 (0)