зеркало из https://github.com/docker/kitematic.git
Fix bug where scrubbing system usernames would accidentally scrub entire paths
This commit is contained in:
Родитель
7abd94fc30
Коммит
161b35fd44
|
@ -26,8 +26,8 @@ describe('Util', function () {
|
||||||
expect(util.removeSensitiveData(testdata).indexOf('/Users/<redacted>/')).toNotEqual(-1);
|
expect(util.removeSensitiveData(testdata).indexOf('/Users/<redacted>/')).toNotEqual(-1);
|
||||||
|
|
||||||
testdata = String.raw`/Users/some.wei-rdUsername/.docker/machine/machines/dev2/id_rsa docker@localhost echo`;
|
testdata = String.raw`/Users/some.wei-rdUsername/.docker/machine/machines/dev2/id_rsa docker@localhost echo`;
|
||||||
expect(util.removeSensitiveData(testdata).indexOf('/Users/some.wei-rdUsername/')).toEqual(-1);
|
expect(util.removeSensitiveData(testdata).indexOf('/Users/some.wei-rdUsername/.docker')).toEqual(-1);
|
||||||
expect(util.removeSensitiveData(testdata).indexOf('/Users/<redacted>/')).toNotEqual(-1);
|
expect(util.removeSensitiveData(testdata).indexOf('/Users/<redacted>/.docker')).toNotEqual(-1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it ('returns input if empty or not a string', function () {
|
it ('returns input if empty or not a string', function () {
|
||||||
|
|
|
@ -59,7 +59,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
return str.replace(/-----BEGIN CERTIFICATE-----.*-----END CERTIFICATE-----/mg, '<redacted>')
|
return str.replace(/-----BEGIN CERTIFICATE-----.*-----END CERTIFICATE-----/mg, '<redacted>')
|
||||||
.replace(/-----BEGIN RSA PRIVATE KEY-----.*-----END RSA PRIVATE KEY-----/mg, '<redacted>')
|
.replace(/-----BEGIN RSA PRIVATE KEY-----.*-----END RSA PRIVATE KEY-----/mg, '<redacted>')
|
||||||
.replace(/\/Users\/.*\//mg, '/Users/<redacted>/');
|
.replace(/\/Users\/[^\/]*\//mg, '/Users/<redacted>/');
|
||||||
},
|
},
|
||||||
packagejson: function () {
|
packagejson: function () {
|
||||||
return JSON.parse(fs.readFileSync(path.join(__dirname, '../..', 'package.json'), 'utf8'));
|
return JSON.parse(fs.readFileSync(path.join(__dirname, '../..', 'package.json'), 'utf8'));
|
||||||
|
|
Загрузка…
Ссылка в новой задаче