Make private services forbid llHTTPRequest() calls by rejecting HTTP calls that have the X-SecondLife-Shard header
parent
7995c3037a
commit
a5e6d36f98
|
@ -73,6 +73,13 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
if (httpRequest.Headers["X-SecondLife-Shard"] != null)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
bool result = false;
|
||||
|
||||
string[] p = SplitParams(path);
|
||||
|
|
|
@ -57,6 +57,13 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
if (httpRequest.Headers["X-SecondLife-Shard"] != null)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
byte[] result = new byte[0];
|
||||
|
||||
string[] p = SplitParams(path);
|
||||
|
|
|
@ -57,6 +57,13 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
if (httpRequest.Headers["X-SecondLife-Shard"] != null)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
AssetBase asset;
|
||||
XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace OpenSim.Server.Handlers.Asset.Test
|
|||
}
|
||||
|
||||
buffer.Position = 0;
|
||||
asph.Handle(null, buffer, null, null);
|
||||
asph.Handle(null, buffer, new TestOSHttpRequest(), null);
|
||||
|
||||
AssetBase retrievedAsset = assetService.Get(assetId.ToString());
|
||||
|
||||
|
@ -102,7 +102,7 @@ namespace OpenSim.Server.Handlers.Asset.Test
|
|||
buffer.Position = 0;
|
||||
|
||||
TestOSHttpResponse response = new TestOSHttpResponse();
|
||||
asph.Handle(null, buffer, null, response);
|
||||
asph.Handle(null, buffer, new TestOSHttpRequest(), response);
|
||||
|
||||
Assert.That(response.StatusCode, Is.EqualTo((int)HttpStatusCode.BadRequest));
|
||||
}
|
||||
|
|
|
@ -73,6 +73,13 @@ namespace OpenSim.Server.Handlers.Authentication
|
|||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
if (httpRequest.Headers["X-SecondLife-Shard"] != null)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
string[] p = SplitParams(path);
|
||||
|
||||
if (p.Length > 0)
|
||||
|
|
|
@ -57,6 +57,13 @@ namespace OpenSim.Server.Handlers.Authorization
|
|||
protected override byte[] ProcessRequest(string path, Stream request,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
if (httpRequest.Headers["X-SecondLife-Shard"] != null)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
XmlSerializer xs = new XmlSerializer(typeof (AuthorizationRequest));
|
||||
AuthorizationRequest Authorization = (AuthorizationRequest) xs.Deserialize(request);
|
||||
|
||||
|
|
|
@ -59,6 +59,13 @@ namespace OpenSim.Server.Handlers.Avatar
|
|||
protected override byte[] ProcessRequest(string path, Stream requestData,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
if (httpRequest.Headers["X-SecondLife-Shard"] != null)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
sr.Close();
|
||||
|
|
|
@ -60,6 +60,13 @@ namespace OpenSim.Server.Handlers.Friends
|
|||
protected override byte[] ProcessRequest(string path, Stream requestData,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
if (httpRequest.Headers["X-SecondLife-Shard"] != null)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
sr.Close();
|
||||
|
|
|
@ -60,6 +60,13 @@ namespace OpenSim.Server.Handlers.Grid
|
|||
protected override byte[] ProcessRequest(string path, Stream requestData,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
if (httpRequest.Headers["X-SecondLife-Shard"] != null)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
sr.Close();
|
||||
|
|
|
@ -59,6 +59,13 @@ namespace OpenSim.Server.Handlers.GridUser
|
|||
protected override byte[] ProcessRequest(string path, Stream requestData,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
if (httpRequest.Headers["X-SecondLife-Shard"] != null)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
sr.Close();
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
@ -90,6 +91,13 @@ namespace OpenSim.Server.Handlers.Asset
|
|||
protected override byte[] ProcessRequest(string path, Stream requestData,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
if (httpRequest.Headers["X-SecondLife-Shard"] != null)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
sr.Close();
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
|
||||
|
@ -102,6 +103,14 @@ namespace OpenSim.Server.Handlers.MapImage
|
|||
protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
|
||||
|
||||
if (httpRequest.Headers["X-SecondLife-Shard"] != null)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
sr.Close();
|
||||
|
|
|
@ -59,6 +59,13 @@ namespace OpenSim.Server.Handlers.Presence
|
|||
protected override byte[] ProcessRequest(string path, Stream requestData,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
if (httpRequest.Headers["X-SecondLife-Shard"] != null)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
sr.Close();
|
||||
|
|
|
@ -71,6 +71,13 @@ namespace OpenSim.Server.Handlers.UserAccounts
|
|||
protected override byte[] ProcessRequest(string path, Stream requestData,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
if (httpRequest.Headers["X-SecondLife-Shard"] != null)
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
httpResponse.ContentType = "text/plain";
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
StreamReader sr = new StreamReader(requestData);
|
||||
string body = sr.ReadToEnd();
|
||||
sr.Close();
|
||||
|
|
Loading…
Reference in New Issue