Draft
Conversation
Co-authored-by: Wilson Ler <lws803@gmail.com>
|
Cursor Agent can help with this pull request. Just |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Description
This PR implements robust access control for private repositories, ensuring they are only visible and accessible to their owners.
Previously, private repositories could be viewed or accessed indirectly through various public feeds, API endpoints, or by non-owners. This change centralizes visibility checks and applies them across all user-facing read paths.
Key changes include:
repository-visibility.tshelper provides functions to determine if a user can access a given repository based on its public status or ownership via therepositories_userstable./[org]/[repo]and/[org]/[repo]/status/[status]pages now requires ownership for private repos./api/feed/[org]/[repo]) now enforce ownership for private repos, returning a 404 for unauthorized access.Cache-Controlheaders (private, no-store) when user-owned private repos might be included, preventing caching of personalized content.How to test
UserA.UserA/private-repo).UserA, navigate toUserA/private-repo. Verify full access to the repo page, feed, and status updates.UserA;UserA/private-reposhould appear.UserAcan subscribe/unsubscribe toUserA/private-repo.UserB(who is not an owner ofUserA/private-repo).UserA/private-repo. Verify a 404 page is displayed.UserB;UserA/private-reposhould not appear.UserA/private-repoasUserB. Verify this action is prevented.UserA/private-repo(e.g.,/api/feed/UserA/private-repo). Verify a 404 or unauthorized response.UserA/public-repo).UserA/public-repois accessible to bothUserAandUserB(and logged-out users).UserA/public-repoappears in global feeds for all users.