Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
204 additions
and 73 deletions.
- +67 −20 components/prism-csp.js
- +1 −1 components/prism-csp.min.js
- +1 −1 tests/languages/csp/directive_no_value_feature.test
- +14 −9 tests/languages/csp/directive_with_source_expression_feature.test
- +8 −0 tests/languages/csp/hash_feature.test
- +46 −0 tests/languages/csp/host_feature.test
- +4 −1 tests/languages/csp/issue2661.test
- +16 −0 tests/languages/csp/keyword_safe_feature.html.test
- +20 −0 tests/languages/csp/keyword_unsafe_feature.html.test
- +9 −0 tests/languages/csp/nonce_feature.test
- +8 −0 tests/languages/csp/none_feature.test
- +0 −20 tests/languages/csp/safe_feature.test
- +10 −0 tests/languages/csp/scheme_feature.test
- +0 −21 tests/languages/csp/unsafe_feature.test
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -4,7 +4,7 @@ upgrade-insecure-requests; | ||
|
||
[ | ||
["directive", "upgrade-insecure-requests"], | ||
["punctuation", ";"] | ||
] | ||
|
||
---------------------------------------------------- | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,8 @@ | ||
style-src 'sha256-EpOpN/ahUF6jhWShDUdy+NvvtaGcu5F7qM6+x2mfkh4=' | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["directive", "style-src"], | ||
["hash", "'sha256-EpOpN/ahUF6jhWShDUdy+NvvtaGcu5F7qM6+x2mfkh4='"] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,46 @@ | ||
default-src trusted.com *.trusted.com; | ||
img-src *; | ||
media-src media1.com media2.com; | ||
script-src userscripts.example.com; | ||
frame-ancestors https://alice https://bob; | ||
frame-ancestors https://example.com/; | ||
|
||
sandbox allow-scripts; | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["directive", "default-src"], | ||
["host", ["trusted.com"]], | ||
["host", [ | ||
["important", "*"], | ||
".trusted.com" | ||
]], | ||
["punctuation", ";"], | ||
|
||
["directive", "img-src"], | ||
["host", [ | ||
["important", "*"] | ||
]], | ||
["punctuation", ";"], | ||
|
||
["directive", "media-src"], | ||
["host", ["media1.com"]], | ||
["host", ["media2.com"]], | ||
["punctuation", ";"], | ||
|
||
["directive", "script-src"], | ||
["host", ["userscripts.example.com"]], | ||
["punctuation", ";"], | ||
|
||
["directive", "frame-ancestors"], | ||
["host", ["https://alice"]], | ||
["host", ["https://bob"]], | ||
["punctuation", ";"], | ||
|
||
["directive", "frame-ancestors"], | ||
["host", ["https://example.com/"]], | ||
["punctuation", ";"], | ||
|
||
["directive", "sandbox"], " allow-scripts", ["punctuation", ";"] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,16 @@ | ||
default-src 'report-sample'; | ||
style-src 'self' 'strict-dynamic'; | ||
|
||
---------------------------------------------------- | ||
|
||
<span class="token directive property">default-src</span> | ||
<span class="token keyword safe">'report-sample'</span> | ||
<span class="token punctuation">;</span> | ||
<span class="token directive property">style-src</span> | ||
<span class="token keyword safe">'self'</span> | ||
<span class="token keyword safe">'strict-dynamic'</span> | ||
<span class="token punctuation">;</span> | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for source expressions classified as safe. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,20 @@ | ||
navigate-to 'unsafe-allow-redirects'; | ||
script-src 'unsafe-dynamic' 'unsafe-eval' 'unsafe-hash-attributes' 'unsafe-hashed-attributes' 'unsafe-hashes' 'unsafe-inline'; | ||
|
||
---------------------------------------------------- | ||
|
||
<span class="token directive property">navigate-to</span> | ||
<span class="token keyword unsafe">'unsafe-allow-redirects'</span> | ||
<span class="token punctuation">;</span> | ||
<span class="token directive property">script-src</span> | ||
<span class="token keyword unsafe">'unsafe-dynamic'</span> | ||
<span class="token keyword unsafe">'unsafe-eval'</span> | ||
<span class="token keyword unsafe">'unsafe-hash-attributes'</span> | ||
<span class="token keyword unsafe">'unsafe-hashed-attributes'</span> | ||
<span class="token keyword unsafe">'unsafe-hashes'</span> | ||
<span class="token keyword unsafe">'unsafe-inline'</span> | ||
<span class="token punctuation">;</span> | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for source expressions classified as unsafe. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,9 @@ | ||
style-src 'nonce-yeah'; | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["directive", "style-src"], | ||
["nonce", "'nonce-yeah'"], | ||
["punctuation", ";"] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,8 @@ | ||
sandbox 'none' | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["directive", "sandbox"], | ||
["none", "'none'"] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,10 @@ | ||
default-src https: 'unsafe-inline' 'unsafe-eval' | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["directive", "default-src"], | ||
["scheme", "https:"], | ||
["keyword", "'unsafe-inline'"], | ||
["keyword", "'unsafe-eval'"] | ||
] |