#include "services/network/public/cpp/content_security_policy/csp_source_list.h"
#include "base/check_op.h"
#include "base/containers/flat_set.h"
#include "base/feature_list.h"
#include "base/ranges/algorithm.h"
#include "services/network/public/cpp/content_security_policy/content_security_policy.h"
#include "services/network/public/cpp/content_security_policy/csp_source.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/content_security_policy.mojom-shared.h"
namespace network {
CSPDirectiveName;
namespace {
bool AllowFromSources(const GURL& url,
const std::vector<mojom::CSPSourcePtr>& sources,
const mojom::CSPSource& self_source,
bool has_followed_redirect,
bool is_opaque_fenced_frame) { … }
void IntersectNonces(base::flat_set<std::string>& a,
const base::flat_set<std::string>& b) { … }
void IntersectHashes(base::flat_set<mojom::CSPHashSourcePtr>& a,
const base::flat_set<mojom::CSPHashSourcePtr>& b) { … }
bool IsScriptDirective(CSPDirectiveName directive) { … }
bool IsStyleDirective(CSPDirectiveName directive) { … }
bool AllowAllInline(CSPDirectiveName directive,
const mojom::CSPSourceList& source) { … }
void AddSourceSchemesToSet(base::flat_set<std::string>& set,
const mojom::CSPSource* source) { … }
base::flat_set<std::string> IntersectSchemesOnly(
const std::vector<mojom::CSPSourcePtr>& list_a,
const std::vector<mojom::CSPSourcePtr>& list_b) { … }
std::vector<mojom::CSPSourcePtr> ExpandSchemeStarAndSelf(
const mojom::CSPSourceList& source_list,
const mojom::CSPSource* self) { … }
std::vector<mojom::CSPSourcePtr> IntersectSources(
const mojom::CSPSourceList& source_list_a,
const std::vector<mojom::CSPSourcePtr>& source_list_b,
const mojom::CSPSource* self) { … }
bool UrlSourceListSubsumes(
const std::vector<mojom::CSPSourcePtr>& source_list_a,
const std::vector<mojom::CSPSourcePtr>& source_list_b) { … }
}
CSPCheckResult CheckCSPSourceList(mojom::CSPDirectiveName directive_name,
const mojom::CSPSourceList& source_list,
const GURL& url,
const mojom::CSPSource& self_source,
bool has_followed_redirect,
bool is_response_check,
bool is_opaque_fenced_frame) { … }
bool CSPSourceListSubsumes(
const mojom::CSPSourceList& source_list_a,
const std::vector<const mojom::CSPSourceList*>& source_list_b,
CSPDirectiveName directive,
const mojom::CSPSource* origin_b) { … }
std::string ToString(const mojom::CSPSourceListPtr& source_list) { … }
}