Is it acceptable to leave a database (Cloud Firestore) unsecured when no site login is required?

前端 未结 2 1771
故里飘歌
故里飘歌 2021-01-19 18:17

I\'m building a game with Angular and (for the first time ever) I\'m trying to add a high score table. I have set up a Firebase account and got a <

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-19 18:48

    I wish I could use red blinking underlined text here, but you should definitely not leave your database with this ruleset in place.

    Anyone who plays your game will see your database. With the ruleset you have, anyone can read and write anything to the database (not just your score board). You'll be allow anyone to run their own system using your database, with the costs being charged to your account.

    At a minimum, given the description you've provided, you should:

    • Only allow reading & writing to your score board collection
    • Validate the score is a valid value (e.g. an integer and within a certain range
    • Validate the name is a valid value (help protect against possible XSS attacks)
    • Validate no extra fields other than score and name be being written to a document (so people can't hide other payloads).

提交回复
热议问题