Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Side by Side Diff: third_party/WebKit/Source/core/frame/csp/CSPSource.h

Issue 2487983003: Part 2.3: Is policy list subsumed under subsuming policy? (Closed)
Patch Set: Properly handling scheme-source to scheme-source matching Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CSPSource_h 5 #ifndef CSPSource_h
6 #define CSPSource_h 6 #define CSPSource_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/frame/csp/ContentSecurityPolicy.h" 9 #include "core/frame/csp/ContentSecurityPolicy.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
(...skipping 10 matching lines...) Expand all
21 public: 21 public:
22 enum WildcardDisposition { HasWildcard, NoWildcard }; 22 enum WildcardDisposition { HasWildcard, NoWildcard };
23 23
24 CSPSource(ContentSecurityPolicy*, 24 CSPSource(ContentSecurityPolicy*,
25 const String& scheme, 25 const String& scheme,
26 const String& host, 26 const String& host,
27 int port, 27 int port,
28 const String& path, 28 const String& path,
29 WildcardDisposition hostWildcard, 29 WildcardDisposition hostWildcard,
30 WildcardDisposition portWildcard); 30 WildcardDisposition portWildcard);
31 bool isSchemeOnly() const;
31 bool matches(const KURL&, 32 bool matches(const KURL&,
32 ResourceRequest::RedirectStatus = 33 ResourceRequest::RedirectStatus =
33 ResourceRequest::RedirectStatus::NoRedirect) const; 34 ResourceRequest::RedirectStatus::NoRedirect) const;
34 35
35 // Returns true if this CSPSource subsumes the other, as defined by the 36 // Returns true if this CSPSource subsumes the other, as defined by the
36 // algorithm at https://w3c.github.io/webappsec-csp/embedded/#subsume-policy 37 // algorithm at https://w3c.github.io/webappsec-csp/embedded/#subsume-policy
37 bool subsumes(CSPSource*); 38 bool subsumes(CSPSource*);
38 // Retrieve the most restrictive information from the two CSPSources if 39 // Retrieve the most restrictive information from the two CSPSources if
39 // isSimilar is true for the two. Otherwise, return nullptr. 40 // isSimilar is true for the two. Otherwise, return nullptr.
40 CSPSource* intersect(CSPSource*); 41 CSPSource* intersect(CSPSource*);
41 42
42 DECLARE_TRACE(); 43 DECLARE_TRACE();
43 44
44 private: 45 private:
45 FRIEND_TEST_ALL_PREFIXES(CSPSourceTest, IsSimilar); 46 FRIEND_TEST_ALL_PREFIXES(CSPSourceTest, IsSimilar);
46 FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, GetIntersectCSPSources); 47 FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest, GetIntersectCSPSources);
48 FRIEND_TEST_ALL_PREFIXES(SourceListDirectiveTest,
49 GetIntersectCSPSourcesSchemes);
47 50
48 bool schemeMatches(const String&) const; 51 bool schemeMatches(const String&) const;
49 bool hostMatches(const String&) const; 52 bool hostMatches(const String&) const;
50 bool pathMatches(const String&) const; 53 bool pathMatches(const String&) const;
51 // Protocol is necessary to determine default port if it is zero. 54 // Protocol is necessary to determine default port if it is zero.
52 bool portMatches(int port, const String& protocol) const; 55 bool portMatches(int port, const String& protocol) const;
53 bool isSchemeOnly() const;
54 bool isSimilar(CSPSource* other); 56 bool isSimilar(CSPSource* other);
55 57
56 Member<ContentSecurityPolicy> m_policy; 58 Member<ContentSecurityPolicy> m_policy;
57 String m_scheme; 59 String m_scheme;
58 String m_host; 60 String m_host;
59 int m_port; 61 int m_port;
60 String m_path; 62 String m_path;
61 63
62 WildcardDisposition m_hostWildcard; 64 WildcardDisposition m_hostWildcard;
63 WildcardDisposition m_portWildcard; 65 WildcardDisposition m_portWildcard;
64 }; 66 };
65 67
66 } // namespace blink 68 } // namespace blink
67 69
68 #endif 70 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698