Skip to content

sec: added --end-of-options to prevent unintended options#1

Merged
caarlos0 merged 2 commits into
aymanbagabas:masterfrom
caarlos0:end-of-options
Aug 26, 2025
Merged

sec: added --end-of-options to prevent unintended options#1
caarlos0 merged 2 commits into
aymanbagabas:masterfrom
caarlos0:end-of-options

Conversation

@caarlos0
Copy link
Copy Markdown
Collaborator

this prevents user-provided args being handles as git options.

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Comment thread repo_reference_test.go

// Set a symbolic reference
_, err = r.SymbolicRef(SymbolicRefOptions{
Name: "TEST-REF",
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was failing for me in main as well

@caarlos0 caarlos0 requested review from aymanbagabas and Copilot and removed request for Copilot August 25, 2025 16:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-options flag 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.

Comment thread repo_commit.go Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@caarlos0 caarlos0 merged commit 1f81c54 into aymanbagabas:master Aug 26, 2025
13 checks passed
@caarlos0 caarlos0 deleted the end-of-options branch August 26, 2025 19:25
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>
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.

2 participants