Search code examples
firebasefirebase-realtime-databasefirebase-security

Firebase database rules date extension


This is my current firebase real-time database rules.

{
  "rules": {
    ".read": "now < 1633017600000",  // 2021-10-1
    ".write": "now < 1633017600000",  // 2021-10-1
  }
}

I understand that these rules are not secure but is there any way I can extend these rules beyond 2021-10-1 by changing the numbers? Can't find anything regarding '1633017600000' in the documentation.


Solution

  • That is just Timestamp since UNIX Epoch in milliseconds. If you want to update to extend that time you can get a timestamp at Epoch Converter and enter your desired duration to get the timstamp. If you just don't want the time at first place then set the rules to true:

    {
      "rules": {
        ".read": "true"
        ".write": "true"
      }
    }
    

    Again, setting these to true allows anyone to read/write to database so I'd recommend implementing the security rules as per your use case.