UNPKG

webssh2-server

Version:

A Websocket to SSH2 gateway using xterm.js, socket.io, ssh2

54 lines (53 loc) 2.13 kB
// app/config/transformers.ts // Pure transformation functions for configuration /** * Masks sensitive configuration data for logging * @param config - Configuration to mask * @returns Masked configuration safe for logging * @pure */ export const maskSensitiveConfig = (config) => { return { listen: config.listen, http: { origins: config.http.origins.length > 0 ? `${config.http.origins.length} origin(s)` : 'none' }, user: { name: config.user.name != null && config.user.name !== '' ? '***' : null, password: config.user.password != null && config.user.password !== '' ? '***' : null, privateKey: config.user.privateKey != null && config.user.privateKey !== '' ? '***' : null, passphrase: config.user.passphrase != null && config.user.passphrase !== '' ? '***' : null }, ssh: { host: config.ssh.host, port: config.ssh.port, localAddress: config.ssh.localAddress, localPort: config.ssh.localPort, term: config.ssh.term, readyTimeout: config.ssh.readyTimeout, keepaliveInterval: config.ssh.keepaliveInterval, keepaliveCountMax: config.ssh.keepaliveCountMax, allowedSubnets: config.ssh.allowedSubnets?.length ?? 0, algorithms: { cipher: config.ssh.algorithms.cipher.length, kex: config.ssh.algorithms.kex.length, hmac: config.ssh.algorithms.hmac.length, compress: config.ssh.algorithms.compress.length, serverHostKey: config.ssh.algorithms.serverHostKey.length } }, header: config.header, options: config.options, session: { name: config.session.name, secret: config.session.secret === '' ? 'not set' : '***' }, sso: { enabled: config.sso.enabled, csrfProtection: config.sso.csrfProtection, trustedProxies: config.sso.trustedProxies.length } }; };