Skip to content

Improve credential handling in CLI for better compatibility #155

@gerred

Description

@gerred

Overview

The CLI's current approach to handling credentials could be improved for better reliability and backwards compatibility.

Current Behavior

When performing operations like sf clusters users list or sf clusters config, the CLI:

  1. Fetches all credentials from the API
  2. Attempts to decrypt every credential, regardless of whether it's needed for the current operation
  3. Silently continues when decryption fails
  4. Treats regular namespace credentials and vCluster credentials differently

Proposed Improvements

  1. Unified credential decryption: Consider unified handling for both regular namespace credentials and vCluster credentials
  2. Smarter credential filtering: Filter credentials upfront based on what's relevant for the current operation
  3. Better error handling: Provide more informative error messages when decryption fails
  4. Field flexibility: Support credentials stored in either encrypted_token or KubeConfig fields for vCluster credentials

Benefits

  • Improved reliability when working with mixed credential types
  • Greater resilience to server-side changes
  • Better error reporting for users
  • Reduced unnecessary decryption operations

Implementation Notes

The main areas for improvement would be in src/lib/clusters/clusters.tsx and src/lib/clusters/credentialTypes.ts to make the credential handling more robust and flexible.

This change will complement server-side improvements for storing credential data consistently.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions