[AI] What to change: The top left dropdown-field showing all projects associated w... - #211
Open
burkongla wants to merge 1 commit into
Open
Conversation
…s associated w... Task: 14acaff0 Source: slack Requested by: U04E9DZ5ELF
✅ Deploy Preview for githelp-support ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated PR
Task: What to change: The top left dropdown-field showing all projects associated w...
Description: What to change: The top left dropdown-field showing all projects associated with a certain account/profile.
• Make sure that only projects associated with the account, are shown in the dropdown menu. This means that if a person for example are admin for 3 projects and helper for 5, only the relevant projects (the projects the profile has access to or are validated for are shown). For an admin this means that the project must be added by the person, or that the person is added as admin by other project owner of the project in question. For helper, this means that the helper must be validated as helper for the project in questions. This can only happen in two ways: The person adds himself as helper, from the Helper page for Admin. Or the person request to be validated as helper for a specific projects, and later is approved as helper for the project the person request to be a helper for.
Do not change: Anything else than what is listed.
Acceptance criteria: When all points listed under “Description and specific values” are implemented the task is done.
Source: slack
Requested by: U04E9DZ5ELF
Classification: flow
Changes
The project dropdown in the top bar shows every project the user has any
projects_membersrow for, regardless of role. Update theuseUserProjectshook so the dropdown only lists projects where the user is a validated admin (projects_members.role = 'admin') or a validated helper (a row in projects_helpers, which only exists after self-adding via the Helper page or being approved after a request).Security Review
Status: warn
The diff itself is safe: no secrets, no injection (PostgREST parameterizes
.eq/.in),projects_helpershas RLS enabled with a correctly scoped SELECT policy (is_project_member OR user_id = auth.uid()), and the table has no soft-delete column so no stale-helper access. Advisory only: theprojectstable'sUSING (true)SELECT policies make the client-side project filtering cosmetic — all project rows are readable by anyone with the anon key, which this hook'sselect("*")leans on.Warnings:
.from("projects").select("*").in("project_id", projectIds)query relies on theprojectstable RLS for enforcement, and the backend dump showsprojects_select_all ... FOR SELECT TO authenticated USING (true)plus"Enable read access for all users" ... FOR SELECT USING (true)(no role restriction, so anon too). The client-side.in()filter is cosmetic — any user can read any project row (all columns) by crafting their own query with the anon key.projects_helpersrow exists once the helper is 'self-added or approved', but the RLS insert policy isprojects_helpers_insert_admins(admin-only). Self-addition must therefore go through a service-role Edge Function; the comment overstates the client-side path. Misleading authorization comments tend to cause future privilege mistakes (e.g. someone 'fixing' the insert policy to allow self-inserts).🤖 Generated by githelp-support agent team