Repository navigation
fix: allow repositories where owner matches repo name (e.g. profile README repos) - #18
Merged
xcorail merged 3 commits intoOct 2, 2026
Conversation
thedavidweng
requested review from
anticomputer,
kevinbackhouse and
xcorail
as code owners
October 1, 2026 22:28
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Multi-slash inputs remain valid and can silently target a different repository.
Review effort: Balanced
Findings: 1
What changed in this PR
Updates repository parsing to support profile README repositories where owner and repository names match.
Changes:
- Replaces equality-based rejection with slash validation.
- Applies validation to argument and interactive inputs.
| File | Description |
|---|---|
gh-secure |
Updates repository identifier validation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
kevinbackhouse
previously approved these changes
Oct 2, 2026
xcorail
reviewed
Oct 2, 2026
xcorail
approved these changes
Oct 2, 2026
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.

Problem
When targeting a repository whose name matches the owner (such as GitHub profile README repositories like
octocat/octocatorusername/username),gh-secureaborts with:Root cause
In
resolve_repo(), the script checked:This assumed that if no slash was provided in the input,
${REPO%%/*}and${REPO##*/}would both evaluate to the full input string. However, on GitHub, profile README repositories legitimately have$OWNER == $REPO_NAME.Additionally, in the interactive fallback (
read -r REPO), the check only verified[ -z "$OWNER" ] || [ -z "$REPO_NAME" ], which did not enforce the presence of a slash if an unslashed single word was entered.Fix
Replace
[ "$OWNER" = "$REPO_NAME" ]with[[ "$REPO" != */* ]]in both argument-parsing and interactive prompt validation:This properly ensures that a slash separates owner and repository while accepting repositories where the repository name is identical to the owner.
Testing
--repo username/username: Successfully accepted and proceeds to check security status.--repo owner/repo: Works as expected.--repo invalid: Correctly rejected withError: Repository must be in 'owner/repo' format.--repo /repo: Correctly rejected.--repo owner/: Correctly rejected.username/username: Accepted.invalid: Rejected.