diff options
author | ToineSiebelink <toine.siebelink@est.tech> | 2021-04-06 16:44:14 +0100 |
---|---|---|
committer | ToineSiebelink <toine.siebelink@est.tech> | 2021-04-06 17:03:59 +0100 |
commit | 6e4ce6970552917c0f35617164017d93bd6b2f1b (patch) | |
tree | 8d88ebf02f2873ad54b6e629e0ac3f3c86c334a3 /cps-ri/src/main | |
parent | a3ceacb9ebf11c6467d66c0f42af714ef93591c2 (diff) |
Fix security hotspots n Regex
Attemting to fix security risks indentified by SQ by reducing unlimited spaces to 0-9 spaces
See https://sonarcloud.io/project/security_hotspots?id=onap_cps#
I think the proposed regex changes are acceptable and better then adding @SupressWarning annotation
(have to test by merging this commit as issues are not spotted when using SonarLinit locally?!)
Issue-ID: CPS-89
Change-Id: I00bbacb3145650ab7d21d13152c08d5ccf0c04fa
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
Diffstat (limited to 'cps-ri/src/main')
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/spi/query/CpsPathQuery.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/query/CpsPathQuery.java b/cps-ri/src/main/java/org/onap/cps/spi/query/CpsPathQuery.java index 7b9bfba174..97a304d763 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/query/CpsPathQuery.java +++ b/cps-ri/src/main/java/org/onap/cps/spi/query/CpsPathQuery.java @@ -39,7 +39,8 @@ public class CpsPathQuery { private static final String NON_CAPTURING_GROUP_1_TO_99_YANG_CONTAINERS = "((?:\\/[^\\/]+){1,99})"; - private static final String YANG_LEAF_VALUE_EQUALS_CONDITION = "\\[\\s*@(\\S+?)\\s*=\\s*(.*?)\\s*\\]"; + private static final String YANG_LEAF_VALUE_EQUALS_CONDITION = + "\\[\\s{0,9}@(\\S+?)\\s{0,9}=\\s{0,9}(.*?)\\s{0,9}\\]"; private static final Pattern QUERY_CPS_PATH_WITH_SINGLE_LEAF_PATTERN = Pattern.compile(NON_CAPTURING_GROUP_1_TO_99_YANG_CONTAINERS + YANG_LEAF_VALUE_EQUALS_CONDITION); |