fix possible crlf injection, see issue #320

This commit is contained in:
Sebastian Sdorra
2013-01-28 13:04:12 +01:00
parent 1e7ff1a71a
commit 500a082a3f
3 changed files with 100 additions and 0 deletions

View File

@@ -79,6 +79,68 @@ public class HttpUtilTest
HttpUtil.normalizeUrl("http://www.scm-manager:8080"));
}
/**
* Method description
*
*/
@Test(expected = IllegalArgumentException.class)
public void testCheckForCRLFInjectionFailure1()
{
HttpUtil.checkForCRLFInjection("any%0D%0A");
}
/**
* Method description
*
*/
@Test(expected = IllegalArgumentException.class)
public void testCheckForCRLFInjectionFailure2()
{
HttpUtil.checkForCRLFInjection("123\nabc");
}
/**
* Method description
*
*/
@Test(expected = IllegalArgumentException.class)
public void testCheckForCRLFInjectionFailure3()
{
HttpUtil.checkForCRLFInjection("123\rabc");
}
/**
* Method description
*
*/
@Test(expected = IllegalArgumentException.class)
public void testCheckForCRLFInjectionFailure4()
{
HttpUtil.checkForCRLFInjection("123\r\nabc");
}
/**
* Method description
*
*/
@Test(expected = IllegalArgumentException.class)
public void testCheckForCRLFInjectionFailure5()
{
HttpUtil.checkForCRLFInjection("123%abc");
}
/**
* Method description
*
*/
@Test
public void testCheckForCRLFInjectionSuccess()
{
HttpUtil.checkForCRLFInjection("123");
HttpUtil.checkForCRLFInjection("abc");
HttpUtil.checkForCRLFInjection("abcka");
}
//~--- get methods ----------------------------------------------------------
/**