Bug 1900390 - use regex_match for DLP regex's r=dlp-reviewers,handyman

Differential Revision: https://phabricator.services.mozilla.com/D212437
This commit is contained in:
Greg Stoll 2024-06-04 23:43:12 +00:00
parent 6f4b15e60d
commit fdc5c7d608

View file

@ -881,7 +881,7 @@ ContentAnalysis::UrlFilterResult ContentAnalysis::FilterByUrlLists(
std::string url = urlString.BeginReading(); std::string url = urlString.BeginReading();
size_t count = 0; size_t count = 0;
for (const auto& denyFilter : mDenyUrlList) { for (const auto& denyFilter : mDenyUrlList) {
if (std::regex_search(url, denyFilter)) { if (std::regex_match(url, denyFilter)) {
LOGD("Denying CA request : Deny filter %zu matched url %s", count, LOGD("Denying CA request : Deny filter %zu matched url %s", count,
url.c_str()); url.c_str());
return UrlFilterResult::eDeny; return UrlFilterResult::eDeny;
@ -921,7 +921,7 @@ ContentAnalysis::UrlFilterResult ContentAnalysis::FilterByUrlLists(
std::string url = NS_ConvertUTF16toUTF8(nsUrl).get(); std::string url = NS_ConvertUTF16toUTF8(nsUrl).get();
count = 0; count = 0;
for (auto& denyFilter : mDenyUrlList) { for (auto& denyFilter : mDenyUrlList) {
if (std::regex_search(url, denyFilter)) { if (std::regex_match(url, denyFilter)) {
LOGD( LOGD(
"Denying CA request : Deny filter %zu matched download resource " "Denying CA request : Deny filter %zu matched download resource "
"at url %s", "at url %s",
@ -934,7 +934,7 @@ ContentAnalysis::UrlFilterResult ContentAnalysis::FilterByUrlLists(
count = 0; count = 0;
bool removed = false; bool removed = false;
for (auto& allowFilter : mAllowUrlList) { for (auto& allowFilter : mAllowUrlList) {
if (std::regex_search(url, allowFilter)) { if (std::regex_match(url, allowFilter)) {
LOGD( LOGD(
"CA request : Allow filter %zu matched download resource " "CA request : Allow filter %zu matched download resource "
"at url %s", "at url %s",