Repository navigation
Commit 64cdb00
manico.james
I believe I've found a bug introduced in 2.0-rc6 .Here is the environment:
1. using esapi in a web application
2. *not* setting "org.owasp.esapi.resources" system property
3. ".esapi" folder not in user.home or classpath (2.0-rc6 download didn't include it in the jar either)
When I invoke ESAPI.securityConfiguration().setResourceDirectory(esapiResourceDir) rc6 blows up with a NullPointerException. The problem appears to be that the "if ( shouldPrintProperties() ) {" block still gets executed when a file isn't found during the securityConfiguration() invocation and the properties is thus null, never allowing setResourceDirectory() to be called. To fix this, the " if ( shouldPrintProperties() ) {" block should be moved up a few lines to be included inside the "if (properties != null) {" block.
Although fixing the exception from occurring, using setResourceDirectory() from inside a web application is still somewhat useless because resourceDirectory is only used when checking ClassLoader.getSystemResource() which typically isn't your webapp context's classloader. I would suggest adding a check to resourceDirectory inside loadConfigurationFromClasspath() when it loops through the classloaders. I made the change locally and it seems to work well, doing this one can specify a custom directory name inside a web application's context. Attached is a diff patch file for the details...
Thanks,
~Josh1 parent 9e746ae commit 64cdb00
1 file changed
Lines changed: 24 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
450 | 468 | | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
| 469 | + | |
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
| |||
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
569 | 574 | | |
570 | 575 | | |
571 | 576 | | |
| |||
0 commit comments