TeamCity のコンテンツセキュリティポリシー
TeamCity は、 コンテンツセキュリティポリシー (CSP) ヘッダーによって追加の HTTP セキュリティを実装します。
このヘッダーは、ホワイトリストに登録された一部の例外を除き、TeamCity ページによる外部リソースのダウンロードを禁止します。 ホワイトリストに登録されていないリソースからのダウンロードはブロックされます。
一部の設定では、外部リソースのダウンロードを許可する必要がある場合があります。 たとえば、分析ツールを使用する場合や、プラグインを介して TeamCity を外部サービスと統合する場合です。
プラグイン開発者は、 ContentSecurityPolicyConfig (英語) OpenAPI インターフェースを介して CSP ディレクティブを提供できます。
CSP ヘッダー値の変更
サーバー管理者は、内部プロパティを介して CSP ヘッダー値を変更できます。
TeamCity 管理ページの場合:
teamcity.web.header.Content-Security-Policy.adminUI.protectedValue=<value>その他の TeamCity ページの場合:
teamcity.web.header.Content-Security-Policy.protectedValue=<value>
値には、CSP ヘッダーのカスタム部分のみを指定する必要があります。 完全な値を指定すると、そのカスタムパーツのみが適用されます。
内部プロパティによる Google Analytics の追加
Google Analytics を許可するには、CSP ヘッダーの次のディレクティブの値を変更する必要があります。
Google Analytics の URL をロードできるようにする
接続-src:connect-src 'self' ws: wss: https://www.google-analytics.com www.google-analytics.com https://stats.g.doubleclick.netイメージの読み込みを可能にする
画像-src:img-src 'self' data: https://www.google-analytics.com www.google-analytics.com https://stats.g.doubleclick.net;JavaScript のロードを許可する
スクリプト-src:script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.google-analytics.com
内部プロパティは次のように設定する必要があります。
# For TeamCity administration pages:
teamcity.web.header.Content-Security-Policy.adminUI.protectedValue=frame-ancestors 'self'; default-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.google-analytics.com; img-src 'self' data: https://www.google-analytics.com www.google-analytics.com https://stats.g.doubleclick.net; connect-src 'self' ws: wss: https://www.google-analytics.com www.google-analytics.com https://stats.g.doubleclick.net
# For other pages:
teamcity.web.header.Content-Security-Policy.protectedValue=frame-ancestors 'self'; default-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.google-analytics.com; img-src 'self' data: https://www.google-analytics.com www.google-analytics.com https://stats.g.doubleclick.net; connect-src 'self' ws: wss: https://www.google-analytics.com www.google-analytics.com https://stats.g.doubleclick.net
2026 年 9 月 11 日