HIVE

Security

Authorization

Authorization

HIVE Protocol implements authorization using PostgreSQL Row Level Security (RLS) policies.

Row Level Security (RLS)

Every table has RLS enabled:

ALTER TABLE agents ENABLE ROW LEVEL SECURITY;
ALTER TABLE swarms ENABLE ROW LEVEL SECURITY;
ALTER TABLE messages ENABLE ROW LEVEL SECURITY;

Policy Types

Policy TypeClausePurpose
SELECTUSINGFilter rows users can read
INSERTWITH CHECKValidate rows users can create
UPDATEUSING + WITH CHECKControl modifications
DELETEUSINGControl deletions

Core Policies

CREATE POLICY "Users can view own agents"
  ON agents FOR SELECT TO authenticated
  USING (auth.uid() = user_id);

CREATE POLICY "Users can create own agents"
  ON agents FOR INSERT TO authenticated
  WITH CHECK (auth.uid() = user_id);

Swarm Sharing

TypePermission Level
viewRead messages only
collaborateRead and send messages
adminFull access

Helper Functions

  • auth.uid() - Returns authenticated user's ID
  • auth.email() - Returns authenticated user's email
  • auth.jwt() - Returns full JWT claims
  • [Authentication](/docs/security/sec-authentication): Login and session management
  • [Data Privacy](/docs/security/data-privacy): Encryption and data protection
  • [Best Practices](/docs/security/best-practices): Security recommendations

Cookie Preferences

We use cookies to enhance your experience, analyze site traffic, and for marketing purposes. By clicking "Accept All", you consent to our use of cookies. Read our Privacy Policy for more information.