|
1 |
| -/** |
| 1 | +/* |
2 | 2 | * OWASP Enterprise Security API (ESAPI)
|
3 | 3 | *
|
4 | 4 | * This file is part of the Open Worldwide Application Security Project (OWASP)
|
@@ -298,34 +298,87 @@ public interface Validator {
|
298 | 298 | Date getValidDate(String context, String input, DateFormat format, boolean allowNull, ValidationErrorList errorList) throws IntrusionException;
|
299 | 299 |
|
300 | 300 | /**
|
301 |
| - * Returns true if {@code input} is valid. |
| 301 | + * Returns {@code true} if the parameter {@code input} is valid and <i>presumably</i> safe. |
302 | 302 | * <p>
|
303 |
| - * Calls {@link #getValidSafeHTML(String, String, int, boolean)}, |
304 |
| - * and returns true if no exceptions are thrown. |
| 303 | + * <b>WARNING:</b> Note that the only safe way to use this method is if you |
| 304 | + * instead of using the passed-in parameter '{@code input}' (which should |
| 305 | + * not be completely trusted as-is, regardless of whether this method returns |
| 306 | + * {@code true}), you first sanitize (i.e., cleanse) the parameter '{@code input}' |
| 307 | + * by first by calling one of the {@code getValidSafeHTML} methods on it. For |
| 308 | + * additional details explaining the rationale for this, please see the referenced |
| 309 | + * ESAPI Security Bulletin 12 in the referenced GitHub Security Advisory |
| 310 | + * mentioned in the "See Also" section below. |
305 | 311 | *
|
306 |
| - * @throws IntrusionException Input likely indicates an attack. |
| 312 | + * @param context |
| 313 | + * A descriptive tag name for the input that you are validating (e.g., user_comment). |
| 314 | + * This value is used by any logging or error handling that is done with respect to the value passed in. |
| 315 | + * @param input |
| 316 | + * The actual user input data to validate. Note that the expectation |
| 317 | + * is that this input is allowed to contain "safe" HTML markup, |
| 318 | + * otherwise you should not be using this {@code Validator} method |
| 319 | + * at all. |
| 320 | + * @param maxLength |
| 321 | + * The maximum {@code String} length allowed for {@code input}. |
| 322 | + * @param allowNull |
| 323 | + * If {@code allowNull} is true then an input that is NULL or an empty string will be legal. |
| 324 | + * If {@code allowNull} is false then NULL or an empty String will throw a ValidationException. |
| 325 | + * |
| 326 | + * @return True if the {@code input} is <i>presumably</i> safe, otherwise false. |
| 327 | + * |
| 328 | + * @throws IntrusionException The parameter {@code input} likely indicates an attack. |
307 | 329 | *
|
308 | 330 | * @deprecated Deprecated as of ESAPI 2.5.3.0. This method will be removed in 1 year
|
309 |
| - * after this ESAPI 2.5.3.0 release. |
| 331 | + * after the ESAPI 2.5.3.0 release date (2023-11-24). |
310 | 332 | *
|
311 |
| - * @see <a href="https://github.com/ESAPI/esapi-java-legacy/security/advisories/GHSA-r68h-jhhj-9jvm">GitHub Security Advisory: Validator.isValidSafeHTML is being deprecated and will be deleted in 1 year</a> |
312 |
| - */ |
| 333 | + * @see <a href="https://github.com/ESAPI/esapi-java-legacy/security/advisories/GHSA-r68h-jhhj-9jvm" |
| 334 | + * target="_blank" rel="noreferrer noopener">GitHub Security Advisory: Validator.isValidSafeHTML |
| 335 | + * is being deprecated and will be deleted in 1 year</a> |
| 336 | + */ |
313 | 337 | @Deprecated
|
314 | 338 | boolean isValidSafeHTML(String context, String input, int maxLength, boolean allowNull) throws IntrusionException;
|
315 | 339 |
|
316 | 340 | /**
|
317 |
| - * Returns true if {@code input} is valid, |
318 |
| - * any validation exceptions are added to the supplied {@code errorList}. |
| 341 | + * Returns {@code true} if the parameter {@code input} is valid and <i>presumably</i> safe. |
| 342 | + * Any exceptions are added to the supplied {@code errorList} parameter. |
| 343 | + * <p> |
319 | 344 | * <p>
|
320 |
| - * Calls {@link #getValidSafeHTML(String, String, int, boolean)} |
| 345 | + * Calls {@link #getValidSafeHTML(String, String, int, boolean)}, |
321 | 346 | * and returns true if no exceptions are thrown.
|
| 347 | + * <p> |
| 348 | + * <b>WARNING:</b> Note that the only safe way to use this method is if you |
| 349 | + * instead of using the passed-in parameter '{@code input}' (which should |
| 350 | + * not be completely trusted as-is, regardless of whether this method returns |
| 351 | + * {@code true}), you first sanitize (i.e., cleanse) the parameter '{@code input}' |
| 352 | + * by first by calling one of the {@code getValidSafeHTML} methods on it. For |
| 353 | + * additional details explaining the rationale for this, please see the referenced |
| 354 | + * ESAPI Security Bulletin 12 in the referenced GitHub Security Advisory |
| 355 | + * mentioned in the "See Also" section below. |
322 | 356 | *
|
323 |
| - * @throws IntrusionException Input likely indicates an attack. |
| 357 | + * @param context |
| 358 | + * A descriptive tag name for the input that you are validating (e.g., user_comment). |
| 359 | + * This value is used by any logging or error handling that is done with respect to the value passed in. |
| 360 | + * @param input |
| 361 | + * The actual user input data to validate. Note that the expectation |
| 362 | + * is that this input is allowed to contain "safe" HTML markup, |
| 363 | + * otherwise you should not be using this {@code Validator} method |
| 364 | + * at all. |
| 365 | + * @param maxLength |
| 366 | + * The maximum {@code String} length allowed for {@code input}. |
| 367 | + * @param allowNull |
| 368 | + * If {@code allowNull} is true then an input that is NULL or an empty string will be legal. |
| 369 | + * If {@code allowNull} is false then NULL or an empty String will throw a ValidationException. |
| 370 | + * @param errorList The error list to which any {@code ValidationException} messages are added. |
| 371 | + * |
| 372 | + * @return True if the {@code input} is <i>presumably</i> safe, otherwise false. |
| 373 | + * |
| 374 | + * @throws IntrusionException The parameter {@code input} likely indicates an attack. |
324 | 375 | *
|
325 | 376 | * @deprecated Deprecated as of ESAPI 2.5.3.0. This method will be removed in 1 year
|
326 |
| - * after this ESAPI 2.5.3.0 release. |
| 377 | + * after the ESAPI 2.5.3.0 release date (2023-11-24). |
327 | 378 | *
|
328 |
| - * @see <a href="https://github.com/ESAPI/esapi-java-legacy/security/advisories/GHSA-r68h-jhhj-9jvm">GitHub Security Advisory: Validator.isValidSafeHTML is being deprecated and will be deleted in 1 year</a> |
| 379 | + * @see <a href="https://github.com/ESAPI/esapi-java-legacy/security/advisories/GHSA-r68h-jhhj-9jvm" |
| 380 | + * target="_blank" rel="noreferrer noopener">GitHub Security Advisory: Validator.isValidSafeHTML |
| 381 | + * is being deprecated and will be deleted in 1 year</a> |
329 | 382 | */
|
330 | 383 | @Deprecated
|
331 | 384 | boolean isValidSafeHTML(String context, String input, int maxLength, boolean allowNull, ValidationErrorList errorList) throws IntrusionException;
|
|
0 commit comments