You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
core.review_links grants only postgres — both review-link endpoints 500 #654
GET /v1/reviews/links
{"error":"Failed to fetch review links","message":"permission denied for table review_links"}
GET /v1/reviews/links/by-token/{token}
{"error":"Lookup failed","message":"permission denied for table review_links"}
No authenticated, no service_role. Compare core.reviews, which has both.
Same class as #481 and migrations 332/335: the table is created with RLS and a policy, and the GRANT that makes the policy reachable is forgotten, so it surfaces as a server error rather than a permission one.
by-token is the path a reviewer follows from an emailed link, so this breaks review collection end to end.
Acceptance
A migration grants service_role and the appropriate authenticated privileges on core.review_links
Both endpoints return 200 against a live stack
by-token still refuses a token that is not the caller's to use — check the policy, not only the grant
Correction to how this was diagnosed, now fixed in #723.
I wrote that core.review_links had no policies at all. It had four — review_links_owner_{select,insert,update,delete}, created by migration 326 alongside ENABLE ROW LEVEL SECURITY, with exactly the predicate I then re-added under different names.
The fix was still right. 326 wrote the policies but never issued a GRANT, so authenticated and service_role had no privileges and every endpoint answered permission denied. The GRANTs in 347 are what resolved it — this is the #481 / 332 / 335 pattern, as filed. Only the policy half was redundant, and #723 drops it.
The bad reading came from:
select polname||' | '||polcmd from pg_policy where polrelid=...
ERROR: operator is not unique: text || "char"
run with 2>/dev/null. The error printed nothing, an empty result looked like a finding, and it went into the migration comment, the PR and this issue. pg_policies shows them plainly — which is what I used for role_assignments in the same PR, and why that half was correct.
Nothing was widened at any point: the duplicate predicates were identical, and permissive policies for the same command OR together.
Deployed. Migrations 347 + 351 applied and recorded in all three environments.
Before, identically in dev, preview and prod:
grants: postgres only
policies: review_links_owner_{select,insert,update,delete} (from 326)
which confirms the correction on this issue — the policies were always there; only the GRANTs were missing. 351 was therefore a clean no-op remotely, since 347 had never been applied to create the redundant set.
Verified functionally rather than by inspection — querying as the authenticated role, before and after:
before
after
dev / preview / prod
ERROR: 42501: permission denied for table review_links
0 rows, RLS scoping correctly
That error is the exact production symptom this issue reported, so the fix is confirmed against the real databases and not just locally.
Note for anyone tracking rollout: this endpoint's repair needed only the schema change, so it is live now. The route hardening from #667 (the explicit subject_user_id filter, and 404 instead of 200 when revoking someone else's link) ships with the api edge function, which has not been deployed since 2026-08-12.
Activity
fix(api): review links were unreachable, and the org member list read…
fix(feedback): move user_feedback into core, so the router is reachab…
fix(feedback): move user_feedback into core, so the router is reachab…
fix(feedback): move user_feedback into core, so the router is reachab…
fix(feedback): move user_feedback into core, so the router is reachab…
feat(api)!: delete the employers route, and move user_feedback so /v1…
thinkclay commentedon Sep 10, 2026
Correction to how this was diagnosed, now fixed in #723.
I wrote that
core.review_linkshad no policies at all. It had four —review_links_owner_{select,insert,update,delete}, created by migration 326 alongsideENABLE ROW LEVEL SECURITY, with exactly the predicate I then re-added under different names.The fix was still right. 326 wrote the policies but never issued a GRANT, so
authenticatedandservice_rolehad no privileges and every endpoint answeredpermission denied. The GRANTs in 347 are what resolved it — this is the #481 / 332 / 335 pattern, as filed. Only the policy half was redundant, and #723 drops it.The bad reading came from:
run with
2>/dev/null. The error printed nothing, an empty result looked like a finding, and it went into the migration comment, the PR and this issue.pg_policiesshows them plainly — which is what I used forrole_assignmentsin the same PR, and why that half was correct.Nothing was widened at any point: the duplicate predicates were identical, and permissive policies for the same command OR together.
thinkclay commentedon Sep 10, 2026
Deployed. Migrations 347 + 351 applied and recorded in all three environments.
Before, identically in dev, preview and prod:
which confirms the correction on this issue — the policies were always there; only the GRANTs were missing. 351 was therefore a clean no-op remotely, since 347 had never been applied to create the redundant set.
After, identically in all three:
Verified functionally rather than by inspection — querying as the
authenticatedrole, before and after:ERROR: 42501: permission denied for table review_links0rows, RLS scoping correctlyThat error is the exact production symptom this issue reported, so the fix is confirmed against the real databases and not just locally.
Note for anyone tracking rollout: this endpoint's repair needed only the schema change, so it is live now. The route hardening from #667 (the explicit
subject_user_idfilter, and 404 instead of 200 when revoking someone else's link) ships with the api edge function, which has not been deployed since 2026-08-12.fix(db): grant the roles six core policies already name (#755) (#758)