Skip to content

Commit 5acb2d3

Browse files
committed
#2305 fix xpath regex check
1 parent 152178f commit 5acb2d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Components/XML/BExIS.Xml.Helpers/XmlUtility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static bool IsSafeXPath(string xpath)
2222
// Only allow XPaths like /a/b/c or /a[1]/b matches, no function calls, no quotes, etc.
2323
// You can adjust the pattern according to the actual requirements.
2424
// This only allows: /node1/node2/...
25-
var safePattern = @"^(/[a-zA-Z_][\w\-]*(\[\d+\])?)*$";
25+
var safePattern = @"^(/?/?[a-zA-Z_][\w\-]*(\[\d+\])?)*$";
2626
return System.Text.RegularExpressions.Regex.IsMatch(xpath, safePattern);
2727
}
2828

0 commit comments

Comments
 (0)