Skip to content

chore(login): improve --password flag description with security guidance#855

Open
gcharpe1604 wants to merge 1 commit into
goharbor:mainfrom
gcharpe1604:improve-login-password-flag-description
Open

chore(login): improve --password flag description with security guidance#855
gcharpe1604 wants to merge 1 commit into
goharbor:mainfrom
gcharpe1604:improve-login-password-flag-description

Conversation

@gcharpe1604
Copy link
Copy Markdown
Contributor

@gcharpe1604 gcharpe1604 commented May 2, 2026

Description

The --password / -p flag in harbor login had a minimal description (Password) that gave users no indication of the shell history security risk. Updated the description to guide users toward the safer --password-stdin alternative, following the same convention used by docker login.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation update
  • Chore / maintenance

Changes

  • Updated --password flag description in cmd/harbor/root/login.go to warn about shell history exposure and recommend --password-stdin
  • Added -n short flag for --context-name in harbor login command
  • Updated doc/cli-docs/harbor-login.md to reflect the new flag description and the new -n short flag
  • Updated doc/man-docs/man1/harbor-login.1 to reflect the new flag description and the new -n short flag

Testing

$ harbor login --help

-p, --password string Password (not recommended, use --password-stdin for better security)

Copy link
Copy Markdown
Collaborator

@qcserestipy qcserestipy left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! Adding the docs is nice. However, this PR also introduces changes to the short flag of the cli login context-name. Please update the PR description to also cover this point.

Comment thread cmd/harbor/root/login.go
@codecov
Copy link
Copy Markdown

codecov Bot commented May 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 8.80%. Comparing base (60ad0bd) to head (94031ed).
⚠️ Report is 159 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##             main    #855      +/-   ##
=========================================
- Coverage   10.99%   8.80%   -2.19%     
=========================================
  Files         173     280     +107     
  Lines        8671   13965    +5294     
=========================================
+ Hits          953    1230     +277     
- Misses       7612   12618    +5006     
- Partials      106     117      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@qcserestipy qcserestipy added the Changes Requesed feedback that must be addressed before merging. label May 3, 2026
@gcharpe1604 gcharpe1604 force-pushed the improve-login-password-flag-description branch from ec97a1f to 191a17e Compare May 3, 2026 20:09
@gcharpe1604 gcharpe1604 requested a review from qcserestipy May 8, 2026 05:07
@gcharpe1604
Copy link
Copy Markdown
Contributor Author

Hi @qcserestipy, thanks for the review!
I've updated the PR description to also cover the addition of the -n short flag for context-name as requested. Let me know if there's anything else needed!

@gcharpe1604 gcharpe1604 force-pushed the improve-login-password-flag-description branch from 51045f0 to ae8ccd2 Compare May 10, 2026 07:01
Copy link
Copy Markdown
Collaborator

@qcserestipy qcserestipy left a comment

Choose a reason for hiding this comment

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

LGTM, however cmd.MarkFlagsMutuallyExclusive("password", "password-stdin") is there now twice.

Signed-off-by: Govind Charpe <govind.charpe16@gmail.com>
@gcharpe1604 gcharpe1604 force-pushed the improve-login-password-flag-description branch from ae8ccd2 to 94031ed Compare May 10, 2026 11:36
@gcharpe1604
Copy link
Copy Markdown
Contributor Author

@qcserestipy Thank you for the review!
I have updated the branch to remove the duplicate cmd.MarkFlagsMutuallyExclusive("password", "password-stdin") declaration as requested. I've also ensured the PR is cleanly rebased and up to date with the latest main.

Let me know if there's anything else needed or if this is good to go!

@gcharpe1604 gcharpe1604 requested a review from qcserestipy May 10, 2026 11:56
@qcserestipy qcserestipy removed the Changes Requesed feedback that must be addressed before merging. label May 10, 2026
Copy link
Copy Markdown
Collaborator

@qcserestipy qcserestipy left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for your contribution!

@gcharpe1604
Copy link
Copy Markdown
Contributor Author

@qcserestipy Thank you for reviewing and approving the PR!!

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.

[feature]: improve --password flag description with security guidance in login command

2 participants