# What does 'PERMISSION_DENIED: Permission denied' (Realtime Database) mean?

**Short answer:** Your Realtime Database Security Rules didn't grant `.read` or `.write` at that path for this user. Add rules scoped to `auth.uid` for the path. Don't set the root to `".read": true, ".write": true`.

*Last updated 2026-11-25 · Reviewed by ProofForge*

## The exact error

```text
FIREBASE WARNING: set at /users/abc failed: permission_denied
Error: PERMISSION_DENIED: Permission denied
```

## Why it happens

- Default locked rules (`false`) or expired test-mode rules.
- The user isn't signed in yet when the read or write starts.
- The rule is on a different path than the one the code writes to.

## How to fix it

1. Start from locked rules, then open only the per-user path:

```json
{
  "rules": {
    ".read": false,
    ".write": false,
    "users": {
      "$uid": {
        ".read": "auth != null && auth.uid === $uid",
        ".write": "auth != null && auth.uid === $uid"
      }
    }
  }
}
```

## Check it's fixed

In the Rules Playground, simulate a read of `/users/<your uid>` as yourself (allowed) and as unauthenticated (denied).

> **Scan box (use the site's ScanBox component):** Check whether your live app has this problem. Paste your URL for a free outside-in scan covering exposed keys, open database rules, CORS and security headers. [Scan my app free →](https://proofforge.live/#scan)

## FAQ

### Rules cascade?
Yes. In Realtime Database, a `.read`/`.write` grant at a parent path grants all children, so never grant at the root.

### Is `auth != null` enough?
No. It lets every signed-up user read everyone's data. Compare `auth.uid` to the path.

### Does ProofForge read my data?
No. The scan only checks whether a signed-out visitor gets access, without downloading rows.

## Sources

- [Firebase: Understand Realtime Database Security Rules](https://firebase.google.com/docs/database/security)
- [Firebase: Basic Security Rules](https://firebase.google.com/docs/rules/basics)

## Related

- [Fix: open Firebase rules](/fix/firebase-open-rules)
- [Firebase rules checker](/tools/firebase-rules-checker)
- [Fix Firestore 'Missing or insufficient permissions'](/errors/firebase-missing-or-insufficient-permissions)
- [All errors](/errors)
