syncfusion-blazor-security

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Syncfusion Blazor Security

Syncfusion Blazor 安全

Content Security Policy (CSP) configuration for Syncfusion Blazor components in browser-hosted applications (.NET 8, 9, 10).
为浏览器托管应用(.NET 8、9、10)中的Syncfusion Blazor组件配置内容安全策略(CSP)。

When to Use

适用场景

Use this skill when you need to:
  • Add a CSP
    <meta>
    tag to
    App.razor
    or
    index.html
    for Syncfusion components
  • Configure CSP for self-hosted (Static Web Assets) script and style delivery
  • Configure CSP for CDN-hosted Syncfusion scripts and styles
  • Understand which CSP directives Syncfusion components require and why
在以下场景中使用本技能:
  • 为Syncfusion组件在
    App.razor
    index.html
    中添加CSP
    <meta>
    标签
  • 为自托管(静态Web资源)的脚本和样式交付配置CSP
  • 为CDN托管的Syncfusion脚本和样式配置CSP
  • 了解Syncfusion组件所需的CSP指令及其原因

Quick Reference

快速参考

  • Full CSP guide: See content-security-policy.md
  • 完整CSP指南:请参阅content-security-policy.md

Required CSP Directives at a Glance

必备CSP指令概览

DirectiveValueReason
font-src
'self' data:
Base64-encoded icon fonts
style-src
'self' 'unsafe-inline'
Inline styles for sizing/positioning
script-src
'self'
Dynamic code evaluation (animations, etc.)
connect-src
'self' https: wss:
WebSocket and HTTPS connections
img-src
data: https:
Inline images and remote assets
object-src
'none'
Block plugin content
CDN users: also append
https://cdn.syncfusion.com/blazor/
to
script-src
and
style-src
.
指令原因
font-src
'self' data:
Base64编码的图标字体
style-src
'self' 'unsafe-inline'
用于尺寸/定位的内联样式
script-src
'self'
动态代码评估(动画等)
connect-src
'self' https: wss:
WebSocket和HTTPS连接
img-src
data: https:
内联图片和远程资源
object-src
'none'
阻止插件内容
CDN用户注意:还需在
script-src
style-src
后追加
https://cdn.syncfusion.com/blazor/

Where to Add the CSP Tag

CSP标签添加位置

Project TypeFile
Blazor Web App (.NET 8/9/10) any render mode
~/Components/App.razor
Blazor WebAssembly Standalone
wwwroot/index.html
项目类型文件
Blazor Web App(.NET 8/9/10)任意渲染模式
~/Components/App.razor
Blazor WebAssembly 独立应用
wwwroot/index.html