sec: added --end-of-options to prevent unintended options#1
Merged
Conversation
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
caarlos0
commented
Aug 21, 2025
|
|
||
| // Set a symbolic reference | ||
| _, err = r.SymbolicRef(SymbolicRefOptions{ | ||
| Name: "TEST-REF", |
Collaborator
Author
There was a problem hiding this comment.
this was failing for me in main as well
There was a problem hiding this comment.
Pull Request Overview
This PR adds security hardening to Git command construction by adding the --end-of-options flag to prevent user-provided arguments from being interpreted as Git options.
- Adds
--end-of-optionsflag to Git commands that accept user-controlled input - Updates test to use a safer reference name without hyphens
- Ensures proper argument separation between Git options and user data
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| repo_tag.go | Adds --end-of-options to tag creation and deletion commands |
| repo_remote.go | Adds --end-of-options to various remote operations (add, remove, get-url, set-url) |
| repo_reference_test.go | Changes test reference name from "TEST-REF" to "TESTREF" |
| repo_reference.go | Adds --end-of-options to show-ref, symbolic-ref, and branch deletion commands |
| repo_pull.go | Adds --end-of-options to merge-base command |
| repo_grep.go | Adds --end-of-options to grep command |
| repo_diff.go | Adds --end-of-options to various diff and format-patch commands |
| repo_commit.go | Adds --end-of-options to log, diff, and rev-list commands |
| repo.go | Adds --end-of-options to init, clone, push, reset, move, and show commands |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
caarlos0
added a commit
to charmbracelet/soft-serve
that referenced
this pull request
Aug 26, 2025
The regex solution proposed in #737 is not sufficient. I've added `--end-of-options` to the relevant commands in aymanbagabas/git-module#1 so this reverts changes made in #737 and update git-module to include that fix. Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
caarlos0
added a commit
to charmbracelet/soft-serve
that referenced
this pull request
Aug 26, 2025
The regex solution proposed in #737 is not sufficient. I've added `--end-of-options` to the relevant commands in aymanbagabas/git-module#1 so this reverts changes made in #737 and update git-module to include that fix. Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
caarlos0
added a commit
to charmbracelet/soft-serve
that referenced
this pull request
Aug 26, 2025
The regex solution proposed in #737 is not sufficient. I've added `--end-of-options` to the relevant commands in aymanbagabas/git-module#1 so this reverts changes made in #737 and update git-module to include that fix. Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
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.
this prevents user-provided args being handles as git options.