系列
- 1 分鐘快速使用 Docker 上手最新版 Sentry-CLI - 建立版本
- 快速使用 Docker 上手 Sentry-CLI - 30 秒上手 Source Maps
- Sentry For React 完整接入詳解
- Sentry For Vue 完整接入詳解
- Sentry-CLI 使用詳解
- Sentry Web 效能監控 - Web Vitals
- Sentry Web 效能監控 - Metrics
- Sentry Web 效能監控 - Trends
- Sentry Web 前端監控 - 最佳實踐(官方教程)
- Sentry 後端監控 - 最佳實踐(官方教程)
- Sentry 監控 - Discover 大資料查詢分析引擎
- Sentry 監控 - Dashboards 資料視覺化大屏
- Sentry 監控 - Environments 區分不同部署環境的事件資料
目錄
Content-Security-Policy
Expect-CT
HTTP Public Key Pinning
- 附加配置
Sentry 21.8.0
開源版生產截圖
Sentry
能夠通過設定適當的 HTTP header
來收集有關 Content-Security-Policy (CSP)
違規行為以及 Expect-CT
和 HTTP Public Key Pinning (HPKP)
失敗(failures
)的資訊,這會讓違規/失敗(violation/failure)
傳送到 report-uri
中指定的 Sentry
端點。
Content-Security-Policy (CSP)
:https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-PolicyExpect-CT
:https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect-CTHTTP Public Key Pinning (HPKP)
:https://developer.mozilla.org/en-US/docs/Web/HTTP/Public_Key_Pinning
Content-Security-Policy
Content-Security-Policy (CSP)
是一種安全標準,有助於防止跨站點指令碼 (XSS)
、點選劫持(clickjacking)
和其他由於在受信任的網頁上下文中執行惡意內容而導致的程式碼注入攻擊。它由瀏覽器廠商強制執行,Sentry
支援使用標準報告 Hook
捕獲 CSP
違規。
要在 Sentry
中配置 CSP
報告,您需要從伺服器傳送一個 header
來描述您的策略,並指定經過身份驗證的 Sentry
端點:
Content-Security-Policy: ...; report-uri https://o0.ingest.sentry.io/api/0/security/?sentry_key=examplePublicKey
或者,您可以設定 CSP
報告以簡單地傳送報告而不是實際執行策略:
Content-Security-Policy-Report-Only: ...; report-uri https://o0.ingest.sentry.io/api/0/security/?sentry_key=examplePublicKey
在定義您的策略時,確保 sentry.io
或您的自託管 sentry 域
在您的 default-src
或 connect-src
策略中很重要,否則瀏覽器將阻止提交違反策略的請求。
有關更多資訊,請參閱 MDN
上的文章。
Expect-CT
Certificate Transparency (CT)
是一種安全標準,可幫助跟蹤和識別有效證書,允許識別惡意頒發的證書。
要在 Sentry
中配置報告,您需要從伺服器配置 Expect-CT
header:
Expect-CT: ..., report-uri="https://o0.ingest.sentry.io/api/0/security/?sentry_key=examplePublicKey"
有關更多資訊,請參閱 MDN
上的文章。
HTTP Public Key Pinning
HTTP Public Key Pinning (HPKP)
是一種安全功能,它告訴 Web 客戶端
將特定的加密公鑰(public key
)與某個 Web 伺服器
相關聯,以降低使用偽造證書進行 MITM
攻擊的風險。 它由瀏覽器廠商強制執行,Sentry
支援使用標準報告 Hook
捕獲違規行為。
要在 Sentry
中配置 HPKP
報告,您需要從伺服器傳送一個 header
來描述您的策略,並指定經過身份驗證的 Sentry 端點:
Public-Key-Pins: ...; report-uri="https://o0.ingest.sentry.io/api/0/security/?sentry_key=examplePublicKey"
有關更多資訊,請參閱 MDN
上的文章。
附加配置
除了 sentry_key
引數,您還可以在 report URI
的查詢字串中傳遞以下內容:
sentry_environment
- 環境名稱(例如
production
)。
sentry_release
- 應用程式的版本。