DATACMNS-1285 - PropertyPath now limits the depth of its parsing to 1000 segments.
This commit is contained in:
@@ -369,6 +369,23 @@ public class PropertyPathUnitTests {
|
||||
.withMessageContaining("Bar.user");
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1285
|
||||
public void rejectsTooLongPath() {
|
||||
|
||||
String source = "foo.bar";
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
source = source + "." + source;
|
||||
}
|
||||
|
||||
assertThat(source.split("\\.").length).isGreaterThan(1000);
|
||||
|
||||
final String path = source;
|
||||
|
||||
assertThatExceptionOfType(IllegalArgumentException.class) //
|
||||
.isThrownBy(() -> PropertyPath.from(path, Left.class));
|
||||
}
|
||||
|
||||
private class Foo {
|
||||
|
||||
String userName;
|
||||
@@ -403,4 +420,14 @@ public class PropertyPathUnitTests {
|
||||
private FooBar user;
|
||||
private Foo _foo;
|
||||
}
|
||||
|
||||
// DATACMNS-1285
|
||||
|
||||
private class Left {
|
||||
Right foo;
|
||||
}
|
||||
|
||||
private class Right {
|
||||
Left bar;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user