Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabaseβ€’4y agoβ€’
3 replies
Pierre_

Protected columns?

Hey, I'm new to Supabase and postgresql in general, and I am trying to secure a
public.profiles
public.profiles
table in the database:
create table public.profiles (
  id uuid references auth.users not null,
  username text unique not null,
  email text unique not null,
  created_at timestamp with time zone,
  updated_at timestamp with time zone,
  avatar_url text,

  primary key (id),
  unique(username),
  constraint username_length check (char_length(username) >= 3)
);
create table public.profiles (
  id uuid references auth.users not null,
  username text unique not null,
  email text unique not null,
  created_at timestamp with time zone,
  updated_at timestamp with time zone,
  avatar_url text,

  primary key (id),
  unique(username),
  constraint username_length check (char_length(username) >= 3)
);

I therefore implemented RLS so that users are only allowed to edit their own profile:
-- ...
create policy "Users can update their own profile." on public.profiles
  for update using (auth.uid() = id);
-- ...
-- ...
create policy "Users can update their own profile." on public.profiles
  for update using (auth.uid() = id);
-- ...

But, if I haven't missed anything, I guess users would be able to edit any column in their profile, including
id
id
,
email
email
,
created_at
created_at
and
updated_at
updated_at
in this case. So what can I do to prevent that?

Thanks in advance for the help!
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Protected schema trigger
SupabaseSSupabase / help-and-questions
3y ago
Auth and protected pages
SupabaseSSupabase / help-and-questions
6mo ago
Sveltekit protected routes question
SupabaseSSupabase / help-and-questions
6mo ago
Next JS Protected Routes
SupabaseSSupabase / help-and-questions
4y ago