|
1 | 1 | import { SpawnPromiseResult } from 'child-process-promise'; |
2 | 2 |
|
3 | | -import { exec } from '../common/process'; |
| 3 | +import * as processWrapper from '../common/process'; |
4 | 4 | import * as config from'../common/config'; |
5 | 5 | import * as credentials from './credentials'; |
6 | 6 | import { SkopeoRepositoryType } from '../kube-scanner/types'; |
7 | 7 |
|
8 | | - |
9 | 8 | function getUniqueIdentifier(): string { |
10 | 9 | const [seconds, nanoseconds] = process.hrtime(); |
11 | 10 | return `${seconds}_${nanoseconds}`; |
@@ -38,17 +37,20 @@ export async function pull( |
38 | 37 | const creds = await credentials.getSourceCredentials(image); |
39 | 38 | const credentialsParameters = getCredentialParameters(creds); |
40 | 39 |
|
41 | | - return exec('skopeo', 'copy', ...credentialsParameters, |
42 | | - prefixRespository(image, SkopeoRepositoryType.ImageRegistry), |
43 | | - prefixRespository(destination, SkopeoRepositoryType.DockerArchive), |
44 | | - ); |
| 40 | + const args: Array<processWrapper.IProcessArgument> = []; |
| 41 | + args.push({body: 'copy', sanitise: false}); |
| 42 | + args.push(...credentialsParameters); |
| 43 | + args.push({body: prefixRespository(image, SkopeoRepositoryType.ImageRegistry), sanitise: false}); |
| 44 | + args.push({body: prefixRespository(destination, SkopeoRepositoryType.DockerArchive), sanitise: false}); |
| 45 | + |
| 46 | + return processWrapper.exec('skopeo', ...args); |
45 | 47 | } |
46 | 48 |
|
47 | | -export function getCredentialParameters(credentials: string | undefined): Array<string> { |
48 | | - const credentialsParameters: Array<string> = []; |
| 49 | +export function getCredentialParameters(credentials: string | undefined): Array<processWrapper.IProcessArgument> { |
| 50 | + const credentialsParameters: Array<processWrapper.IProcessArgument> = []; |
49 | 51 | if (credentials) { |
50 | | - credentialsParameters.push('--src-creds'); |
51 | | - credentialsParameters.push(credentials); |
| 52 | + credentialsParameters.push({body: '--src-creds', sanitise: true}); |
| 53 | + credentialsParameters.push({body: credentials, sanitise: true}); |
52 | 54 | } |
53 | 55 | return credentialsParameters; |
54 | 56 | } |
0 commit comments