Changeset 99383 in webkit
- Timestamp:
- Nov 6, 2011, 1:31:45 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-allow-scripts-expected.txt (added)
-
LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-allow-scripts-subframe-expected.txt (added)
-
LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-allow-scripts-subframe.html (added)
-
LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-allow-scripts.html (added)
-
LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-empty-expected.txt (added)
-
LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-empty-subframe-expected.txt (added)
-
LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-empty-subframe.html (added)
-
LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-empty.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/page/ContentSecurityPolicy.cpp (modified) (4 diffs)
-
Source/WebCore/page/ContentSecurityPolicy.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r99380 r99383 1 2011-11-06 Adam Barth <abarth@webkit.org> 2 3 Implement the sandbox directive for CSP 4 https://bugs.webkit.org/show_bug.cgi?id=71604 5 6 Reviewed by Sam Weinig. 7 8 Test that the sandbox directive correctly wires up to the sandbox 9 flags. Also, test that the policy inherits into subframes. These are 10 essentially integration tests between the CSP and sandbox subsystems, 11 which is why they don't cover all the permutations of the sandbox 12 flags. Those are covered in more detail via tests of the sandbox 13 attribute. 14 15 * http/tests/security/contentSecurityPolicy/sandbox-allow-scripts-expected.txt: Added. 16 * http/tests/security/contentSecurityPolicy/sandbox-allow-scripts-subframe-expected.txt: Added. 17 * http/tests/security/contentSecurityPolicy/sandbox-allow-scripts-subframe.html: Added. 18 * http/tests/security/contentSecurityPolicy/sandbox-allow-scripts.html: Added. 19 * http/tests/security/contentSecurityPolicy/sandbox-empty-expected.txt: Added. 20 * http/tests/security/contentSecurityPolicy/sandbox-empty-subframe-expected.txt: Added. 21 * http/tests/security/contentSecurityPolicy/sandbox-empty-subframe.html: Added. 22 * http/tests/security/contentSecurityPolicy/sandbox-empty.html: Added. 23 1 24 2011-11-06 Ryosuke Niwa <rniwa@webkit.org> 2 25 -
trunk/Source/WebCore/ChangeLog
r99374 r99383 1 2011-11-06 Adam Barth <abarth@webkit.org> 2 3 Implement the sandbox directive for CSP 4 https://bugs.webkit.org/show_bug.cgi?id=71604 5 6 Reviewed by Sam Weinig. 7 8 At TPAC, Microsoft was pushing pretty hard to add the sandbox directive 9 to CSP. There's a question about whether it's going to be in CSP 1.0 10 or CSP 1.1, but it seems to be clearly headed into the spec. 11 12 This patch implements the sandbox directive for CSP. It's built on the 13 same machinery we use for the sandbox attribute for iframe. Now that 14 I've done the implementation, I'm going to write up some concrete text 15 for the spec. 16 17 Tests: http/tests/security/contentSecurityPolicy/sandbox-allow-scripts-subframe.html 18 http/tests/security/contentSecurityPolicy/sandbox-allow-scripts.html 19 http/tests/security/contentSecurityPolicy/sandbox-empty-subframe.html 20 http/tests/security/contentSecurityPolicy/sandbox-empty.html 21 22 * page/ContentSecurityPolicy.cpp: 23 (WebCore::ContentSecurityPolicy::ContentSecurityPolicy): 24 (WebCore::ContentSecurityPolicy::applySandboxPolicy): 25 (WebCore::ContentSecurityPolicy::addDirective): 26 * page/ContentSecurityPolicy.h: 27 1 28 2011-11-03 Filip Pizlo <fpizlo@apple.com> 2 29 -
trunk/Source/WebCore/page/ContentSecurityPolicy.cpp
r99143 r99383 487 487 , m_scriptExecutionContext(scriptExecutionContext) 488 488 , m_reportOnly(false) 489 , m_haveSandboxPolicy(false) 489 490 { 490 491 } … … 765 766 } 766 767 768 void ContentSecurityPolicy::applySandboxPolicy(const String& sandboxPolicy) 769 { 770 ASSERT(!m_haveSandboxPolicy); 771 m_haveSandboxPolicy = true; 772 m_scriptExecutionContext->enforceSandboxFlags(SecurityOrigin::parseSandboxPolicy(sandboxPolicy)); 773 } 774 767 775 void ContentSecurityPolicy::addDirective(const String& name, const String& value) 768 776 { … … 776 784 DEFINE_STATIC_LOCAL(String, mediaSrc, ("media-src")); 777 785 DEFINE_STATIC_LOCAL(String, connectSrc, ("connect-src")); 786 DEFINE_STATIC_LOCAL(String, sandbox, ("sandbox")); 778 787 DEFINE_STATIC_LOCAL(String, reportURI, ("report-uri")); 779 788 … … 798 807 else if (!m_connectSrc && equalIgnoringCase(name, connectSrc)) 799 808 m_connectSrc = createCSPDirective(name, value); 809 else if (!m_haveSandboxPolicy && equalIgnoringCase(name, sandbox)) 810 applySandboxPolicy(value); 800 811 else if (m_reportURLs.isEmpty() && equalIgnoringCase(name, reportURI)) 801 812 parseReportURI(value); -
trunk/Source/WebCore/page/ContentSecurityPolicy.h
r98316 r99383 74 74 void parseReportURI(const String&); 75 75 void addDirective(const String& name, const String& value); 76 void applySandboxPolicy(const String& sandboxPolicy); 76 77 77 78 PassOwnPtr<CSPDirective> createCSPDirective(const String& name, const String& value); … … 101 102 OwnPtr<CSPDirective> m_mediaSrc; 102 103 OwnPtr<CSPDirective> m_connectSrc; 104 bool m_haveSandboxPolicy; 103 105 Vector<KURL> m_reportURLs; 104 106 };
Note:
See TracChangeset
for help on using the changeset viewer.