[bug] Fix duplicate -d short flag collision between --debug and --domain (#1)#2
Merged
Merged
Conversation
-d short flag collision between --debug and --domain (#1)-d short flag collision between --debug and --domain (#1)
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.
Linked Issue
Closes #1
Root Cause
Both
ap.NewBoolArgument(&debug, "-d", "--debug", ...)(default group) andgroup_auth.NewStringArgument(&authDomain, "-d", "--domain", ...)(Authentication group) registered the same short flag-d. Thegooptsparser flattens arguments from all groups into a singleshortNameToArgumentmap duringpopulateMaps(), so two registrations with the same short name silently overwrite each other and only one of the two flags is reachable via-d. In practice this meant-d <domain>was being consumed as the boolean--debugflag and the domain value was dropped, while the help output still advertised-dfor both.Fix Description
Remove the
-dshort alias from--debugso-dresolves unambiguously to--domain. This matches the convention already used by the Manticore parent project (Manticore/main.go) where--debugis registered with no short alias and-dis reserved for the authentication domain. Users can still enable debug mode with--debug. The README usage block is updated to reflect the new behavior.How Verified
Runtime:
go build -o KeyCredentialHound ../KeyCredentialHound -d example.com -dc 1.2.3.4 -u u -p penabled debug logging (the-dwas consumed as--debug) and did not bindexample.comto--domain.DEBUG:lines (debug not enabled) andexample.comcorrectly binds to--domain. Using--debug -d example.comenables both as expected.-h) now shows--debug(no short form) and-d, --domainonly.Test Coverage
None: the repository has no Go test suite and command-line parsing for this binary is exercised end-to-end against a real LDAP server; the change is verified by runtime inspection of the help output and flag behavior described above.
Scope of Change
main.go,README.mdRisk and Rollout
Minor user-facing change: anyone who was previously typing
-dexpecting--debugmust now use--debug. Trivial to communicate in release notes; no rollout coordination needed.