Cloud functions seem to bypass validation rules, but it shouldn't

前端 未结 1 1235
误落风尘
误落风尘 2021-01-16 06:02
    \"connections-guests\":{
      \"$user_id\":{
        \"$to_user_id\":{
          \".validate\": \"
            !root.child(\'/connections/\' + $user_id + \'/\'          


        
相关标签:
1条回答
  • 2021-01-16 06:31

    Most likely you are accessing the database using the Admin SDK from within your Cloud Functions code. When you initialize the Admin SDK with its default settings it runs with full privilege and indeed bypasses the security rules.

    If you don't want to run with administrative privilege, you can either initialize the Admin SDK to run at lower privilege, or you can access the database through event.data.ref, which runs as the user who triggered the function.

    0 讨论(0)
提交回复
热议问题