Skip to content

Commit

Permalink
fix: remove sensitive information from agent config toJSON() method (#…
Browse files Browse the repository at this point in the history
…1112)

Signed-off-by: Jim Ezesinachi <[email protected]>
  • Loading branch information
jimezesinachi authored Nov 23, 2022
1 parent d82ad01 commit 427a80f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
12 changes: 10 additions & 2 deletions packages/core/src/agent/AgentConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,16 @@ export class AgentConfig {
public toJSON() {
return {
...this.initConfig,
logger: this.logger !== undefined,
agentDependencies: this.agentDependencies != undefined,
walletConfig: {
...this.walletConfig,
key: this.walletConfig?.key ? '[*****]' : undefined,
storage: {
...this.walletConfig?.storage,
credentials: this.walletConfig?.storage?.credentials ? '[*****]' : undefined,
},
},
logger: this.logger.logLevel,
agentDependencies: Boolean(this.agentDependencies),
label: this.label,
}
}
Expand Down
9 changes: 8 additions & 1 deletion packages/core/src/wallet/WalletApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ export class WalletApi {
}

public async initialize(walletConfig: WalletConfig): Promise<void> {
this.logger.info(`Initializing wallet '${walletConfig.id}'`, walletConfig)
this.logger.info(`Initializing wallet '${walletConfig.id}'`, {
...walletConfig,
key: walletConfig?.key ? '[*****]' : undefined,
storage: {
...walletConfig?.storage,
credentials: walletConfig?.storage?.credentials ? '[*****]' : undefined,
},
})

if (this.isInitialized) {
throw new WalletError(
Expand Down

0 comments on commit 427a80f

Please sign in to comment.