<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://opensimulator.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://opensimulator.org/index.php?action=history&amp;feed=atom&amp;title=User%3AHaravikk_Mistral%2FRegionVerification</id>
		<title>User:Haravikk Mistral/RegionVerification - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://opensimulator.org/index.php?action=history&amp;feed=atom&amp;title=User%3AHaravikk_Mistral%2FRegionVerification"/>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Haravikk_Mistral/RegionVerification&amp;action=history"/>
		<updated>2026-05-12T05:34:28Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.9</generator>

	<entry>
		<id>http://opensimulator.org/index.php?title=User:Haravikk_Mistral/RegionVerification&amp;diff=45459&amp;oldid=prev</id>
		<title>Haravikk Mistral: /* Example */</title>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Haravikk_Mistral/RegionVerification&amp;diff=45459&amp;oldid=prev"/>
				<updated>2017-08-14T22:22:35Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Example&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 22:22, 14 August 2017&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 16:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 16:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Example ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Example ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The following example assumes the presence of the &amp;lt;tt&amp;gt;X-OpenSim-Location&amp;lt;/tt&amp;gt; as proposed [[User:Haravikk Mistral/ExpandedGridInfoAvailability|here]]:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The following example assumes the presence of the &amp;lt;tt&amp;gt;X-OpenSim-Location&amp;lt;/tt&amp;gt; as proposed [[User:Haravikk Mistral/ExpandedGridInfoAvailability|here]]:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;pre&lt;/del&gt;&amp;gt;&amp;lt;?php&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;source lang = &amp;quot;php&amp;quot;&lt;/ins&gt;&amp;gt;&amp;lt;?php&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;function fetch(array $array, $key, $default = null) { return (isset($array[$key])) ? $array[$key] : $default; }&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;function fetch(array $array, $key, $default = null) { return (isset($array[$key])) ? $array[$key] : $default; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 55:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 55:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; break;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; break;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; }&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;}&amp;lt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;pre&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;}&amp;lt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;source&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Alternatives Considered ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Alternatives Considered ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Haravikk Mistral</name></author>	</entry>

	<entry>
		<id>http://opensimulator.org/index.php?title=User:Haravikk_Mistral/RegionVerification&amp;diff=45458&amp;oldid=prev</id>
		<title>Haravikk Mistral: /* Example */</title>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Haravikk_Mistral/RegionVerification&amp;diff=45458&amp;oldid=prev"/>
				<updated>2017-08-14T22:21:45Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Example&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 22:21, 14 August 2017&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 23:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 23:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;if (isset($_SERVER['HTTP_X_OPENSIM_LOCATION'])) {&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;if (isset($_SERVER['HTTP_X_OPENSIM_LOCATION'])) {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; $uri = parse_url($_SERVER['HTTP_X_OPENSIM_LOCATION']);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; $uri = parse_url($_SERVER['HTTP_X_OPENSIM_LOCATION']);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; if ((fetch($uri, 'scheme') == 'x-grid-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;location&lt;/del&gt;') || !$host = fetch($uri, 'host')) { die('Invalid URI'); }&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; if ((fetch($uri, 'scheme') == 'x-grid-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;info&lt;/ins&gt;') || !$host = fetch($uri, 'host')) { die('Invalid URI'); }&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; $grid_address = $host . (($port = fetch($uri, 'port')) ? &amp;quot;:$port&amp;quot; : '');&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; $grid_address = $host . (($port = fetch($uri, 'port')) ? &amp;quot;:$port&amp;quot; : '');&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Haravikk Mistral</name></author>	</entry>

	<entry>
		<id>http://opensimulator.org/index.php?title=User:Haravikk_Mistral/RegionVerification&amp;diff=45457&amp;oldid=prev</id>
		<title>Haravikk Mistral: /* Problem */</title>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Haravikk_Mistral/RegionVerification&amp;diff=45457&amp;oldid=prev"/>
				<updated>2017-08-14T22:15:37Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Problem&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 22:15, 14 August 2017&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;= Overview =&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;= Overview =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Problem ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Problem ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When receiving an HTTP request from a scripted object within an Open Simulator region, there is currently no means of verifying whether the request came from a legitimate source. For Second Life this is possible with a reverse DNS lookup on the IP address, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;and &lt;/del&gt;if has a valid &amp;lt;tt&amp;gt;simXXXX.&amp;lt;grid&amp;gt;.lindenlab.com&amp;lt;/tt&amp;gt; address you can confirm that the request came from a legitimate source, but such a technique is not possible with Open Simulator based grids.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When receiving an HTTP request from a scripted object within an Open Simulator region, there is currently no means of verifying whether the request came from a legitimate source. For Second Life this is possible with a reverse DNS lookup on the IP address, if &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;it &lt;/ins&gt;has a valid &amp;lt;tt&amp;gt;simXXXX.&amp;lt;grid&amp;gt;.lindenlab.com&amp;lt;/tt&amp;gt; address you can confirm that the request came from a legitimate source, but such a technique is not possible with Open Simulator based grids.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Proposed Solution ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Proposed Solution ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Haravikk Mistral</name></author>	</entry>

	<entry>
		<id>http://opensimulator.org/index.php?title=User:Haravikk_Mistral/RegionVerification&amp;diff=45332&amp;oldid=prev</id>
		<title>Melanie at 14:55, 31 July 2017</title>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Haravikk_Mistral/RegionVerification&amp;diff=45332&amp;oldid=prev"/>
				<updated>2017-07-31T14:55:07Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 14:55, 31 July 2017&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 61:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 61:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The proposed system above, while limited in the information it returns, requires the web-service to posses a valid region name and IP address, and can do nothing more than confirm that they are valid; if the IP address is incorrect then no data is returned (or some error, anything other than &amp;lt;tt&amp;gt;OK&amp;lt;/tt&amp;gt; is considered to mean the combo was invalid or the operation is unsupported).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The proposed system above, while limited in the information it returns, requires the web-service to posses a valid region name and IP address, and can do nothing more than confirm that they are valid; if the IP address is incorrect then no data is returned (or some error, anything other than &amp;lt;tt&amp;gt;OK&amp;lt;/tt&amp;gt; is considered to mean the combo was invalid or the operation is unsupported).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;pre&amp;gt;A DDOS attack against the grid servie is a very real possibility. A solution&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;needs to include ratelimiting&amp;lt;/pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Melanie</name></author>	</entry>

	<entry>
		<id>http://opensimulator.org/index.php?title=User:Haravikk_Mistral/RegionVerification&amp;diff=45327&amp;oldid=prev</id>
		<title>Haravikk Mistral: Created page with &quot;= Overview = == Problem == When receiving an HTTP request from a scripted object within an Open Simulator region, there is currently no means of verifying whether the request ...&quot;</title>
		<link rel="alternate" type="text/html" href="http://opensimulator.org/index.php?title=User:Haravikk_Mistral/RegionVerification&amp;diff=45327&amp;oldid=prev"/>
				<updated>2017-07-31T11:43:17Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;= Overview = == Problem == When receiving an HTTP request from a scripted object within an Open Simulator region, there is currently no means of verifying whether the request ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Overview =&lt;br /&gt;
== Problem ==&lt;br /&gt;
When receiving an HTTP request from a scripted object within an Open Simulator region, there is currently no means of verifying whether the request came from a legitimate source. For Second Life this is possible with a reverse DNS lookup on the IP address, and if has a valid &amp;lt;tt&amp;gt;simXXXX.&amp;lt;grid&amp;gt;.lindenlab.com&amp;lt;/tt&amp;gt; address you can confirm that the request came from a legitimate source, but such a technique is not possible with Open Simulator based grids.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
This proposal is to provide a call-back mechanism with which a web-service, [[User:Haravikk Mistral/ExpandedGridInfoAvailability|knowing the source grid]], region name and simulator IP address, can query the source grid to verify whether the IP address and region name are valid, i.e- asking the grid to confirm that it has a simulator with a given IP address, hosting the given region name.&lt;br /&gt;
&lt;br /&gt;
= Detailed Design =&lt;br /&gt;
== The Callback Service ==&lt;br /&gt;
Essentially what this feature boils down to is a callback service, implemented in much the same way as the [[GridInfo]] protocol. The proposed protocol would take the form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;http://example.org:9000/verify_region?name=Some%20Region&amp;amp;ip=123.123.123.123&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To which the server would respond simply 'OK' if there exists a region named &amp;quot;Some Region&amp;quot;, hosted by a simulator with IP address &amp;lt;tt&amp;gt;123.123.123.123&amp;lt;/tt&amp;gt;, or else 'NO' if there exists no region by that name assigned to that IP. Thus a web service knows either that the combo exists (OK), doesn't exist (NO) or that the grid cannot or will not verify it (any other response).&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
The following example assumes the presence of the &amp;lt;tt&amp;gt;X-OpenSim-Location&amp;lt;/tt&amp;gt; as proposed [[User:Haravikk Mistral/ExpandedGridInfoAvailability|here]]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;?php&lt;br /&gt;
function fetch(array $array, $key, $default = null) { return (isset($array[$key])) ? $array[$key] : $default; }&lt;br /&gt;
&lt;br /&gt;
// TODO: Verify basic headers first (since they require no callbacks)&lt;br /&gt;
&lt;br /&gt;
if (isset($_SERVER['HTTP_X_OPENSIM_LOCATION'])) {&lt;br /&gt;
    $uri = parse_url($_SERVER['HTTP_X_OPENSIM_LOCATION']);&lt;br /&gt;
    if ((fetch($uri, 'scheme') == 'x-grid-location') || !$host = fetch($uri, 'host')) { die('Invalid URI'); }&lt;br /&gt;
&lt;br /&gt;
    $grid_address = $host . (($port = fetch($uri, 'port')) ? &amp;quot;:$port&amp;quot; : '');&lt;br /&gt;
    if (!preg_match(';^/region/([0-9]*[^0-9/]+[^/]*)((?:/([0-9]+)(?:/([0-9]+)(?:/([0-9]+))?)?)?;i', fetch($uri, 'path'), $match)) { die('Invalid URI'); }&lt;br /&gt;
&lt;br /&gt;
    $region_name = urldecode($match[1]); $coords = [];&lt;br /&gt;
    if (strlen($match[2]) &amp;amp;&amp;amp; strlen($match[3])) { // 2-D coords&lt;br /&gt;
        $coords = [(int)$match[2], (int)$match[3]];&lt;br /&gt;
        if (strlen($match[4])) { $coords[] = (int)$match[4]; }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // TODO: Look up $grid_address and $_SERVER['REMOTE_ADDR'] in database, if they have been confirmed recently then don't do it again&lt;br /&gt;
&lt;br /&gt;
    // Host is unconfirmed, try to confirm it now&lt;br /&gt;
    $curl = curl_init(&amp;quot;http://$grid_address/verify_region?region=&amp;quot; . urlencode($region_name) . '&amp;amp;ip=' . $_SERVER['REMOTE_ADDR']);&lt;br /&gt;
    curl_setopts_array($curl = [CURLOPT_RETURNTRANSFER =&amp;gt; true, CURLOPT_FOLLOWLOCATION =&amp;gt; true]);&lt;br /&gt;
    $response = curl_exec($curl);&lt;br /&gt;
    if ((curl_errno($curl) != 0) || (curl_getinfo($curl, CURLINFO_HTTP_CODE) != 200)) { die('Error occurred verifying region'); }&lt;br /&gt;
    curl_close($curl);&lt;br /&gt;
&lt;br /&gt;
    switch($response) {&lt;br /&gt;
        case 'OK':&lt;br /&gt;
            // The grid confirmed the region and IP combo, we should cache it in our database to avoid repeated lookups&lt;br /&gt;
        break;&lt;br /&gt;
        case 'NO':&lt;br /&gt;
            die('Invalid region/IP');&lt;br /&gt;
        break;&lt;br /&gt;
        default:&lt;br /&gt;
            // TODO: Use some kind of fallback or &amp;quot;untrusted&amp;quot; behaviour instead&lt;br /&gt;
            die('Unable to verify region/IP');&lt;br /&gt;
        break;&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Alternatives Considered ==&lt;br /&gt;
An alternative protocol for the verification would be to have the grid return some information about a region in an XML format. For example, a request for &amp;quot;Some Region&amp;quot; could return details such as its map location and IP, with the web-service extracting the IP itself to confirm. However, this raises the question of how much data should be revealed, and whether the ability to scrape by region name is desirable or not.&lt;br /&gt;
&lt;br /&gt;
The proposed system above, while limited in the information it returns, requires the web-service to posses a valid region name and IP address, and can do nothing more than confirm that they are valid; if the IP address is incorrect then no data is returned (or some error, anything other than &amp;lt;tt&amp;gt;OK&amp;lt;/tt&amp;gt; is considered to mean the combo was invalid or the operation is unsupported).&lt;/div&gt;</summary>
		<author><name>Haravikk Mistral</name></author>	</entry>

	</feed>