Skip to content

Missed a legal input case in DefaultSecurityConfiguration.java #488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xeno6696 opened this issue Apr 29, 2019 · 8 comments · Fixed by #501
Closed

Missed a legal input case in DefaultSecurityConfiguration.java #488

xeno6696 opened this issue Apr 29, 2019 · 8 comments · Fixed by #501

Comments

@xeno6696
Copy link
Collaborator

When was ESAPI-2.2.0.0-RC2 released? Our applications fails to load ESAPI.properties. The change seems to be with xeno6696@2837538

in = loaders[i].getResourceAsStream(DefaultSearchPath.ROOT.toString());

This change attempts to load "ROOT" and not fileName (aka., "ESAPI.properties"). We are picking up this RC version via the transitive dependency in encoder-esapi:

        <dependency>
            <groupId>org.owasp.esapi</groupId>
            <artifactId>esapi</artifactId>
            <version>[2.0,3)</version>
        </dependency>

Originally posted by @fransonsr in #487 (comment)

@lawrencexu
Copy link

The workaround I can find is to put the properties file in a sub-folder esapi which is documented way for this class.
Actually it never mentions the "ROOT" usage.

@fransonsr
Copy link

I have created a ticket to move our ESAPI.properties file to a proper documented location. However, I think I will continue to use a pinned version of esapi until it is released, just to maintain the principle of "least astonishment." I have brought this up with the OWASP encoder. (RE: OWASP/owasp-java-encoder#30).

@xeno6696
Copy link
Collaborator Author

xeno6696 commented May 2, 2019

@lawrencexu , the "ROOT" case is buried in some long history. Back when this lib started, the recommended usage was to compile your own version of the library with your own properties files embedded in the source, at that time at the root of the directory. Then at some point they converted to Maven and it seems over time the possible locations grew, from "/" to ".esapi/" and so on. So it doesn't shock me that the documentation never mentioned the ROOT case. Thanks for pointing this out!

@kwwall
Copy link
Contributor

kwwall commented May 2, 2019 via email

@fransonsr
Copy link

fransonsr commented May 2, 2019

I believe that "ROOT" in this context is the root of the classpath.

It evaluates to "ROOT" because of these lines:

// try root
String currentClasspathSearchLocation = "/ (root)";
in = loaders[i].getResourceAsStream(DefaultSearchPath.ROOT.toString());

@kwwall
Copy link
Contributor

kwwall commented May 30, 2019

@xeno6696 Where do we stand with this? This sounds related to the one PR #489. Is it? Asking because the proposed fix here sounds different than for the PR.

@xeno6696
Copy link
Collaborator Author

xeno6696 commented May 31, 2019 via email

@kwwall
Copy link
Contributor

kwwall commented Jun 22, 2019

Note in #489 (comment), @JoergAdler noted that:
"There are ClassLoader.getResource() and Class.getResource() and they work differently [...] The name should not have a leading “/”."

This was originally fixed in his PR, PR#489, but I rejected that PR because of excessive white-space diffs and that the fact that the properties file really only needed a single property.

jeremiahjstacey pushed a commit that referenced this issue Jun 24, 2019
* Change release version to 2.2.0.0 for official release.

* Update / correct ESAPI release steps.

* Fix ironic spelling typo.

* Fix ironic spelling typo.

* Changes to suppress most of the noise, but also fixes to all for .XML and .PROPERTIES suffixes and to fix and return null when property is null or empty string.

* Changes to suppress most of the noise and to actually handle the exceptions that we should have been all along (e.g., IOExceptions).

* Comment out the crude benchmark related assertion that sometimes was failing because of JIT-related issues. Needs to be eventually replaced by JMH.

* Close #499 by resetting 'parent' when Windows is detected to root of drive where Windows is installed.

* Close issue #488. These are slight enhancements to PR #489 by @JoergAdler that I rejected because Eclipse did something to cause every line to differ. But shout out to Jörg Adler for originally finding this issue and patching it.

* Close issue #488. These are slight enhancements to PR #489 by @JoergAdler that I rejected because Eclipse did something to cause every line to differ. But shout out to Jörg Adler for originally finding this issue and patching it.
I also added an additional test or 2, so don't blame @JoergAdler if I messed that up.

* Close issue #488. These are slight enhancements to PR #489 by @JoergAdler that I rejected because Eclipse did something to cause every line to differ. But shout out to Jörg Adler for originally finding this issue and patching it.
I tremendously stripped down the contents of this file because really all it needed was a single property referencing the validation.properties file.

* Add 3 additional issues that were closed and fixes to some minor formatting.

* Final updates for the ESAPI 2.2.0.0 official release.

* Figure I probably ought to add my name instead of assuming people knew it and my email address.

* Changed schema from allowing unbounded number of properties to allow only 10000. That really should NOT be a problem.
However, it should help silence some of the SAST engines.

* Additional changes to fix GitHub Issue #500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants