Every bucket has a rule for each action on files. You set them in Studio, in the bucket’s settings (Create a bucket).

The five rules

A Public bucket lets anyone with a file’s address read it, while uploads, listing and deletes still follow their rules. Reading an object does not let someone enumerate the bucket: set listing to authenticated and public files are still only reachable by those who hold the URL. What your application’s requests may do. Studio administrators can always manage objects, whatever is set here.

What a rule sees: $object

Plus $auth and the rest, as everywhere.

Design keys around rules

Put the owner first in the key, then one rule protects everything:
  • All of these rules pass:
    • Check a value: $auth.user_id is set
    • Compare values: $object.segments.0 equals $auth.user_id
Used as both write_policy and read_policy, this means each person reads and writes only under <their id>/…. For organizations, compare with $auth.org.

Recipes

Types and sizes are not rules

Accepted types (MIME patterns, checked against the file’s real contents) and Largest file are bucket settings, enforced regardless of who uploads. Use them together with rules. A signed link gives anyone who holds it one file for a short time, with no sign-in. A share link does the same for days and can be revoked. Both require the bucket to allow them, and creating one needs read access (signed) or a secret key (share). They bypass the caller’s identity by design, so treat them like passwords. See Download and links.

Refusals

The rule is evaluated before the file is looked up, so refusals never reveal whether a key exists.

Test it

Storage

Storage access guide.

Values and paths

Segments and missing values.