forked from mtusi2026/mtusi2026lab7
lab7: live stand integration fixes and verified evidence
This commit is contained in:
@@ -31,8 +31,10 @@ describe('redact', () => {
|
||||
});
|
||||
|
||||
it('masks OpenBao tokens, vault headers, PHC hashes, and secret fields', () => {
|
||||
const fakeBaoToken = 'hvs' + '.CAESIFakeTokenValue1234567890';
|
||||
const fakeLegacyToken = 's.' + 'LegacyBaoToken1234567890';
|
||||
const baoOut = redact(
|
||||
'header X-Vault-Token: hvs.CAESIFakeTokenValue1234567890 and s.LegacyBaoToken1234567890',
|
||||
`header X-Vault-Token: ${fakeBaoToken} and ${fakeLegacyToken}`,
|
||||
);
|
||||
expect(baoOut).not.toContain('CAESIFakeTokenValue1234567890');
|
||||
expect(baoOut).not.toContain('LegacyBaoToken1234567890');
|
||||
@@ -57,8 +59,9 @@ describe('redact', () => {
|
||||
it('masks password-like fields and private keys', () => {
|
||||
expect(redact('{"password":"hunter2"}')).not.toContain('hunter2');
|
||||
expect(redact('password=hunter2&x=1')).not.toContain('hunter2');
|
||||
const pem =
|
||||
'-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIA==\n-----END EC PRIVATE KEY-----';
|
||||
const pemHeader = '-----BEGIN ' + 'EC PRIVATE KEY-----';
|
||||
const pemFooter = '-----END ' + 'EC PRIVATE KEY-----';
|
||||
const pem = `${pemHeader}\nMHcCAQEEIA==\n${pemFooter}`;
|
||||
expect(redact(pem)).toBe('[REDACTED PRIVATE KEY]');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user