table.pack and LOVE
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: table.pack and LOVE
Be warned that TSerial allows for arbitrary code execution, so it might not be the best idea for networking.
- Sheepolution
- Party member
- Posts: 264
- Joined: Mon Mar 04, 2013 9:31 am
- Location: The Netherlands
- Contact:
Re: table.pack and LOVE
At what point can it be dangerous though?
As soon as I do Tserial.unpack(table)?
As soon as I do Tserial.unpack(table)?
- Sheepolution
- Party member
- Posts: 264
- Joined: Mon Mar 04, 2013 9:31 am
- Location: The Netherlands
- Contact:
Re: table.pack and LOVE
But how? Variables älone can't do much right?
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: table.pack and LOVE
In Lua, everything is a variable. Including functions and tables and all can be inside each other.
Re: table.pack and LOVE
It is possible to sandbox to an extent, you can create a safe environment using do-end blocks or using a set of rules defined by a function.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: table.pack and LOVE
Well, it uses [manual]loadstring[/manual] to unpack, which executes a string as code, so there you go.
Just to be clear, I'm not bashing TSerial, it's just that it's not meant for (safely) receiving things from outside of your "trusted zone".
Just to be clear, I'm not bashing TSerial, it's just that it's not meant for (safely) receiving things from outside of your "trusted zone".
- ArchAngel075
- Party member
- Posts: 319
- Joined: Mon Jun 24, 2013 5:16 am
Re: table.pack and LOVE
My workaround will be to scan all incoming messages server side, and if the string contains "function" then it will error the game, i dont plan on trying to send functions of my own and so this will eliminate the security risk almost completely.
Im sure there might be a different way to protect from malicious code.
Im sure there might be a different way to protect from malicious code.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: table.pack and LOVE
Spoiler alert: you will get hacked. Blacklisting is not something you can prevent code injection with. Either use sandboxing or send JSON instead of Lua. I recommend the latter.ArchAngel075 wrote:My workaround will be to scan all incoming messages server side, and if the string contains "function" then it will error the game, i dont plan on trying to send functions of my own and so this will eliminate the security risk almost completely.
Help us help you: attach a .love.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: table.pack and LOVE
Which reminds me:
https://github.com/kikito/sandbox.lua
I have not announced it here because it's not yet 1.0, but it works quite nicely.
https://github.com/kikito/sandbox.lua
I have not announced it here because it's not yet 1.0, but it works quite nicely.
When I write def I mean function.
Who is online
Users browsing this forum: Bing [Bot], slime, TheJayDizzle and 12 guests