mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-22 03:51:36 +01:00
fix possible crlf injection, see issue #320
This commit is contained in:
@@ -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 ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user