Fixes #16739: checks for fork or if user is repo owner to prevent 404…#17478
Fixes #16739: checks for fork or if user is repo owner to prevent 404…#17478019-Abhi wants to merge 7 commits intogoogle-gemini:mainfrom
Conversation
…o prevent 404 while on setup-github
Summary of ChangesHello @019-Abhi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a 404 error encountered when the Gemini CLI's Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request aims to prevent 404 errors when running /setup-github by checking if the user is the owner of the repository before attempting to open the GitHub secrets URL. The implementation introduces a check that compares the repository owner from the git remote with the local git user's configured name. It also adds validation for the repository owner and name to ensure they are safe before being used to construct a URL.
My review focuses on the new validation logic. I've identified a high-severity issue with the regular expression used for validation, as it is too permissive and could allow invalid GitHub owner or repository names, potentially leading to incorrect URL generation. The rest of the logic seems sound and effectively addresses the problem of avoiding 404 errors.
|
Hey, I have added gemini's suggestions to have two separate functions to
verify github username and repo name safely... could you please review and
approve these changes as well...
Thanks a lot!
…On Sun, 25 Jan 2026 at 15:26, Iqbal Bhatti ***@***.***> wrote:
***@***.**** approved this pull request.
—
Reply to this email directly, view it on GitHub
<#17478 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BRD6QRDRR4NDHCCFUCL3A2T4ISHOFAVCNFSM6AAAAACSZZ2S7KVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTOMBTGYZDKOBUHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
There was a problem hiding this comment.
Code Review
This pull request aims to fix a bug where the /setup-github command could lead to a 404 error by attempting to open the secrets page for a repository the user does not own. The changes introduce checks to verify repository ownership against the local git user and validate the repository owner and name before constructing the URL.
The overall approach is sound, but there is a critical issue in the implementation where it tries to access a non-existent localUser property on the repoInfo object. This will cause the ownership check to always fail. I've provided a comment with a suggested fix to correctly fetch the local git user's name and perform the comparison.
|
suggestions added, aawating review
|
…s page if owner is the known upstream org
a24360d to
7547182
Compare
|
@scidomino @bdmorgan could you review this pr please when you have the time.... thanks a lot :)) |
|
@bdmorgan its been more than a month since ive opening this pr, PTAL |
|
Hi there! Thank you for your contribution to Gemini CLI. We really appreciate the time and effort you've put into this pull request. To keep our backlog manageable and ensure we're focusing on current priorities, we are closing pull requests that haven't seen maintainer activity for 30 days. Currently, the team is prioritizing work associated with 🔒 maintainer only or help wanted issues. If you believe this change is still critical, please feel free to comment with updated details. Otherwise, we encourage contributors to focus on open issues labeled as help wanted. Thank you for your understanding! |
… while on /setup-github,
Summary
This PR prevents a 404 error when running the /setup-github command in Gemini cli. It ensures the CLI only attempts to open the GitHub secrets configuration URL if the local user is confirmed as the owner of the repository fork.
Details
The CLI previously assumed that if a remote named origin existed, it was safe to open the settings/secrets/actions URL. However, in IDX and other cloud environments, the origin often points to the upstream (Google) repository which the user does not have write access to, leading to a 404.
Related Issues
Closes #16739, Fixes #16739
How to Validate
Run the Gemini CLI
Run the command: /setup-github
Expected Result: If the fork owner doesn't match your local git user, the CLI should print a warning message. If verification is successful, the user should be redirected to a readme page. Before this fix, the user was redirected to a 404 page because of the verification issue
If it is your own repo, it should attempt to open the browser as normal.
Pre-Merge Checklist