Skip to content

Commit

Permalink
Merge pull request #1913 from akto-api-security/hotfix/fix_queries_on…
Browse files Browse the repository at this point in the history
…_deactivated

Fixing queries on basis of collection ids
  • Loading branch information
notshivansh authored Jan 4, 2025
2 parents c8d3134 + a5d16e0 commit 4409348
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ public String fetchSensitiveInfoInCollections(){
sensitiveSubtypes.addAll(SingleTypeInfoDao.instance.sensitiveSubTypeNames());

List<String> sensitiveSubtypesInRequest = SingleTypeInfoDao.instance.sensitiveSubTypeInRequestNames();
this.sensitiveUrlsInResponse = SingleTypeInfoDao.instance.getSensitiveApisCount(sensitiveSubtypes, true, Filters.nin(SingleTypeInfo._COLLECTION_IDS, deactivatedCollections));
this.sensitiveUrlsInResponse = SingleTypeInfoDao.instance.getSensitiveApisCount(sensitiveSubtypes, true, Filters.nin(SingleTypeInfo._API_COLLECTION_ID, deactivatedCollections));

sensitiveSubtypes.addAll(sensitiveSubtypesInRequest);
this.sensitiveSubtypesInCollection = SingleTypeInfoDao.instance.getSensitiveSubtypesDetectedForCollection(sensitiveSubtypes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ public String getCountOfApiVsDataType(){
BasicDBObject groupedId = new BasicDBObject(SingleTypeInfo._API_COLLECTION_ID, "$apiCollectionId")
.append(SingleTypeInfo._URL, "$url")
.append(SingleTypeInfo._METHOD, "$method");
Bson customFilter = Filters.nin(SingleTypeInfo._COLLECTION_IDS, UsageMetricCalculator.getDeactivated());
Bson customFilter = Filters.nin(SingleTypeInfo._API_COLLECTION_ID, UsageMetricCalculator.getDeactivated());

List<String> sensitiveSubtypes = SingleTypeInfoDao.instance.sensitiveSubTypeInResponseNames();
sensitiveSubtypes.addAll(SingleTypeInfoDao.instance.sensitiveSubTypeNames());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public String fetchApiInfosFromSTIs(){
if(collection.getHostName() == null || collection.getHostName().isEmpty()){
Bson filter = Filters.and(
Filters.in(SingleTypeInfo._COLLECTION_IDS, apiCollectionId),
Filters.nin(SingleTypeInfo._COLLECTION_IDS, deactivatedCollections)
Filters.nin(SingleTypeInfo._API_COLLECTION_ID, deactivatedCollections)
);
list = ApiCollectionsDao.fetchEndpointsInCollection(filter, 0, -1, Utils.DELTA_PERIOD_VALUE);
}else{
Expand All @@ -373,7 +373,7 @@ public String fetchApiInfosForCollection(){
List<ApiInfo> apiInfos = ApiInfoDao.instance.findAll(
Filters.and(
Filters.in(SingleTypeInfo._COLLECTION_IDS, apiCollectionId),
Filters.nin(SingleTypeInfo._COLLECTION_IDS, deactivatedCollections)
Filters.nin(ApiInfo.ID_API_COLLECTION_ID, deactivatedCollections)
));
for(ApiInfo apiInfo: apiInfos){
apiInfo.calculateActualAuth();
Expand Down Expand Up @@ -488,7 +488,7 @@ public String loadSensitiveParameters() {
if (apiCollectionId != -1) {
Bson apiCollectionIdFilter = Filters.and(
Filters.in(SingleTypeInfo._COLLECTION_IDS, apiCollectionId),
Filters.nin(SingleTypeInfo._COLLECTION_IDS, deactivatedCollections)
Filters.nin(SingleTypeInfo._API_COLLECTION_ID, deactivatedCollections)
);
filterCustomSensitiveParams.add(apiCollectionIdFilter);
}
Expand Down

0 comments on commit 4409348

Please sign in to comment.