This is an automated email from the ASF dual-hosted git repository. nixon pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/atlas.git
commit e97fb302231a3b452d99cd892a75a09b9499d24a Author: Pinal Shah <[email protected]> AuthorDate: Fri Jul 10 15:28:30 2020 +0530 ATLAS-3888 : BasicSearch: Multiple type/tag: [Regression], Restrict when tag filters and regex in tag Signed-off-by: nixonrodrigues <[email protected]> (cherry picked from commit d9d0e8c2abe293a520f89b85015d9c52985e28cb) --- .../main/java/org/apache/atlas/discovery/SearchContext.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/repository/src/main/java/org/apache/atlas/discovery/SearchContext.java b/repository/src/main/java/org/apache/atlas/discovery/SearchContext.java index dd24a8c..2cb287f 100644 --- a/repository/src/main/java/org/apache/atlas/discovery/SearchContext.java +++ b/repository/src/main/java/org/apache/atlas/discovery/SearchContext.java @@ -106,6 +106,17 @@ public class SearchContext { } } + //Wildcard tag with filter will raise an exception with 400 error code + if (CollectionUtils.isNotEmpty(classificationNames) && hasAttributeFilter(searchParameters.getTagFilters())) { + for (String classificationName : classificationNames){ + //in case of '*' , filters are allowed, but + //in case of regex 'PI*', filters are not allowed ( if present in any of the requested tag) + if (classificationName.contains(WILDCARD_CLASSIFICATIONS) && !classificationName.equals(WILDCARD_CLASSIFICATIONS)) { + throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "TagFilters specified with wildcard tag name"); + } + } + } + // Invalid attributes will raise an exception with 400 error code if (CollectionUtils.isNotEmpty(classificationTypes)) { for (AtlasClassificationType classificationType : classificationTypes) {
