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

Side by Side Diff: third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp

Issue 2526473005: Part 4.1: Is policy list subsumed under subsuming policy? (Closed)
Patch Set: Rebasing on master Created 4 years 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 /* 1 /*
2 * Copyright (C) 2011 Google, Inc. All rights reserved. 2 * Copyright (C) 2011 Google, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 if (name == "treat-as-public-address") 1588 if (name == "treat-as-public-address")
1589 return DirectiveType::TreatAsPublicAddress; 1589 return DirectiveType::TreatAsPublicAddress;
1590 if (name == "upgrade-insecure-requests") 1590 if (name == "upgrade-insecure-requests")
1591 return DirectiveType::UpgradeInsecureRequests; 1591 return DirectiveType::UpgradeInsecureRequests;
1592 if (name == "worker-src") 1592 if (name == "worker-src")
1593 return DirectiveType::WorkerSrc; 1593 return DirectiveType::WorkerSrc;
1594 1594
1595 return DirectiveType::Undefined; 1595 return DirectiveType::Undefined;
1596 } 1596 }
1597 1597
1598 bool ContentSecurityPolicy::subsumes(const ContentSecurityPolicy& other) {
1599 if (!m_policies.size() || !other.m_policies.size())
1600 return !m_policies.size();
1601 // Embedding-CSP must specify only one policy.
1602 if (m_policies.size() != 1)
1603 return false;
1604
1605 CSPDirectiveListVector otherVector;
1606 for (const auto& policy : other.m_policies) {
1607 if (!policy->isReportOnly())
1608 otherVector.append(policy);
1609 }
1610
1611 return m_policies[0]->subsumes(otherVector);
1612 }
1613
1598 } // namespace blink 1614 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698