Skip to content

Commit 7cfc7a9

Browse files
committed
refactor: mask username in connection details for improved security
1 parent 322ee94 commit 7cfc7a9

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

rocketadmin-agent/src/helpers/cli/interactive-prompts.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,10 @@ export class InteractivePrompts {
412412
console.log(` ${chalk.gray('Host:')} ${chalk.white(config.host)}`);
413413
console.log(` ${chalk.gray('Port:')} ${chalk.white(config.port)}`);
414414
if (config.username) {
415-
console.log(` ${chalk.gray('Username:')} ${chalk.white(config.username)}`);
415+
const maskedUsername = config.username.length > 2
416+
? config.username.slice(0, 2) + '*'.repeat(Math.min(config.username.length - 2, 6))
417+
: '**';
418+
console.log(` ${chalk.gray('Username:')} ${chalk.white(maskedUsername)}`);
416419
}
417420
if (config.database) {
418421
console.log(` ${chalk.gray('Database:')} ${chalk.white(config.database)}`);

0 commit comments

Comments
 (0)