Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6ca28a8

Browse files
Alvaro Muñozpwntester
authored andcommitted
move md links to <a>
1 parent 27bd904 commit 6ca28a8

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

java/ql/src/experimental/Security/CWE/CWE-094/InsecureBeanValidation.qhelp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
<qhelp>
55

66
<overview>
7-
<p>Bean validation custom constraint error messages support different types of interpolation, including [Java EL expressions](https://docs.jboss.org/hibernate/validator/5.1/reference/en-US/html/chapter-message-interpolation.html#section-interpolation-with-message-expressions).
8-
Controlling part of the error message template being passed to `ConstraintValidatorContext.buildConstraintViolationWithTemplate()` argument will lead to arbitrary Java code execution.
9-
Unfortunately, it is common that validated (and therefore, normally untrusted) bean properties flow into the custom error message.</p>
7+
<p>Bean validation custom constraint error messages support different types of interpolation,
8+
including <a href="https://docs.jboss.org/hibernate/validator/5.1/reference/en-US/html/chapter-message-interpolation.html#section-interpolation-with-message-expressions">Java EL expressions</a>.
9+
Controlling part of the message template being passed to `ConstraintValidatorContext.buildConstraintViolationWithTemplate()`
10+
argument will lead to arbitrary Java code execution. Unfortunately, it is common that validated (and therefore, normally
11+
untrusted) bean properties flow into the custom error message.</p>
1012
</overview>
1113

1214
<recommendation>
@@ -18,7 +20,8 @@ HibernateConstraintValidatorContext context = constraintValidatorContext.unwrap(
1820
context.addMessageParameter( "foo", "bar" );
1921
context.buildConstraintViolationWithTemplate( "My violation message contains a parameter {foo}").addConstraintViolation();
2022
```
21-
<li>Sanitize the validated bean properties to make sure that there are no EL expressions. An example of valid sanitization logic can be found [here](https://github.com/hibernate/hibernate-validator/blob/master/engine/src/main/java/org/hibernate/validator/internal/engine/messageinterpolation/util/InterpolationHelper.java#L17).
23+
<li>Sanitize the validated bean properties to make sure that there are no EL expressions. An example of valid sanitization
24+
logic can be found <a href="https://github.com/hibernate/hibernate-validator/blob/master/engine/src/main/java/org/hibernate/validator/internal/engine/messageinterpolation/util/InterpolationHelper.java#L17">here</a>.
2225
- Disable the EL interpolation and only use `ParameterMessageInterpolator`:</li>
2326
``` java
2427
Validator validator = Validation.byDefaultProvider()
@@ -27,7 +30,8 @@ Validator validator = Validation.byDefaultProvider()
2730
.buildValidatorFactory()
2831
.getValidator();
2932
```
30-
<li>Replace Hibernate-Validator with Apache BVal which in its latest version does not interpolate EL expressions by default. Note that this replacement may not be a simple drop-in replacement.</li>
33+
<li>Replace Hibernate-Validator with Apache BVal which in its latest version does not interpolate EL expressions by default.
34+
Note that this replacement may not be a simple drop-in replacement.</li>
3135
</recommendation>
3236

3337
<example>

0 commit comments

Comments
 (0)