@fabric-harness/databricks 3.0.2 → 3.0.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"artifact-digest.d.ts","sourceRoot":"","sources":["../src/artifact-digest.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAwB9E"}
1
+ {"version":3,"file":"artifact-digest.d.ts","sourceRoot":"","sources":["../src/artifact-digest.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA0B9E"}
package/dist/certify.js CHANGED
@@ -2018,11 +2018,12 @@ function positiveInteger(value, name) {
2018
2018
 
2019
2019
  // src/artifact-digest.ts
2020
2020
  import { createHash } from "crypto";
2021
- import { readFile, readdir, stat } from "fs/promises";
2021
+ import { lstat, readFile, readdir } from "fs/promises";
2022
2022
  import path from "path";
2023
2023
  async function digestDatabricksArtifact(target) {
2024
- const targetInfo = await stat(target);
2025
- if (!targetInfo.isDirectory()) {
2024
+ const targetInfo = await lstat(target);
2025
+ rejectUnsupportedEntry(target, targetInfo);
2026
+ if (targetInfo.isFile()) {
2026
2027
  return createHash("sha256").update(await readFile(target)).digest("hex");
2027
2028
  }
2028
2029
  const hash2 = createHash("sha256");
@@ -2030,7 +2031,8 @@ async function digestDatabricksArtifact(target) {
2030
2031
  for (const name of (await readdir(directory)).sort()) {
2031
2032
  const candidate = path.join(directory, name);
2032
2033
  const relative = path.join(relativeDirectory, name).replaceAll(path.sep, "/");
2033
- const info = await stat(candidate);
2034
+ const info = await lstat(candidate);
2035
+ rejectUnsupportedEntry(relative, info);
2034
2036
  if (info.isDirectory()) {
2035
2037
  hash2.update(`directory\0${relative}\0`);
2036
2038
  await append(candidate, relative);
@@ -2044,6 +2046,14 @@ async function digestDatabricksArtifact(target) {
2044
2046
  await append(target, "");
2045
2047
  return hash2.digest("hex");
2046
2048
  }
2049
+ function rejectUnsupportedEntry(entry, info) {
2050
+ if (info.isSymbolicLink()) {
2051
+ throw new Error(`Databricks artifact digest rejects symbolic links: ${entry}`);
2052
+ }
2053
+ if (!info.isFile() && !info.isDirectory()) {
2054
+ throw new Error(`Databricks artifact digest rejects non-file entries: ${entry}`);
2055
+ }
2056
+ }
2047
2057
 
2048
2058
  // src/certification.ts
2049
2059
  import { redactText } from "@fabric-harness/sdk";
@@ -22316,7 +22326,7 @@ var PatCredentials = class {
22316
22326
 
22317
22327
  // ../../node_modules/.pnpm/@databricks+sdk-auth@0.21.0/node_modules/@databricks/sdk-auth/dist/credentials/u2m.js
22318
22328
  import { execFile } from "child_process";
22319
- import { stat as stat2 } from "fs/promises";
22329
+ import { stat } from "fs/promises";
22320
22330
  import { join, sep } from "path";
22321
22331
  import { env, platform } from "process";
22322
22332
  import { promisify } from "util";
@@ -22425,7 +22435,7 @@ async function findInPath(name) {
22425
22435
  async function validateCliPath(path3) {
22426
22436
  let info;
22427
22437
  try {
22428
- info = await stat2(path3);
22438
+ info = await stat(path3);
22429
22439
  } catch {
22430
22440
  throw new U2mCredentialsError("CLI_NOT_FOUND", "databricks CLI not found");
22431
22441
  }