Skip to content

Commit 8e62550

Browse files
committed
fix(auth): display configuration metadata fields in auth list
Display only metadata fields (, provider) in auth list command instead of showing all fields including sensitive credentials. Fixes anomalyco#4533 - Filter to show only and provider fields from raw config - Rename section from 'Raw configuration' to 'Configuration' - Prevent credential leakage by not displaying auth fields
1 parent 3e67104 commit 8e62550

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

  • packages/opencode/src/cli/cmd

‎packages/opencode/src/cli/cmd/auth.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,24 @@ export const AuthListCommand = cmd({
177177
const homedir = os.homedir()
178178
const displayPath = authPath.startsWith(homedir) ? authPath.replace(homedir, "~") : authPath
179179
prompts.intro(`Credentials ${UI.Style.TEXT_DIM}${displayPath}`)
180+
181+
// Read raw auth.json configuration to display metadata fields like $schema and provider
182+
const authFile = Bun.file(authPath)
183+
const rawConfig = await authFile.json().catch(() => ({}))
184+
185+
// Display only metadata fields (non-credential fields)
186+
const metadataFields = ['$schema', 'provider']
187+
const metadataEntries = Object.entries(rawConfig).filter(([key]) => metadataFields.includes(key))
188+
189+
if (metadataEntries.length > 0) {
190+
prompts.intro("Configuration")
191+
for (const [key, value] of metadataEntries) {
192+
const displayValue = typeof value === 'object' ? JSON.stringify(value, null, 2) : String(value)
193+
prompts.log.info(`${key} ${UI.Style.TEXT_DIM}${displayValue}`)
194+
}
195+
UI.empty()
196+
}
197+
180198
const results = Object.entries(await Auth.all())
181199
const database = await ModelsDev.get()
182200

0 commit comments

Comments
 (0)