TeamVis Self-Host-Bundle v0.31.0
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
-- K1 fix: Trusted-Token + Reveal-Felder nicht über anon-API auslesbar.
|
||||
-- ====================================================================
|
||||
-- bisher: RLS auf public.employees erlaubte anon-SELECT auf alle
|
||||
-- Spalten (inkl. trusted_token, trusted_reveal). Damit war der gesamte
|
||||
-- Trusted-Link-Mechanismus wirkungslos — jeder konnte den Token via
|
||||
-- /rest/v1/employees auslesen.
|
||||
--
|
||||
-- neu: column-level grants. Die anon-Rolle darf nur safe-Spalten
|
||||
-- selektieren. Postgres lehnt SELECT mit verbotener Spalte direkt ab.
|
||||
-- Die App-Schicht (lib/employees.ts) selektiert deshalb nur die
|
||||
-- safe-Spalten. Token-Validierung läuft ausschließlich server-side
|
||||
-- mit Service-Role-Key.
|
||||
|
||||
-- Policy bleibt unverändert: anon liest nur aktive Mitarbeiter.
|
||||
drop policy if exists "public_read_active_employees" on public.employees;
|
||||
create policy "public_read_active_employees"
|
||||
on public.employees for select
|
||||
to anon
|
||||
using (active = true);
|
||||
|
||||
-- Column-level grants: zuerst alle Rechte entziehen, dann gezielt
|
||||
-- nur die unkritischen Spalten freigeben. Trusted-Token-Felder bleiben
|
||||
-- für anon unzugänglich.
|
||||
revoke all on public.employees from anon;
|
||||
grant select
|
||||
(id, slug, academic_title, qualification, first_name, last_name,
|
||||
position, company, address, street, postal_code, city, email,
|
||||
phone_office, phone_mobile, website, linkedin_url, xing_url,
|
||||
calendar_url, photo_url, show_mobile, show_linkedin, show_xing,
|
||||
active, org_unit_id, created_at, updated_at)
|
||||
on public.employees to anon;
|
||||
Reference in New Issue
Block a user