Update handling of Trusted Types
まだ誰も着手していません。
評価
調査の方向性
まず既存の security-header UI と sources table を確認し、trusted-types と require-trusted-types-for の要件を、リンクされている MDN および W3C のリファレンスと比較します。これらのディレクティブを sources table に含めるのか custom properties に含めるのかを判断し、実装前にドロップダウン、policy-name の扱い、チェックボックスを定義します。両方のディレクティブを正しく設定および生成できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Note: This is now CSP baseline functionality as of 2026, but not technically part of the CSP 3 spec
Add support for trusted-types and require-trusted-types-for require a different type of UI to be functional compared to standard sources.
Key Articles:
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy/trusted-types
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy/require-trusted-types-for
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy#trusted-types-eval
- https://w3c.github.io/trusted-types/dist/spec/#trusted-types
Trusted Types Directive
<policyName> : A valid policy name consists only of alphanumeric characters, or one of -#=_/@.%. A star (*) as a policy name instructs the user agent to allow any unique policy name
Content-Security-Policy: trusted-types;
Content-Security-Policy: trusted-types 'none';
Content-Security-Policy: trusted-types <policyName>;
Content-Security-Policy: trusted-types <policyName> <policyName> 'allow-duplicates';
Example Trusted Types Usage
// Content-Security-Policy: require-trusted-types-for 'script'; trusted-types foo;
const attackerInput = '<svg onload="alert(/cross-site-scripting/)" />';
const el = document.createElement("div");
if (typeof trustedTypes !== "undefined") {
// Create a policy that can create TrustedHTML values
// after sanitizing the input strings with DOMPurify library.
const sanitizer = trustedTypes.createPolicy("foo", {
createHTML: (input) => DOMPurify.sanitize(input),
});
el.innerHTML = sanitizer.createHTML(attackerInput); // Puts the sanitized value into the DOM.
el.innerHTML = attackerInput; // Rejects a string value; throws a TypeError.
}
Require Trusted Types Directive
Note this currently only supports 'script'
Content-Security-Policy: require-trusted-types-for 'script';
UI Considerations
- Dropdown for "Trusted Types":
- Disabled (Not Generated)
- None (Generates the
'none') - Allow Specific (requires policy names)
- Allow All (Uses
*)
- Require For Scripts (Checkbox)
- True (generates:
require-trusted-types-for 'script';)
- True (generates:
- Allow Duplicates (Checkbox)
- Adds
'allow-duplicates'to Trusted Types;
- Adds
Data Storage ... do we store this in the sources table or create custom properties?
e.g.
| Source | Directives |
|---|---|
<policyName> <policyName> 'allow-duplicates' |
trusted-types |
| 'script' | require-trusted-types-for |
Usage Complications
- Brand sites with GTM usage will require additional scripting to work this functionality
- Investigate if Optimizely WebEx supports this
- 主要言語
- C#
- スター
- 11
- フォーク
- 6
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
GeekInTheNorth/Stott.Security.Optimizely のほかの issue
-
enhancement Under Consideration
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
-
enhancement Under Consideration
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
GeekInTheNorth/Stott.Security.Optimizely#382 · リアクション 1 件 ·
-
enhancement Under Consideration
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
-
enhancement Under Consideration
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
GeekInTheNorth/Stott.Security.Optimizely#299 · コメント 1 件 ·
-
Add the ability to manage CSP extensions for a specific content item from the main interface.再び着手できるかも @GeekInTheNorth が 546 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンenhancement Under Consideration
GeekInTheNorth/Stott.Security.Optimizely#211 · 担当者 1 名 ·
GeekInTheNorth/Stott.Security.Optimizely の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
effort:S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
nightscout/nocturne#4930 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
reactiveui/ReactiveUI#4589 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 91/100
reactiveui/Akavache#1278 ·
メンテナーはふだん 1 日以内に返信
-
FOODPLANNER Subtask
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
aau-giraf/foodplanner-api#314 ·
メンテナーはふだん 1 日以内に返信