现在我必须将页面标题发送到master.blade,但它在$request->q
param上提供了XSS
template.blade
@section('title', $request->q)
master.blade
<meta property="og:title" content="@yield('title')" />
我已经申请了
@section('title', htmlentities($request->q) )
但是有更好的解决方案吗?
答案 0 :(得分:1)
通常人们这样做:
<meta property="og:title" content="{{ $title }}">
然后设置它:
@extends("layouts.master", ["title" => $request->q])
或:
return view("path.to.view", ["title" => $request->q]);
答案 1 :(得分:0)
我的类似案例的方法
<title>@yield("title")</title>
并在布局文件中
@section('title')
{{ trans('client/parent/list.page_title') }} - {{ trans('app.app_title') }}
@endsection