mirror of https://github.com/docker/docs.git
				
				
				
			Fix bug where scrubbing system usernames would accidentally scrub entire paths
This commit is contained in:
		
							parent
							
								
									7abd94fc30
								
							
						
					
					
						commit
						161b35fd44
					
				|  | @ -26,8 +26,8 @@ describe('Util', function () { | |||
|       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`; | ||||
|       expect(util.removeSensitiveData(testdata).indexOf('/Users/some.wei-rdUsername/')).toEqual(-1); | ||||
|       expect(util.removeSensitiveData(testdata).indexOf('/Users/<redacted>/')).toNotEqual(-1); | ||||
|       expect(util.removeSensitiveData(testdata).indexOf('/Users/some.wei-rdUsername/.docker')).toEqual(-1); | ||||
|       expect(util.removeSensitiveData(testdata).indexOf('/Users/<redacted>/.docker')).toNotEqual(-1); | ||||
|     }); | ||||
| 
 | ||||
|     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>') | ||||
|       .replace(/-----BEGIN RSA PRIVATE KEY-----.*-----END RSA PRIVATE KEY-----/mg, '<redacted>') | ||||
|       .replace(/\/Users\/.*\//mg, '/Users/<redacted>/'); | ||||
|       .replace(/\/Users\/[^\/]*\//mg, '/Users/<redacted>/'); | ||||
|   }, | ||||
|   packagejson: function () { | ||||
|     return JSON.parse(fs.readFileSync(path.join(__dirname, '../..', 'package.json'), 'utf8')); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue