Skip to content

Add permission checks to project options interface#377

Merged
cubap merged 3 commits intomainfrom
copilot/fix-project-options-access
Dec 19, 2025
Merged

Add permission checks to project options interface#377
cubap merged 3 commits intomainfrom
copilot/fix-project-options-access

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 18, 2025

The /project/options interface allowed any authenticated user to view project configuration and member lists for projects they weren't members of. The backend GET /project/:id endpoint validates permissions, but the frontend displayed data without checking membership.

Changes

  • Added authgate() method to ProjectOptions and ProjectCustomization components that validates user is in project.collaborators before rendering
  • Shows permission error page via existing renderPermissionError() utility when unauthorized
  • Uses in operator for safe property checking: userId in project.collaborators

Implementation

authgate(project) {
    if (!this.checkUserIsCollaborator(project)) {
        this.renderPermissionError()
        return
    }
    this.render()
}

checkUserIsCollaborator(project) {
    if (!project) return false
    const userId = getUserFromToken(TPEN.getAuthorization())
    if (!userId) return false
    return project.collaborators && userId in project.collaborators
}

Follows the same pattern as /interfaces/transcription and /interfaces/manage-project.

Original prompt

This section details on the original issue you should resolve

<issue_title>Project Options Interface No Permissions Necessary</issue_title>
<issue_description>I can load the /project/options interface for any project, even those I am not a part of. There are no warnings.

Logically, this means the service to GET the project data did not care who I was either. </issue_description>

<agent_instructions>If there is a similar issue needed in TPEN-Services, please create that as well.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 18, 2025 21:49
Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>
Co-authored-by: cubap <1119165+cubap@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix permissions issue for project options interface Add permission checks to project options interface Dec 18, 2025
Copilot AI requested a review from cubap December 18, 2025 21:57
@cubap cubap marked this pull request as ready for review December 19, 2025 00:26
@github-actions
Copy link
Copy Markdown
Contributor

@cubap cubap merged commit da97b39 into main Dec 19, 2025
1 check passed
@cubap cubap deleted the copilot/fix-project-options-access branch December 19, 2025 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project Options Interface No Permissions Necessary

2 participants