Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-31-2005, 08:33 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Security Brainstorming

I've talked to Stefan about eventually implementing some sort of script security within the NPC server itself to make scripts less exploitable.

I'm posting this thread to see if I can get some people's ideas for this, as well as to get people interested in it.

Some of these ideas will probably be based on other languages which feature security.


Some ideas off the top of my head:

All variables within an NPC are protected. They can be read by other NPCs, but not written to. Variables can be exposed as public by using some method such as "public variable someVar;". This includes system variables (such as rupees, bombs, etc).

I'm not sure how objects should be handled though, for making them public. If it's made so that if you make an object variable is public, all subproperties are public, then you should be able to explicitly mark subproperties as private. Eg: "private variable someObject.property".

You should not be able to do something like this:
HTML Code:
putNPC2(x, y, "public variable someVar; join(\"someclass\");");
As it would be a security breach.

This should include clientr variables as well. Obviously not client variables though (for backwards compatability).

Attributes and ani parameters obviously won't be protected (for backwards compatability reasons).

Functions may only be called by another NPC if they are public, which is how it is now.

System object functions which *modify the object itself* (such as player.setLevel2) may only be called from within that object. Perhaps there can be a way to make these functions public as well. This way we can wrap these functions and do any security checks we need to without worrying about scripts bypassing our custom function and calling it directly.

Functions calls should pass an implicit variable called "sender" or "caller". This can either be an automatic thing (like this/params) or could be an argument. For example:

HTML Code:
public function someFunc()
{
  if (sender.name != "someTrustedNPC")
  {
    return;
  }
  
  // do whatever...
}
This way we can validate NPCs that are allowed to call our functions -- or impose stricter limits on some NPCs that don't match our criteria.



Feel free to share your ideas/comments/criticism.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.