Skip to content

Add auth context to account JSON output#301

Merged
AndreyVMarkelov merged 1 commit into
masterfrom
json/account-auth-context
Jun 28, 2026
Merged

Add auth context to account JSON output#301
AndreyVMarkelov merged 1 commit into
masterfrom
json/account-auth-context

Conversation

@AndreyVMarkelov

@AndreyVMarkelov AndreyVMarkelov commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add result.auth object to account command output (both text and JSON) exposing credential source, refreshability, and auth file type
  • Refactor getAccessTokengetAccessCredential to expose full credential metadata without leaking secrets
  • Track auth context per-command via currentAuthContext (reset on each initDbx)
  • Contract test verifies no sensitive fields (tokens, paths, keys) leak into JSON output
  • Fix tautological case passwordFile != ""default in share-link password switch

Test plan

  • go test ./cmd/... passes
  • golangci-lint run clean
  • dbxcli account --output=json includes result.auth with saved credentials
  • DBXCLI_ACCESS_TOKEN=... dbxcli account --output=json shows source: "env"
  • DBXCLI_AUTH_FILE=... dbxcli account --output=json shows auth_file: "custom"
  • Text output shows Auth section with human-readable source labels

Include result.auth in account command output so scripts can identify
the credential source (saved vs env), whether credentials are
refreshable, and the auth file type (default, custom, none).
@AndreyVMarkelov AndreyVMarkelov merged commit 45fcded into master Jun 28, 2026
8 checks passed
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.

1 participant