You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: remove smoke test
* feat: fail intall if checksum cannot be verified
* fix: clean up stale keyring credentials
Store API keys under a stable keyring entry instead of deriving the entry name from base URL and account ID. The old scheme could leave credentials behind if config.yaml was edited manually before logout.
On first read, migrate an existing URL/account-scoped key to the stable api-key entry and delete the legacy entry. Keep a TODO to remove the migration in v1 after users have had a release cycle to move forward.
Logout now clears the whole chatwoot-cli keyring service even when config.yaml is missing, so stale entries are removed independently of the current config state.
* fix: sanitize server-controlled CLI output
Sanitize server-provided strings before writing auth login output, raw API responses, verbose non-JSON bodies, and API error bodies to the terminal.
Expand verbose JSON redaction to cover hmac_identifier and common secret-like field names such as *_token, *_secret, *_key, and hmac_* values.
Tests cover terminal escape stripping for the affected output paths and redaction of HMAC/secret-like response fields.
* fix: scope saved keyring credentials
Store stable keyring credentials as scoped JSON containing the normalized base URL, account ID, and API key instead of a raw token.
ResolveAPIKey now rejects saved credentials when the current config points at a different instance or account, preventing a token from being sent to the wrong host after config.yaml is edited or restored.
Legacy scoped entries are migrated into the new scoped JSON format and then deleted.
// DeleteAPIKey removes every credential saved by this CLI service. This avoids
119
+
// leaving stale keyring entries behind when config.yaml was edited or removed.
120
+
funcDeleteAPIKey(_*Config) error {
121
+
err:=keyring.DeleteAll(keyringService)
122
+
iferr==nil||errors.Is(err, keyring.ErrNotFound) {
123
+
returnnil
124
+
}
125
+
returnfmt.Errorf("failed to delete API keys from keyring: %w", err)
75
126
}
76
127
77
128
funcmissingAPIKeyError() error {
78
129
returnfmt.Errorf("%w; run 'chatwoot auth login' or set %s", ErrAPIKeyNotFound, APIKeyEnv)
79
130
}
80
131
81
-
funccredentialKey(cfg*Config) string {
132
+
funccredentialScopeMismatchError() error {
133
+
returnfmt.Errorf("%w; saved keyring credential does not match configured instance; run 'chatwoot auth login' for this base URL and account", ErrAPIKeyNotFound)
0 commit comments