Skip to content

[bug] Fix duplicate -d short flag collision between --debug and --domain (#1)#2

Merged
p0dalirius merged 1 commit into
mainfrom
bugfix-short-flag-d-collision
May 21, 2026
Merged

[bug] Fix duplicate -d short flag collision between --debug and --domain (#1)#2
p0dalirius merged 1 commit into
mainfrom
bugfix-short-flag-d-collision

Conversation

@p0dalirius

Copy link
Copy Markdown
Contributor

Linked Issue

Closes #1

Root Cause

Both ap.NewBoolArgument(&debug, "-d", "--debug", ...) (default group) and group_auth.NewStringArgument(&authDomain, "-d", "--domain", ...) (Authentication group) registered the same short flag -d. The goopts parser flattens arguments from all groups into a single shortNameToArgument map during populateMaps(), 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 --debug flag and the domain value was dropped, while the help output still advertised -d for both.

Fix Description

Remove the -d short alias from --debug so -d resolves unambiguously to --domain. This matches the convention already used by the Manticore parent project (Manticore/main.go) where --debug is registered with no short alias and -d is 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:

  • Build: go build -o KeyCredentialHound .
  • Before: ./KeyCredentialHound -d example.com -dc 1.2.3.4 -u u -p p enabled debug logging (the -d was consumed as --debug) and did not bind example.com to --domain.
  • After: the same invocation no longer prints DEBUG: lines (debug not enabled) and example.com correctly binds to --domain. Using --debug -d example.com enables both as expected.
  • Help output (-h) now shows --debug (no short form) and -d, --domain only.

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

  • Files changed: main.go, README.md
  • Submodule pointer updated: no
  • Behavioral changes outside the bug fix: none

Risk and Rollout

Minor user-facing change: anyone who was previously typing -d expecting --debug must now use --debug. Trivial to communicate in release notes; no rollout coordination needed.

)

Remove the `-d` short alias from `--debug` so that `-d` can bind to
`--domain` as documented. Aligns with the Manticore project convention
of reserving `-d` for the authentication domain.
@p0dalirius p0dalirius self-assigned this May 21, 2026
@github-actions github-actions Bot changed the title Fix duplicate -d short flag collision between --debug and --domain (#1) [bug] Fix duplicate -d short flag collision between --debug and --domain (#1) May 21, 2026
@github-actions github-actions Bot added the bug Something isn't working label May 21, 2026
@p0dalirius p0dalirius merged commit 21d138a into main May 21, 2026
8 checks passed
@p0dalirius p0dalirius deleted the bugfix-short-flag-d-collision branch May 21, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Short flag -d is registered for both --debug and --domain causing silent collision

1 participant