dictation-toolbox / aenea

Client-server library for using voice macros from Dragon NaturallySpeaking and Dragonfly on remote/non-windows hosts.
GNU Lesser General Public License v3.0
211 stars 62 forks source link

Security token check refactor #196

Closed drmfinlay closed 5 years ago

drmfinlay commented 5 years ago

I've moved security token checking into a new AeneaJSONRPCServer class in server/core.py. This class patches RPC functions registered with server.register_function() to add and check the required security_token argument. This is the decorator idea that was mentioned in the dragonfly Gitter chat a little while back and makes Yapsy server plugins work again.

I have tested with OSX and X11 (both implementations). This will currently break the Wayland server implementation, so it shouldn't be merged yet. The fix should be pretty simple though, I just need to set up a Wayland environment to test with.

Notes

Please let me know if you see any other problems :-)

@shervinemami These are the changes I mentioned in issue #195.

drmfinlay commented 5 years ago

The build is failing because it is running with Python 3.6 rather than Python 2.7.

calmofthestorm commented 5 years ago

Hey thanks for fixing Travis! It's only some very basic checks, but I feel better with it. Let me know when this is ready to merge. You might consider asking Cédric to test it for you if it's a simple change and you don't anticipate needing many rounds -- probably easier than setting up a Wayland environment.

I'll take a closer look when this is ready to merge. Thank you for putting it together!

drmfinlay commented 5 years ago

No worries! It looks like they changed the default interpreter version from 2.7 to 3.6 on the 16th of April.

Thanks, but I should probably set up a VM with it anyway. Fedora workstation uses it by default now and it's pretty easy to set up. I'll let you know when it's fixed.

drmfinlay commented 5 years ago

Sorry I haven't done anything on this recently. There are a few problems with the Wayland server I'd like to fix in this pull request too rather than opening another one.

Incidentally, the Wayland server is not specific to Wayland. It simulates input through the uinput Linux kernel module. It can be used with X11, Wayland or even in virtual consoles. Only the superuser can access the /dev/uinput device by default, so the server has to be run as root. You can temporarily set the permissions of /dev/uinput, but I'm not sure if that is advisable.

I can add some documentation and setup instructions for the Wayland server in a separate pull request.

drmfinlay commented 5 years ago

@calmofthestorm This should be ready for merging now.

I've fixed some unrelated issues I noticed with the Wayland server. There are some special keys such as apostrophe that still aren't working correctly with the key_press method. I think it would be better to fix that separately.

calmofthestorm commented 5 years ago

Thanks!

drmfinlay commented 5 years ago

No worries! :+1: