Handling Frontend Robustness

Game development with Board Game Arena Studio
Post Reply
User avatar
HumanBot
Posts: 11
Joined: 29 March 2020, 07:43

Handling Frontend Robustness

Post by HumanBot »

How do people deal with DOM modifications? I feel like its really easy for people to change an element's id or class and it could potentially break the code. I'm curious how other developers handle this issue generally. Do you guys just use a bunch of checks for each clickable feature or is there a general standard to follow such as never using element classes to determine game state? Or is this not really a big issue and something that we can ignore?
User avatar
Tisaac
Posts: 2736
Joined: 26 August 2014, 21:28

Re: Handling Frontend Robustness

Post by Tisaac »

I try to separate logic from layout. So I never rely on css class and instead use some closure for instance to have specific hook that I then check when clicked.
But even that is not enough since a user can change the js code and/or the ajax calls so the most important part is to check on server side (you can do that in a smart way if you have a nice front/back interface, but looking if action arg was présent in state args)
User avatar
RicardoRix
Posts: 2541
Joined: 29 April 2012, 23:43

Re: Handling Frontend Robustness

Post by RicardoRix »

Why care about the client hacks?
All checks have to be done server side, just assume the client could send you anything through the designated ajax calls - it's up to the server to verify if that's a valid move.
I tend to use BgaUserExceptions with clienttranslate for genuine client requests, and feException for potential hacks/cheaters/coding_errors.
User avatar
HumanBot
Posts: 11
Joined: 29 March 2020, 07:43

Re: Handling Frontend Robustness

Post by HumanBot »

Okay thanks. What you guys said makes a lot of sense
Post Reply

Return to “Developers”