diff --git a/apps/mini-runtime/src/main/java/com/akto/hybrid_runtime/APICatalogSync.java b/apps/mini-runtime/src/main/java/com/akto/hybrid_runtime/APICatalogSync.java index eb3774f0af..7b88aeec6c 100644 --- a/apps/mini-runtime/src/main/java/com/akto/hybrid_runtime/APICatalogSync.java +++ b/apps/mini-runtime/src/main/java/com/akto/hybrid_runtime/APICatalogSync.java @@ -804,9 +804,12 @@ public static String[] tokenize(String url) { } Map convertToMap(List l) { + Set mergedUrls = dataActor.fetchMergedUrls(); Map ret = new HashMap<>(); for(SingleTypeInfo e: l) { - ret.put(e.composeKey(), e); + if(!mergedUrls.contains(new MergedUrls(e.getUrl(), e.getMethod(), e.getApiCollectionId()))) { + ret.put(e.composeKey(), e); + } } return ret; diff --git a/apps/mini-runtime/src/main/java/com/akto/hybrid_runtime/policies/AktoPolicyNew.java b/apps/mini-runtime/src/main/java/com/akto/hybrid_runtime/policies/AktoPolicyNew.java index 2761727d50..4cca272ab8 100644 --- a/apps/mini-runtime/src/main/java/com/akto/hybrid_runtime/policies/AktoPolicyNew.java +++ b/apps/mini-runtime/src/main/java/com/akto/hybrid_runtime/policies/AktoPolicyNew.java @@ -4,6 +4,7 @@ import com.akto.dao.context.Context; import com.akto.dto.*; import com.akto.dto.ApiInfo.ApiInfoKey; +import com.akto.dto.filter.MergedUrls; import com.akto.dto.runtime_filters.RuntimeFilter; import com.akto.runtime.policies.*; import com.akto.dto.type.APICatalog; @@ -35,7 +36,7 @@ public class AktoPolicyNew { ApiAccessTypePolicy apiAccessTypePolicy = new ApiAccessTypePolicy(null, null); boolean redact = false; - private DataActor dataActor = DataActorFactory.fetchInstance(); + private static DataActor dataActor = DataActorFactory.fetchInstance(); private static final LoggerMaker loggerMaker = new LoggerMaker(AktoPolicyNew.class); @@ -257,7 +258,15 @@ public static List getUpdates(Map apiInfoCatal for (ApiInfoCatalog apiInfoCatalog: apiInfoCatalogMap.values()) { Map strictURLToMethods = apiInfoCatalog.getStrictURLToMethods(); - Map templateURLToMethods = apiInfoCatalog.getTemplateURLToMethods(); + Map templateURLToMethods = new HashMap<>(); + + Set mergedUrls = dataActor.fetchMergedUrls(); + for(Map.Entry templateURLToMethodEntry : apiInfoCatalog.getTemplateURLToMethods().entrySet()) { + ApiInfoKey apiInfoKey = templateURLToMethodEntry.getValue().getApiInfo().getId(); + if(!mergedUrls.contains(new MergedUrls(apiInfoKey.getUrl(), apiInfoKey.getMethod().name(), apiInfoKey.getApiCollectionId()))) { + templateURLToMethods.put(templateURLToMethodEntry.getKey(), templateURLToMethodEntry.getValue()); + } + } List policyCatalogList = new ArrayList<>(); policyCatalogList.addAll(strictURLToMethods.values());