Skip to main content
A pinball reflects lights as it rolls

Learned It From Pinball

Sandboxes and The Achievement

When designing cybersecurity first in building an application, the sandboxes in which components will be running need strong consideration. In the migration of backend components to a service it becomes important to consider that these run with SYSTEM level permissions (or root on Linux). But for this project's purposes the services still need input about the tasks being performed by the person at the keyboard. Microsoft Windows makes use of events focus around the desktop experience so any application visible and provides interaction runs at the user level scope of access permissions. This is common and can be handled well as long as the protocol that will be moving data between the two levels of permissions takes safeguards such as key exchanges and other mechanisms to prevent apps in the user space from performing impersonation but that is a story for a different blog post.

This post focuses more on how the service can alert the application running in the user space that features are available along with status updates the service is performing as the bulk of the feature set runs without any form of exposed interface. For this, inspiration for this type of component communication occurred to me as a friend and I went to the local entertainment hot spot to just hang out.

This location just set up a new pinball machine by Stern Pinball: The Transformers More than Meets the Eye. If you are not a pinball geek, this manufacturer produces an app on your phone that you can use to log in and by doing so track your game progress as well as unlock achievements earned in game play. First turn on the first game I see where it would like me to hit the ball for a skill shot. Guessing I need to use the plunger to put a ball on a flipper I use full force to put the ball in play in which as it enters the playfield all the lights for the skill shot extinguish. Ok, nope that’s wrong. That's when I realize oh I need to be more gentle to get the ball to a completely different flipper.

A Stern Pinball Machine at the local brew pub

Second chance, make the adjustment and have the ball hit the correct area. The game performs the animation for a skill shot made and I pat myself on the back for figuring that out. So after attempting a few additional shots I do this technique called a drop catch of the ball so I can figure out how the geometry lines up. It's while I'm holding the ball the achievement notification alert is played and on the screen I read "New Achievement! Skill Shot!". Uhm, I did that 2 minutes ago. I turn to my friend and joking say "Ha, that's the UDP protocol in action."

My engineering brain never shuts off and later in the evening circled back to this joke I made and why the delay existed. That's when an idea came to me, what if the game which is functioning as my app running under user access permissions has no idea that I unlocked an achievement? The game is constantly sending messages up to a server about scores, ball times, objectives completed and a long list of other data points to make their Quests and Badge awards possible. But along the way the server collecting this information (also where my gamer profile resides) instructed the machine "Hey, display this to the player" and the game software simply just reacts "Okay server, whatever you say."

This is the exact model being prototyped through this whole migration to enforce OS built in security boundaries. In the prototype signals about what the ball is doing is replaced by that component that lives inside the scope of user account restrictions that sends OS events to the backend service. Now to see how feasible replicating this model would be for my purposes.

One of the easiest use cases for me to experiment with is the user plugs in an external USB drive. The app running in the user space receives the Windows Event Notification that a new device has arrived to the system. That information gets passed to the service to perform additional scanning and processing. In the application that runs in the user space I coded up a generic dialog. Ok it’s far from generic, I have to have fun with it by adding notification alert sounds as well as animated effects. But I left a place holder for an image in addition to the other parameters the user space is expected to receive through the protocol. I also went a bit over the top and used some of my templates for icons and designed my own achievement image for the arrival of an external USB storage device just for nothing more than visual eye candy.

The alert popup replicated during prototyping

Since this project is still in the prototyping phase it was easy to go over to the service side and in the classes that handle and organize dispatching messages from the user app added the ability to send an alert back. In this case once the back end service is done processing the events needed for a new device arrival, alert the user all is good. Now testing all the components running in the debugger when a device arrives an achievement notification is displayed. Funny, yes! But it gives me that extra layer of isolation where data only accessible to the person logged in at the keyboard stays in the user space and the workhorse in the background that is operating with system level access can be fully isolated to prevent unintended code execution.

Now I got what I am after to continue the build out of the protocols and the threads that will be spawning events and responses, but did I fully re-engineer that experience that night hanging out with a friend? Probably not. After poking around the systems of Stern Pinball their tech people are more with it than critics claim. I'm operating under the impression (which my own experience would imply is the correct impression) there's more happening in that observation I made that I will never fully know as it is treated as intellectual property. In the end though I got the re-enforcement that the roadmap for the prototype is being navigated correctly and another piece of evidence that the trend for me continues: everything I need to know I've learned from pinball.

This browser is no longer supported. Please upgrade your browser to improve your experience. Find out more.