Skip to content

Fix semicolon-separated parameter parsing for git count-contributors (#3052) - #3064

Closed
gajeshbhat wants to merge 1 commit into
jfrog:masterfrom
gajeshbhat:fix/git-count-contributors-repo-name-list
Closed

gajeshbhat wants to merge 1 commit into
jfrog:masterfrom
gajeshbhat:fix/git-count-contributors-repo-name-list

Conversation

@gajeshbhat

Copy link
Copy Markdown

What does this PR do?

Fixes the issue where jf git count-contributors --repo-name parameter fails when users provide semicolon-separated repository names. The problem occurs because the shell interprets unquoted semicolons as command separators, and the utility functions needed better parsing logic.

Which issue does this PR fix?

Fixes jfrog/jfrog-cli-security#577

What type of PR is this?

Bug fix

What changes were made?

  • Enhanced GetStringsArrFlagValue() in utils/cliutils/codegangstautils.go to properly handle semicolon-separated values with trimming and empty string filtering
  • Enhanced overrideArrayIfSet() in utils/cliutils/utils.go with improved parsing and error handling
  • Added comprehensive tests in utils/cliutils/semicolon_parsing_test.go covering various edge cases and usage patterns

How should this be manually tested?

  1. Build the CLI: ./build/build.sh
  2. Test shell parsing issue (should fail): ./jf git count-contributors --repo-name=repo1;echo "ISSUE_DETECTED"
  3. Test proper usage (should work): ./jf git count-contributors --repo-name="repo1;repo2;repo3" --other-required-flags
  4. Run utility function tests: go test ./utils/cliutils -v -run TestSemicolon

Does this PR introduce a breaking change?

No - all changes are backward compatible. Existing code continues to work while providing better parsing for new usage.

Additional Notes

The root cause was that users need to quote semicolon-separated values (e.g., --repo-name="repo1;repo2") to prevent shell interpretation, but the utility functions also needed improvements to handle edge cases properly.

@ehl-jf ehl-jf added the safe to test Approve running integration tests on a pull request label Sep 27, 2025
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Sep 27, 2025
…(#3052)

- Enhanced GetStringsArrFlagValue() to properly handle semicolon-separated values with trimming and empty string filtering
- Enhanced overrideArrayIfSet() with improved parsing and error handling
- Added comprehensive tests for semicolon parsing utility functions

This fixes the issue where git count-contributors --repo-name parameter fails with multiple repositories due to
shell parsing of unquoted semicolons and improves the underlying utility functions used by platform services commands.
@ehl-jf ehl-jf added the safe to test Approve running integration tests on a pull request label Sep 30, 2025
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Sep 30, 2025
@github-actions

Copy link
Copy Markdown
Contributor

👍 Frogbot scanned this pull request and did not find any new security issues.


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.

jf git count-contributors with --repo-name parameter not working for lists

2 participants