Skip to content
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

Path traversal bug in <Path /> parsing for Web Optimization #14

Open
jasperroel opened this issue Jun 15, 2012 · 0 comments
Open

Path traversal bug in <Path /> parsing for Web Optimization #14

jasperroel opened this issue Jun 15, 2012 · 0 comments

Comments

@jasperroel
Copy link
Contributor

Recently we blew up our authoring environment because of a fun (what I perceive to be) bug.

Here's the steps to reproduce:
Create a new css/js alkacon-optiomized-css/js recource.
Make sure it has one Path element, and make sure it's empty (that's the default ).
Publish it, switch to the Online project.
Now, render the minified resource.

This defaults to recursively traversing the path from the site root if it's a folder (which it is, because the site root is always a folder).
Why? Because resolves to "", which then resolves to "/sites/[project default]/.

This takes forever and occupies about (at least) 180Mb of heap space for a long time (at least the duration of the call, plus caches etc) [in a system with hundreds of thousands of resources].
Multiple calls results in the same memory occupation (since the previous call is still running, caches aren't used). So, for a 32-bit JVM, after 8 hits the heap is exhausted and the system fails completely (OutOfMemoryExceptions and GCOverhead errors).

Solution
Stop this at the gate. as soon as includeDefault is called on the OptimizationBean, check "path" for an empty string. If it's empty, disallow/ignore it. An empty node is most possible a bug or at least unintentional.

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

No branches or pull requests

1 participant