diff options
author | Melanie | 2010-10-02 20:11:43 +0100 |
---|---|---|
committer | Melanie | 2010-10-02 20:11:43 +0100 |
commit | 6fc1ceb2ee3888edae6e99fcbf59e79910058cc9 (patch) | |
tree | 2541691f927a999c67847493e1997679d2c51495 /OpenSim/Region | |
parent | Reapplying the parts of the prior revert that were not derived from the (diff) | |
download | opensim-SC_OLD-6fc1ceb2ee3888edae6e99fcbf59e79910058cc9.zip opensim-SC_OLD-6fc1ceb2ee3888edae6e99fcbf59e79910058cc9.tar.gz opensim-SC_OLD-6fc1ceb2ee3888edae6e99fcbf59e79910058cc9.tar.bz2 opensim-SC_OLD-6fc1ceb2ee3888edae6e99fcbf59e79910058cc9.tar.xz |
So, the client can have an old idea of the object properties for the object when it goes to buy. This can cause a problem in the buy process. Additionally Hazim mentioned that the buy packets are spoofable. The core modules are the crowing glory example of best practice :P, so therefore, setting the example here, Validate Client sent Buy Data. WebAppSecurity 101, Never trust a client. Validate Validate Validate! Or you'll have problems whether intentional or not.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index d364df6..e42dbf2 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs | |||
@@ -805,6 +805,16 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
805 | } | 805 | } |
806 | 806 | ||
807 | Scene s = LocateSceneClientIn(remoteClient.AgentId); | 807 | Scene s = LocateSceneClientIn(remoteClient.AgentId); |
808 | |||
809 | // Implmenting base sale data checking here so the default OpenSimulator implementation isn't useless | ||
810 | // combined with other implementations. We're actually validating that the client is sending the data | ||
811 | // that it should. In theory, the client should already know what to send here because it'll see it when it | ||
812 | // gets the object data. If the data sent by the client doesn't match the object, the viewer probably has an | ||
813 | // old idea of what the object properties are. Viewer developer Hazim informed us that the base module | ||
814 | // didn't check the client sent data against the object do any. Since the base modules are the | ||
815 | // 'crowning glory' examples of good practice.. | ||
816 | |||
817 | // Validate that the object exists in the scene the user is in | ||
808 | SceneObjectPart part = s.GetSceneObjectPart(localID); | 818 | SceneObjectPart part = s.GetSceneObjectPart(localID); |
809 | if (part == null) | 819 | if (part == null) |
810 | { | 820 | { |
@@ -812,6 +822,20 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule | |||
812 | return; | 822 | return; |
813 | } | 823 | } |
814 | 824 | ||
825 | // Validate that the client sent the price that the object is being sold for | ||
826 | if (part.SalePrice != salePrice) | ||
827 | { | ||
828 | remoteClient.SendAgentAlertMessage("Cannot buy at this price. Buy Failed. If you continue to get this relog.", false); | ||
829 | return; | ||
830 | } | ||
831 | |||
832 | // Validate that the client sent the proper sale type the object has set | ||
833 | if (part.ObjectSaleType != saleType) | ||
834 | { | ||
835 | remoteClient.SendAgentAlertMessage("Cannot buy this way. Buy Failed. If you continue to get this relog.", false); | ||
836 | return; | ||
837 | } | ||
838 | |||
815 | IBuySellModule module = s.RequestModuleInterface<IBuySellModule>(); | 839 | IBuySellModule module = s.RequestModuleInterface<IBuySellModule>(); |
816 | if (module != null) | 840 | if (module != null) |
817 | module.BuyObject(remoteClient, categoryID, localID, saleType, salePrice); | 841 | module.BuyObject(remoteClient, categoryID, localID, saleType, salePrice); |