feat: release OpsXShell 2.1.0 native Tauri edition

This commit is contained in:
Logan.Li committed 2026-07-30 23:32:51 +08:00
1 parent e9a0d21758
commit a3dba0c6ed
311 files changed
+31748 -14897

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
import { describe, expect, it } from 'vitest'
import { redactForLog } from '../../src/utils/logger'
describe('redactForLog', () => {
it('redacts nested credentials without mutating the source', () => {
const source = {
host: 'opsbase.cn',
password: 'hunter2',
auth: { passphrase: 'secret', username: 'root' },
}
expect(redactForLog(source)).toEqual({
host: 'opsbase.cn',
password: '[REDACTED]',
auth: { passphrase: '[REDACTED]', username: 'root' },
})
expect(source.password).toBe('hunter2')
})
it('redacts private keys, authorization values and URL passwords', () => {
expect(redactForLog('-----BEGIN OPENSSH PRIVATE KEY-----\nabc')).toBe('[REDACTED]')
expect(redactForLog('Bearer abc.def_123')).toBe('Bearer [REDACTED]')
expect(redactForLog('ssh://root:password@example.com')).toBe('ssh://root:[REDACTED]@example.com')
})
it('handles circular structures', () => {
const value: Record<string, unknown> = {}
value.self = value
expect(redactForLog(value)).toEqual({ self: '[Circular]' })
})
})