I'm working on the backend for a Flash game and I need to secure the data going into the scoreboard.
The game is going to be hosted on many sites in a banner ad, the user will play the game in the advert then click through to the main site to save their details.
At the moment I am thinking along the lines of this
- User plays the game and clicks to submit their score
- In the background, the banner sends the score and the originating domain to a script on the main site.
- The script check the domain is one of the valid domains the ad is being hosted on.
- If everything is right, the script creates a hash of this score and domain and stores it in the database along side the score.
- The script returns the hash to Flash which cobbles it onto the querystring of a getURL which opens the main scoreboard
- The scoreboard page checks the referer to make sure it is one of the valid domains.
- If it is it then checks the database for the hash to if it's a valid token
- the user then fills in their details and the record is updated based on the hash
Last time I checked FLash doesn't send referer info, which kinda throws a spanner into my plan. So, is there an already established pattern for this kind of Flash/Database interaction?
What sort of Hashing/Checksuming should I use in step 4? What is the correct name for this kind of operation, is it a hash, a checksum or something else?
I understand that being a clientside technology, Flash will never actually be THAT secure, but in my mind, something like the above is about as dificult as you're going to make it to hack this kind of application.
UPDATE: My main objective is to make it harder for people to find the URL of the script that adds the score to the database and simply spam it with fake scores.
Thanks, Greg