Issue Details (XML | Word | Printable)

Key: HADOOP-6151
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Owen O'Malley
Reporter: Owen O'Malley
Votes: 1
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Hadoop Common

The servlets should quote html characters

Created: 15/Jul/09 04:24 PM   Updated: 19/Sep/09 11:09 AM
Return to search
Component/s: security
Affects Version/s: None
Fix Version/s: 0.21.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works h6151.patch 2009-09-18 06:01 AM Owen O'Malley 14 kB
Text File Licensed for inclusion in ASF works h6151.patch 2009-09-18 04:49 AM Owen O'Malley 14 kB
Text File Licensed for inclusion in ASF works h6151.patch 2009-09-18 02:26 AM Owen O'Malley 14 kB
Text File Licensed for inclusion in ASF works h6151.patch 2009-09-17 10:00 PM Owen O'Malley 14 kB
Issue Links:
Reference
 

Hadoop Flags: Reviewed
Resolution Date: 18/Sep/09 04:33 PM


 Description  « Hide
We need to quote html characters that come from user generated data. Otherwise, all of the web ui's have cross site scripting attack, etc.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Owen O'Malley added a comment - 15/Jul/09 10:55 PM - edited
I believe the transforms should be:
1. & -> &
2. < -> &lt;
3. > -> &gt;
4. ' -> &apos;
5. "-> &quot;

As long as we do those transforms, any html that the user includes in their data will just be treated as literal text rather than html commands.


Owen O'Malley added a comment - 17/Sep/09 10:00 PM
This patch introduces an input filter for all of the servlets and jsp pages that quotes all of the html active characters in the parameters. This means that all of the cross site scripting attacks based on bad urls should be fixed.

I'll file a follow up jira to fix the vector where the values in the job need to be quoted.


Hadoop QA added a comment - 17/Sep/09 10:15 PM
-1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12419937/h6151.patch
against trunk revision 815809.

+1 @author. The patch does not contain any @author tags.

+1 tests included. The patch appears to include 2 new or modified tests.

-1 patch. The patch command could not apply the patch.

Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h4.grid.sp2.yahoo.net/42/console

This message is automatically generated.


Owen O'Malley added a comment - 18/Sep/09 02:26 AM
I forgot the --no-prefix..

Hadoop QA added a comment - 18/Sep/09 04:13 AM
-1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12419959/h6151.patch
against trunk revision 816409.

+1 @author. The patch does not contain any @author tags.

+1 tests included. The patch appears to include 2 new or modified tests.

-1 javadoc. The javadoc tool appears to have generated 1 warning messages.

+1 javac. The applied patch does not increase the total number of javac compiler warnings.

+1 findbugs. The patch does not introduce any new Findbugs warnings.

+1 release audit. The applied patch does not increase the total number of release audit warnings.

+1 core tests. The patch passed core unit tests.

+1 contrib tests. The patch passed contrib unit tests.

Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h4.grid.sp2.yahoo.net/46/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h4.grid.sp2.yahoo.net/46/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h4.grid.sp2.yahoo.net/46/artifact/trunk/build/test/checkstyle-errors.html
Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h4.grid.sp2.yahoo.net/46/console

This message is automatically generated.


Chris Douglas added a comment - 18/Sep/09 04:31 AM
     [exec] -1 overall.  
     [exec] 
     [exec]     +1 @author.  The patch does not contain any @author tags.
     [exec] 
     [exec]     +1 tests included.  The patch appears to include 2 new or modified tests.
     [exec] 
     [exec]     -1 javadoc.  The javadoc tool appears to have generated 1 warning messages.
     [exec] 
     [exec]     +1 javac.  The applied patch does not increase the total number of javac compiler warnings.
     [exec] 
     [exec]     +1 findbugs.  The patch does not introduce any new Findbugs warnings.
     [exec] 
     [exec]     +1 release audit.  The applied patch does not increase the total number of release audit warnings.

[javadoc] /snip/common/src/.../HtmlQuoting.java:145: warning - @return tag has no arguments.
[javadoc] /snip/common/src/.../HtmlQuoting.java:73: warning - @param argument "buffer" is not a parameter name.
[javadoc] /snip/common/src/.../HtmlQuoting.java:73: warning - @param argument "add" is not a parameter name.
  • The unit test should use JUnit4 test annotations instead of JUnit3 TestCase
  • HttpServer::printRequest looks useful for debugging, but should probably be left out
  • The static *Bytes fields should be final
  • The @return docs for "needsQuoting" could be more explicit

Owen O'Malley added a comment - 18/Sep/09 04:49 AM
Messed up the JavaDoc. Now fixed.

Hadoop QA added a comment - 18/Sep/09 05:01 AM
+1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12419969/h6151.patch
against trunk revision 816409.

+1 @author. The patch does not contain any @author tags.

+1 tests included. The patch appears to include 2 new or modified tests.

+1 javadoc. The javadoc tool did not generate any warning messages.

+1 javac. The applied patch does not increase the total number of javac compiler warnings.

+1 findbugs. The patch does not introduce any new Findbugs warnings.

+1 release audit. The applied patch does not increase the total number of release audit warnings.

+1 core tests. The patch passed core unit tests.

+1 contrib tests. The patch passed contrib unit tests.

Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h1.grid.sp2.yahoo.net/7/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h1.grid.sp2.yahoo.net/7/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h1.grid.sp2.yahoo.net/7/artifact/trunk/build/test/checkstyle-errors.html
Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h1.grid.sp2.yahoo.net/7/console

This message is automatically generated.


Owen O'Malley added a comment - 18/Sep/09 06:01 AM
This patch addresses Chris' comments.

Chris Douglas added a comment - 18/Sep/09 06:14 AM
+1

Hadoop QA added a comment - 18/Sep/09 06:21 AM
+1 overall. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12419972/h6151.patch
against trunk revision 816409.

+1 @author. The patch does not contain any @author tags.

+1 tests included. The patch appears to include 2 new or modified tests.

+1 javadoc. The javadoc tool did not generate any warning messages.

+1 javac. The applied patch does not increase the total number of javac compiler warnings.

+1 findbugs. The patch does not introduce any new Findbugs warnings.

+1 release audit. The applied patch does not increase the total number of release audit warnings.

+1 core tests. The patch passed core unit tests.

+1 contrib tests. The patch passed contrib unit tests.

Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h1.grid.sp2.yahoo.net/8/testReport/
Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h1.grid.sp2.yahoo.net/8/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h1.grid.sp2.yahoo.net/8/artifact/trunk/build/test/checkstyle-errors.html
Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-h1.grid.sp2.yahoo.net/8/console

This message is automatically generated.


Owen O'Malley added a comment - 18/Sep/09 04:33 PM
I just committed this.

Hudson added a comment - 18/Sep/09 04:48 PM
Integrated in Hadoop-Common-trunk-Commit #38 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Common-trunk-Commit/38/)
. Added a input filter to all of the http servlets that quotes
html characters in the parameters, to prevent cross site scripting
attacks. (omalley)

Hudson added a comment - 19/Sep/09 11:09 AM
Integrated in Hadoop-Common-trunk #102 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Common-trunk/102/)
. Added a input filter to all of the http servlets that quotes
html characters in the parameters, to prevent cross site scripting
attacks. (omalley)