Author Topic: new driver development.  (Read 1007 times)

Offline kriton

  • Acquaintance
  • *
  • Posts: 20
  • ICQ??! AIM?! Just how old is this place?
    • View Profile
Re: new driver development.
« Reply #15 on: December 31, 2017, 06:52:58 AM »

I am definitely more worried about in-game users getting access to the filesystem outside the scope of the mudlib.  Mudlib development has lagged behind a bit but I hope to have the dev version of the lib up in the next couple of days.  Node makes things a bit trickier if you allow async calls.  An async write callback stack will not include the callstack entries that triggered the write in the first place so all such operations need to be handled in the driver so the context can be created and restored when the callback fires.

[Today I wrote 'ed' for telnet clients... or most of it... I am pretty proud of my little line editor so far ;-) https://github.com/kristianoye/kmud/blob/master/src/features/MUDEditor.js]

The security model is stack-based so each object on the stack is checked to ensure it has access to perform the operation so when I type "rm /log/errors/kriton"

The rm command calls efuns.rm(file) which calls driver's validWrite() which generates a list of objects to check based on the stack (/sys/cmds/creator/Rm, /v/sys/data/creators/k/kriton).  The driver then calls the validWrite() apply in the driver for each object.  If any one of the objects fails the check then the entire operation fails.

Code: [Select]
> ed /log/test.log
Starting editor.
*               This is a test.
*       .
[/log/test.log]*: w
You encountered an error.
Error: Permission denied: /log/test.log
    at EFUNProxy.writeFile ([driver]\EFUNProxy.js:1035:19)
    at EditorInstance.writeFile ([driver]\features\MUDEditor.js:519:20)
    at EditorInstance.executeCommand ([driver]\features\MUDEditor.js:280:37)
    at EFUNProxy.efunPrototype.(anonymous function) [as editorCmd] ([driver]\features\MUDEditor.js:585:42)
    at executeEditor (/base/Interactive.js:73:44)
    at CreatorWrapper.processInput (/base/Interactive.js:239:34)
    at CreatorWrapper.preprocessInput (/base/Creator.js:156:25)
    at CreatorWrapper.preprocessInput (/v/sys/data/creators/k/kriton:13:51)
    at MUDStorage.Interactive.$storage.prependListener (/base/Interactive.js:285:25)
    at MUDStorage.emit ([driver]\MUDEventEmitter.js:31:34)

Exceptions are also tricky since Node does not give you a means to intercept creation of errors at the source.  I have logic to scrub the external filesystem from most errors but someone can just do a try ... catch and display the error to get the native path.  Having the native path should not gain you much but it is more than I like.  I might just disallow exception handling in the compiler and force users to rely on the driver-based exception handler and reporting.

Offline kriton

  • Acquaintance
  • *
  • Posts: 20
  • ICQ??! AIM?! Just how old is this place?
    • View Profile
Re: new driver development.
« Reply #16 on: January 15, 2018, 03:52:19 AM »
I ran into a snag with tripwire not working as expected.  I am trying to get it working the way I want but my C++ is a bit rusty.

> eval while(true);
Command exceeded max execution time.
> You encountered an error:Max execution time exceeded.
    at :1:38
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

(it keeps throwing exceptions though and doesn't yet resume the original thread).

Offline silenus

  • BFF
  • ***
  • Posts: 190
    • View Profile
Re: new driver development.
« Reply #17 on: January 15, 2018, 05:06:06 AM »
Do you have a link for where I might get the source code for tripwire? I am kind of curious what it's capabilities are.

Offline kriton

  • Acquaintance
  • *
  • Posts: 20
  • ICQ??! AIM?! Just how old is this place?
    • View Profile
Re: new driver development.
« Reply #18 on: January 15, 2018, 04:29:07 PM »

https://github.com/tjanczuk/tripwire/tree/master/src

I've managed to get rid of the non-stop exceptions but still haven't figured out why Isolate::IsExecutionTerminating() remains false.  I really need to figure out how to enable debugging in VS so I can step into the C++.

Offline silenus

  • BFF
  • ***
  • Posts: 190
    • View Profile
Re: new driver development.
« Reply #19 on: January 15, 2018, 06:41:47 PM »
I am not a C++ expert but looking at the tripwire code it seems to do something relatively simple in concept which is to kill threads on a sort of timeout. I guess I would have to understand node.js a bit better to understand how it truly works is v8 multithreaded?