Set deafult policy order placament

This commit is contained in:
Ned Wright 2023-12-19 15:22:43 +02:00
parent 7bf05192b3
commit 16ad370409
3 changed files with 8 additions and 2 deletions

View File

@ -539,6 +539,8 @@ bool
WebAppSection::operator<(const WebAppSection &other) const WebAppSection::operator<(const WebAppSection &other) const
{ {
// for sorting from the most specific to the least specific rule // for sorting from the most specific to the least specific rule
if (application_urls == default_appsec_url) return false;
if (other.application_urls == default_appsec_url) return true;
return application_urls.size() > other.application_urls.size(); return application_urls.size() > other.application_urls.size();
} }
@ -575,6 +577,8 @@ bool
WebAPISection::operator<(const WebAPISection &other) const WebAPISection::operator<(const WebAPISection &other) const
{ {
// for sorting from the most specific to the least specific rule // for sorting from the most specific to the least specific rule
if (application_urls == default_appsec_url) return false;
if (other.application_urls == default_appsec_url) return true;
return application_urls.size() > other.application_urls.size(); return application_urls.size() > other.application_urls.size();
} }

View File

@ -56,6 +56,8 @@ static const std::unordered_map<std::string, std::string> key_to_practices_val =
{ "inactive", "Inactive"} { "inactive", "Inactive"}
}; };
static const std::string default_appsec_url = "http://*:*";
template <typename T> template <typename T>
void void
parseAppsecJSONKey( parseAppsecJSONKey(

View File

@ -1190,7 +1190,7 @@ PolicyMakerUtils::createWebAppSection(
apssec_practice.getWebAttacks().getMaxUrlSizeBytes() apssec_practice.getWebAttacks().getMaxUrlSizeBytes()
); );
WebAppSection web_app = WebAppSection( WebAppSection web_app = WebAppSection(
full_url == "Any" ? "http://*:*" : full_url, full_url == "Any" ? default_appsec_url : full_url,
rule_config.getAssetId(), rule_config.getAssetId(),
rule_config.getAssetName(), rule_config.getAssetName(),
rule_config.getAssetId(), rule_config.getAssetId(),
@ -1462,7 +1462,7 @@ PolicyMakerUtils::createPolicyElementsByRule(
if (!web_apps.count(rule_config.getAssetName())) { if (!web_apps.count(rule_config.getAssetName())) {
WebAppSection web_app = WebAppSection( WebAppSection web_app = WebAppSection(
full_url == "Any" ? "http://*:*" : full_url, full_url == "Any" ? default_appsec_url : full_url,
rule_config.getAssetId(), rule_config.getAssetId(),
rule_config.getAssetName(), rule_config.getAssetName(),
rule_config.getAssetId(), rule_config.getAssetId(),