@nx/docker 22.7.6 → 22.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nx/docker",
3
3
  "description": "The Nx Plugin for Docker to aid in containerizing projects.",
4
- "version": "22.7.6",
4
+ "version": "22.7.8",
5
5
  "type": "commonjs",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -51,11 +51,11 @@
51
51
  "executors": "./executors.json",
52
52
  "generators": "./generators.json",
53
53
  "dependencies": {
54
- "@nx/devkit": "22.7.6",
54
+ "@nx/devkit": "22.7.8",
55
55
  "enquirer": "~2.3.6",
56
56
  "tslib": "^2.3.0"
57
57
  },
58
58
  "devDependencies": {
59
- "nx": "22.7.6"
59
+ "nx": "22.7.8"
60
60
  }
61
61
  }
@@ -53,7 +53,9 @@ async function checkDockerImageExistsLocally(imageRef) {
53
53
  const normalizedImageRef = imageRef.startsWith('docker.io/')
54
54
  ? imageRef.split('docker.io/')[1]
55
55
  : imageRef;
56
- const childProcess = (0, child_process_1.exec)(`docker images --filter "reference=${normalizedImageRef}" --quiet`, { encoding: 'utf8', windowsHide: true });
56
+ // Pass args as an array (no shell) so the reference read back from the
57
+ // .docker-version file can't break out into command injection.
58
+ const childProcess = (0, child_process_1.execFile)('docker', ['images', '--filter', `reference=${normalizedImageRef}`, '--quiet'], { encoding: 'utf8', windowsHide: true });
57
59
  let result = '';
58
60
  childProcess.stdout?.on('data', (data) => {
59
61
  result += data;
@@ -77,7 +79,7 @@ async function checkDockerImageExistsLocally(imageRef) {
77
79
  async function dockerPush(imageReference, quiet) {
78
80
  try {
79
81
  return await new Promise((res, rej) => {
80
- const childProcess = (0, child_process_1.exec)(`docker push ${imageReference}${quiet ? ' --quiet' : ''}`, {
82
+ const childProcess = (0, child_process_1.execFile)('docker', ['push', imageReference, ...(quiet ? ['--quiet'] : [])], {
81
83
  encoding: 'utf8',
82
84
  maxBuffer: exports.LARGE_BUFFER,
83
85
  windowsHide: true,
@@ -71,7 +71,9 @@ function updateProjectVersion(newVersion, nxDockerImageRefEnvOverride, workspace
71
71
  const newImageRef = getImageReference(projectRoot, repositoryName, registry);
72
72
  const fullImageRef = nxDockerImageRefEnvOverride ?? `${newImageRef}:${newVersion}`;
73
73
  if (!isDryRun) {
74
- (0, child_process_1.execSync)(`docker tag ${imageRef} ${fullImageRef}`, {
74
+ // argv array, not a shell string - the image ref is assembled from workspace
75
+ // config, CLI flags and env, so it can't be trusted as shell input.
76
+ (0, child_process_1.execFileSync)('docker', ['tag', imageRef, fullImageRef], {
75
77
  windowsHide: true,
76
78
  });
77
79
  }