socket 1.0.102 → 1.0.103

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/dist/constants.js CHANGED
@@ -140,10 +140,10 @@ const LAZY_ENV = () => {
140
140
  INLINED_SOCKET_CLI_SYNP_VERSION: envAsString("1.9.14"),
141
141
  // Comp-time inlined Socket package version.
142
142
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
143
- INLINED_SOCKET_CLI_VERSION: envAsString("1.0.102"),
143
+ INLINED_SOCKET_CLI_VERSION: envAsString("1.0.103"),
144
144
  // Comp-time inlined Socket package version hash.
145
145
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
146
- INLINED_SOCKET_CLI_VERSION_HASH: envAsString("1.0.102:831a11d:44ee3a60:pub"),
146
+ INLINED_SOCKET_CLI_VERSION_HASH: envAsString("1.0.103:1c630a5:9ce73458:pub"),
147
147
  // The absolute location of the %localappdata% folder on Windows used to store
148
148
  // user-specific, non-roaming application data, like temporary files, cached
149
149
  // data, and program settings, that are specific to the current machine and user.
@@ -520,5 +520,5 @@ const constants = createConstantsObject({
520
520
  });
521
521
 
522
522
  module.exports = constants;
523
- //# debugId=46195862-8827-42d8-8370-eb007ba7a51
523
+ //# debugId=5912d8a7-af3c-4876-bff6-a4debbcc9b8
524
524
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../src/constants.mts"],"sourcesContent":["import { realpathSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport os from 'node:os'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport registryConstants from '@socketsecurity/registry/lib/constants'\n\nimport type { Agent } from './utils/package-environment.mts'\nimport type { Remap } from '@socketsecurity/registry/lib/objects'\nimport type { SpawnOptions } from '@socketsecurity/registry/lib/spawn'\n\nconst require = createRequire(import.meta.url)\nconst __filename = fileURLToPath(import.meta.url)\n// Using `path.dirname(__filename)` to resolve `__dirname` works for both 'dist'\n// AND 'src' directories because constants.js and constants.mts respectively are\n// in the root of each.\nconst __dirname = path.dirname(__filename)\n\nconst {\n kInternalsSymbol,\n [kInternalsSymbol as unknown as 'Symbol(kInternalsSymbol)']: {\n attributes: registryConstantsAttribs,\n createConstantsObject,\n getIpc,\n },\n} = registryConstants\n\ntype RegistryEnv = typeof registryConstants.ENV\n\ntype RegistryInternals = (typeof registryConstants)['Symbol(kInternalsSymbol)']\n\ntype Sentry = any\n\ntype Internals = Remap<\n Omit<RegistryInternals, 'getIpc'> &\n Readonly<{\n getIpc: {\n (): Promise<IPC>\n <K extends keyof IPC | undefined>(\n key?: K | undefined,\n ): Promise<K extends keyof IPC ? IPC[K] : IPC>\n }\n getSentry: () => Sentry\n setSentry(Sentry: Sentry): boolean\n }>\n>\n\ntype ENV = Remap<\n RegistryEnv &\n Readonly<{\n DISABLE_GITHUB_CACHE: boolean\n GITHUB_API_URL: string\n GITHUB_BASE_REF: string\n GITHUB_REF_NAME: string\n GITHUB_REF_TYPE: string\n GITHUB_REPOSITORY: string\n GITHUB_SERVER_URL: string\n GITHUB_TOKEN: string\n INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION: string\n INLINED_SOCKET_CLI_HOMEPAGE: string\n INLINED_SOCKET_CLI_LEGACY_BUILD: string\n INLINED_SOCKET_CLI_NAME: string\n INLINED_SOCKET_CLI_PUBLISHED_BUILD: string\n INLINED_SOCKET_CLI_SENTRY_BUILD: string\n INLINED_SOCKET_CLI_VERSION: string\n INLINED_SOCKET_CLI_VERSION_HASH: string\n INLINED_SOCKET_CLI_SYNP_VERSION: string\n LOCALAPPDATA: string\n NODE_COMPILE_CACHE: string\n NODE_EXTRA_CA_CERTS: string\n PATH: string\n SOCKET_CLI_ACCEPT_RISKS: boolean\n SOCKET_CLI_API_BASE_URL: string\n SOCKET_CLI_API_PROXY: string\n SOCKET_CLI_API_TIMEOUT: number\n SOCKET_CLI_API_TOKEN: string\n SOCKET_CLI_CONFIG: string\n SOCKET_CLI_GIT_USER_EMAIL: string\n SOCKET_CLI_GIT_USER_NAME: string\n SOCKET_CLI_GITHUB_TOKEN: string\n SOCKET_CLI_NO_API_TOKEN: boolean\n SOCKET_CLI_NPM_PATH: string\n SOCKET_CLI_ORG_SLUG: string\n SOCKET_CLI_VIEW_ALL_RISKS: boolean\n TERM: string\n XDG_DATA_HOME: string\n }>\n>\n\ntype ProcessEnv = {\n [K in keyof ENV]?: string\n}\n\ntype IPC = Readonly<{\n SOCKET_CLI_FIX?: string | undefined\n SOCKET_CLI_OPTIMIZE?: boolean | undefined\n SOCKET_CLI_SAFE_BIN?: string | undefined\n SOCKET_CLI_SAFE_PROGRESS?: boolean | undefined\n}>\n\ntype Constants = Remap<\n Omit<typeof registryConstants, 'Symbol(kInternalsSymbol)' | 'ENV' | 'IPC'> & {\n readonly 'Symbol(kInternalsSymbol)': Internals\n readonly ALERT_TYPE_CRITICAL_CVE: 'criticalCVE'\n readonly ALERT_TYPE_CVE: 'cve'\n readonly ALERT_TYPE_MEDIUM_CVE: 'mediumCVE'\n readonly ALERT_TYPE_MILD_CVE: 'mildCVE'\n readonly API_V0_URL: 'https://api.socket.dev/v0/'\n readonly BINARY_LOCK_EXT: '.lockb'\n readonly BUN: 'bun'\n readonly ENV: ENV\n readonly DOT_SOCKET_DOT_FACTS_JSON: '.socket.facts.json'\n readonly DRY_RUN_LABEL: '[DryRun]'\n readonly DRY_RUN_BAILING_NOW: '[DryRun] Bailing now'\n readonly DRY_RUN_NOT_SAVING: '[DryRun] Not saving'\n readonly IPC: IPC\n readonly LOCK_EXT: '.lock'\n readonly NPM_BUGGY_OVERRIDES_PATCHED_VERSION: '11.2.0'\n readonly NPM_REGISTRY_URL: 'https://registry.npmjs.org'\n readonly PNPM: 'pnpm'\n readonly REDACTED: '<redacted>'\n readonly SOCKET_CLI_ACCEPT_RISKS: 'SOCKET_CLI_ACCEPT_RISKS'\n readonly SOCKET_CLI_BIN_NAME: 'socket'\n readonly SOCKET_CLI_CONFIG: 'SOCKET_CLI_CONFIG'\n readonly SOCKET_CLI_FIX: 'SOCKET_CLI_FIX'\n readonly SOCKET_CLI_ISSUES_URL: 'https://github.com/SocketDev/socket-cli/issues'\n readonly SOCKET_CLI_OPTIMIZE: 'SOCKET_CLI_OPTIMIZE'\n readonly SOCKET_CLI_SAFE_BIN: 'SOCKET_CLI_SAFE_BIN'\n readonly SOCKET_CLI_SAFE_PROGRESS: 'SOCKET_CLI_SAFE_PROGRESS'\n readonly SOCKET_CLI_VIEW_ALL_RISKS: 'SOCKET_CLI_VIEW_ALL_RISKS'\n readonly SOCKET_DEFAULT_BRANCH: 'socket-default-branch'\n readonly SOCKET_DEFAULT_REPOSITORY: 'socket-default-repository'\n readonly SOCKET_WEBSITE_URL: 'https://socket.dev'\n readonly VLT: 'vlt'\n readonly YARN: 'yarn'\n readonly YARN_BERRY: 'yarn/berry'\n readonly YARN_CLASSIC: 'yarn/classic'\n readonly YARN_LOCK: 'yarn.lock'\n readonly bashRcPath: string\n readonly binCliPath: string\n readonly binPath: string\n readonly blessedContribPath: string\n readonly blessedOptions: {\n smartCSR: boolean\n term: string\n useBCE: boolean\n }\n readonly blessedPath: string\n readonly coanaBinPath: string\n readonly coanaPath: string\n readonly distCliPath: string\n readonly distPath: string\n readonly externalPath: string\n readonly githubCachePath: string\n readonly homePath: string\n readonly instrumentWithSentryPath: string\n readonly minimumVersionByAgent: Map<Agent, string>\n readonly nmBinPath: string\n readonly nodeHardenFlags: string[]\n readonly nodeMemoryFlags: string[]\n readonly npmCachePath: string\n readonly npmGlobalPrefix: string\n readonly npmNmNodeGypPath: string\n readonly processEnv: ProcessEnv\n readonly rootPath: string\n readonly shadowBinPath: string\n readonly shadowNpmBinPath: string\n readonly shadowNpmInjectPath: string\n readonly socketAppDataPath: string\n readonly socketCachePath: string\n readonly socketRegistryPath: string\n readonly zshRcPath: string\n }\n>\n\nconst ALERT_TYPE_CRITICAL_CVE = 'criticalCVE'\nconst ALERT_TYPE_CVE = 'cve'\nconst ALERT_TYPE_MEDIUM_CVE = 'mediumCVE'\nconst ALERT_TYPE_MILD_CVE = 'mildCVE'\nconst API_V0_URL = 'https://api.socket.dev/v0/'\nconst BINARY_LOCK_EXT = '.lockb'\nconst BUN = 'bun'\nconst DOT_SOCKET_DOT_FACTS_JSON = '.socket.facts.json'\nconst DRY_RUN_LABEL = '[DryRun]'\nconst DRY_RUN_BAILING_NOW = `${DRY_RUN_LABEL}: Bailing now`\nconst DRY_RUN_NOT_SAVING = `${DRY_RUN_LABEL}: Not saving`\nconst LOCALAPPDATA = 'LOCALAPPDATA'\nconst LOCK_EXT = '.lock'\nconst NPM_BUGGY_OVERRIDES_PATCHED_VERSION = '11.2.0'\nconst NPM_REGISTRY_URL = 'https://registry.npmjs.org'\nconst PNPM = 'pnpm'\nconst REDACTED = '<redacted>'\nconst SOCKET_CLI_ACCEPT_RISKS = 'SOCKET_CLI_ACCEPT_RISKS'\nconst SOCKET_CLI_BIN_NAME = 'socket'\nconst SOCKET_CLI_FIX = 'SOCKET_CLI_FIX'\nconst SOCKET_CLI_ISSUES_URL = 'https://github.com/SocketDev/socket-cli/issues'\nconst SOCKET_CLI_OPTIMIZE = 'SOCKET_CLI_OPTIMIZE'\nconst SOCKET_CLI_SAFE_BIN = 'SOCKET_CLI_SAFE_BIN'\nconst SOCKET_CLI_SAFE_PROGRESS = 'SOCKET_CLI_SAFE_PROGRESS'\nconst SOCKET_CLI_VIEW_ALL_RISKS = 'SOCKET_CLI_VIEW_ALL_RISKS'\nconst SOCKET_DEFAULT_BRANCH = 'socket-default-branch'\nconst SOCKET_DEFAULT_REPOSITORY = 'socket-default-repository'\nconst SOCKET_WEBSITE_URL = 'https://socket.dev'\nconst VLT = 'vlt'\nconst YARN = 'yarn'\nconst YARN_BERRY = 'yarn/berry'\nconst YARN_CLASSIC = 'yarn/classic'\nconst YARN_LOCK = 'yarn.lock'\n\nlet _Sentry: any\n\nlet _npmStdioPipeOptions: SpawnOptions | undefined\nfunction getNpmStdioPipeOptions() {\n if (_npmStdioPipeOptions === undefined) {\n _npmStdioPipeOptions = {\n cwd: process.cwd(),\n // Lazily access constants.WIN32.\n shell: constants.WIN32,\n }\n }\n return _npmStdioPipeOptions\n}\n\nconst LAZY_ENV = () => {\n const { env: processEnv } = process\n const envHelpers = /*@__PURE__*/ require('@socketsecurity/registry/lib/env')\n const utils = /*@__PURE__*/ require(\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'dist/utils.js'),\n )\n const envAsBoolean = envHelpers.envAsBoolean\n const envAsNumber = envHelpers.envAsNumber\n const envAsString = envHelpers.envAsString\n const getConfigValueOrUndef = utils.getConfigValueOrUndef\n const readOrDefaultSocketJson = utils.readOrDefaultSocketJson\n const GITHUB_TOKEN = envAsString(processEnv['GITHUB_TOKEN'])\n // We inline some environment values so that they CANNOT be influenced by user\n // provided environment variables.\n return Object.freeze({\n __proto__: null,\n // Lazily access registryConstants.ENV.\n ...registryConstants.ENV,\n // Disable using GitHub's workflow actions/cache.\n // https://github.com/actions/cache\n DISABLE_GITHUB_CACHE: envAsBoolean(processEnv['DISABLE_GITHUB_CACHE']),\n // The API URL. For example, https://api.github.com.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_API_URL:\n envAsString(processEnv['GITHUB_API_URL']) || 'https://api.github.com',\n // The name of the base ref or target branch of the pull request in a workflow\n // run. This is only set when the event that triggers a workflow run is either\n // pull_request or pull_request_target. For example, main.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_BASE_REF: envAsString(processEnv['GITHUB_BASE_REF']),\n // The short ref name of the branch or tag that triggered the GitHub workflow\n // run. This value matches the branch or tag name shown on GitHub. For example,\n // feature-branch-1. For pull requests, the format is <pr_number>/merge.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_REF_NAME: envAsString(processEnv['GITHUB_REF_NAME']),\n // The type of ref that triggered the workflow run. Valid values are branch or tag.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_REF_TYPE: envAsString(processEnv['GITHUB_REF_TYPE']),\n // The owner and repository name. For example, octocat/Hello-World.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_REPOSITORY: envAsString(processEnv['GITHUB_REPOSITORY']),\n // The URL of the GitHub server. For example, https://github.com.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_SERVER_URL:\n envAsString(processEnv['GITHUB_SERVER_URL']) || 'https://github.com',\n // The GITHUB_TOKEN secret is a GitHub App installation access token.\n // The token's permissions are limited to the repository that contains the\n // workflow.\n // https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#about-the-github_token-secret\n GITHUB_TOKEN,\n // Comp-time inlined @cyclonedx/cdxgen package version.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION']\".\n INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION: envAsString(\n process.env['INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION'],\n ),\n // Comp-time inlined Socket package homepage.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_HOMEPAGE']\".\n INLINED_SOCKET_CLI_HOMEPAGE: envAsString(\n process.env['INLINED_SOCKET_CLI_HOMEPAGE'],\n ),\n // Comp-time inlined flag to determine if this is the Legacy build.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_LEGACY_BUILD']\".\n INLINED_SOCKET_CLI_LEGACY_BUILD: envAsBoolean(\n process.env['INLINED_SOCKET_CLI_LEGACY_BUILD'],\n ),\n // Comp-time inlined Socket package name.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_NAME']\".\n INLINED_SOCKET_CLI_NAME: envAsString(\n process.env['INLINED_SOCKET_CLI_NAME'],\n ),\n // Comp-time inlined flag to determine if this is a published build.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD']\".\n INLINED_SOCKET_CLI_PUBLISHED_BUILD: envAsBoolean(\n process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD'],\n ),\n // Comp-time inlined flag to determine if this is the Sentry build.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']\".\n INLINED_SOCKET_CLI_SENTRY_BUILD: envAsBoolean(\n process.env['INLINED_SOCKET_CLI_SENTRY_BUILD'],\n ),\n // Comp-time inlined synp package version.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_SYNP_VERSION']\".\n INLINED_SOCKET_CLI_SYNP_VERSION: envAsString(\n process.env['INLINED_SOCKET_CLI_SYNP_VERSION'],\n ),\n // Comp-time inlined Socket package version.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_VERSION']\".\n INLINED_SOCKET_CLI_VERSION: envAsString(\n process.env['INLINED_SOCKET_CLI_VERSION'],\n ),\n // Comp-time inlined Socket package version hash.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_VERSION_HASH']\".\n INLINED_SOCKET_CLI_VERSION_HASH: envAsString(\n process.env['INLINED_SOCKET_CLI_VERSION_HASH'],\n ),\n // The absolute location of the %localappdata% folder on Windows used to store\n // user-specific, non-roaming application data, like temporary files, cached\n // data, and program settings, that are specific to the current machine and user.\n LOCALAPPDATA: envAsString(processEnv[LOCALAPPDATA]),\n // Enable the module compile cache for the Node.js instance.\n // https://nodejs.org/api/cli.html#node_compile_cachedir\n NODE_COMPILE_CACHE:\n // Lazily access constants.SUPPORTS_NODE_COMPILE_CACHE_ENV_VAR.\n constants.SUPPORTS_NODE_COMPILE_CACHE_ENV_VAR\n ? // Lazily access constants.socketCachePath.\n constants.socketCachePath\n : '',\n // Well known \"root\" CAs (like VeriSign) will be extended with the extra\n // certificates in file. The file should consist of one or more trusted\n // certificates in PEM format.\n // https://nodejs.org/api/cli.html#node_extra_ca_certsfile\n NODE_EXTRA_CA_CERTS:\n envAsString(processEnv['NODE_EXTRA_CA_CERTS']) ||\n // Commonly used environment variable to specify the path to a single\n // PEM-encoded certificate file.\n envAsString(processEnv['SSL_CERT_FILE']),\n // PATH is an environment variable that lists directories where executable\n // programs are located. When a command is run, the system searches these\n // directories to find the executable.\n PATH: envAsString(processEnv['PATH']),\n // Accept risks of a Socket wrapped npm/npx run.\n SOCKET_CLI_ACCEPT_RISKS: envAsBoolean(processEnv[SOCKET_CLI_ACCEPT_RISKS]),\n // Change the base URL for Socket API calls.\n // https://github.com/SocketDev/socket-cli?tab=readme-ov-file#environment-variables-for-development\n SOCKET_CLI_API_BASE_URL:\n envAsString(processEnv['SOCKET_CLI_API_BASE_URL']) ||\n // TODO: Remove legacy environment variable name.\n envAsString(processEnv['SOCKET_SECURITY_API_BASE_URL']) ||\n getConfigValueOrUndef('apiBaseUrl') ||\n 'https://api.socket.dev/v0/',\n // Set the proxy that all requests are routed through.\n // https://github.com/SocketDev/socket-cli?tab=readme-ov-file#environment-variables-for-development\n SOCKET_CLI_API_PROXY:\n envAsString(processEnv['SOCKET_CLI_API_PROXY']) ||\n // TODO: Remove legacy environment variable name.\n envAsString(processEnv['SOCKET_SECURITY_API_PROXY']) ||\n // Commonly used environment variables to specify routing requests through\n // a proxy server.\n envAsString(processEnv['HTTPS_PROXY']) ||\n envAsString(processEnv['https_proxy']) ||\n envAsString(processEnv['HTTP_PROXY']) ||\n envAsString(processEnv['http_proxy']),\n // Set the timeout in milliseconds for Socket API requests.\n // https://nodejs.org/api/http.html#httprequesturl-options-callback\n SOCKET_CLI_API_TIMEOUT: envAsNumber(processEnv['SOCKET_CLI_API_TOKEN']),\n // Set the Socket API token.\n // https://github.com/SocketDev/socket-cli?tab=readme-ov-file#environment-variables\n SOCKET_CLI_API_TOKEN:\n envAsString(processEnv['SOCKET_CLI_API_TOKEN']) ||\n // TODO: Remove legacy environment variable names.\n envAsString(processEnv['SOCKET_CLI_API_KEY']) ||\n envAsString(processEnv['SOCKET_SECURITY_API_TOKEN']) ||\n envAsString(processEnv['SOCKET_SECURITY_API_KEY']),\n // A JSON stringified Socket configuration object.\n SOCKET_CLI_CONFIG: envAsString(processEnv['SOCKET_CLI_CONFIG']),\n // The git config user.email used by Socket CLI.\n SOCKET_CLI_GIT_USER_EMAIL:\n envAsString(processEnv['SOCKET_CLI_GIT_USER_EMAIL']) ||\n 'github-actions[bot]@users.noreply.github.com',\n // The git config user.name used by Socket CLI.\n SOCKET_CLI_GIT_USER_NAME:\n envAsString(processEnv['SOCKET_CLI_GIT_USER_NAME']) ||\n envAsString(processEnv['SOCKET_CLI_GIT_USERNAME']) ||\n 'github-actions[bot]',\n // Change the base URL for GitHub REST API calls.\n // https://docs.github.com/en/rest\n SOCKET_CLI_GITHUB_API_URL:\n envAsString(processEnv['SOCKET_CLI_GITHUB_API_URL']) ||\n readOrDefaultSocketJson(process.cwd())?.defaults?.scan?.github\n ?.githubApiUrl ||\n 'https://api.github.com',\n // A classic GitHub personal access token with the \"repo\" scope or a\n // fine-grained access token with at least read/write permissions set for\n // \"Contents\" and \"Pull Request\".\n // https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens\n SOCKET_CLI_GITHUB_TOKEN:\n envAsString(processEnv['SOCKET_CLI_GITHUB_TOKEN']) ||\n // TODO: Remove undocumented legacy environment variable name.\n envAsString(processEnv['SOCKET_SECURITY_GITHUB_PAT']) ||\n GITHUB_TOKEN,\n // Make the default API token `undefined`.\n SOCKET_CLI_NO_API_TOKEN: envAsBoolean(\n processEnv['SOCKET_CLI_NO_API_TOKEN'],\n ),\n // The absolute location of the npm directory.\n SOCKET_CLI_NPM_PATH: envAsString(processEnv['SOCKET_CLI_NPM_PATH']),\n // Specify the Socket organization slug.\n SOCKET_CLI_ORG_SLUG:\n envAsString(processEnv['SOCKET_CLI_ORG_SLUG']) ||\n // Coana CLI accepts the SOCKET_ORG_SLUG environment variable.\n envAsString(processEnv['SOCKET_ORG_SLUG']),\n // View all risks of a Socket wrapped npm/npx run.\n SOCKET_CLI_VIEW_ALL_RISKS: envAsBoolean(\n processEnv[SOCKET_CLI_VIEW_ALL_RISKS],\n ),\n // Specifies the type of terminal or terminal emulator being used by the process.\n TERM: envAsString(processEnv['TERM']),\n // The location of the base directory on Linux and MacOS used to store\n // user-specific data files, defaulting to $HOME/.local/share if not set or empty.\n XDG_DATA_HOME: envAsString(processEnv['XDG_DATA_HOME']),\n })\n}\n\nconst lazyBashRcPath = () =>\n // Lazily access constants.homePath.\n path.join(constants.homePath, '.bashrc')\n\nconst lazyBinPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'bin')\n\nconst lazyBinCliPath = () =>\n // Lazily access constants.binPath.\n path.join(constants.binPath, 'cli.js')\n\nconst lazyBlessedContribPath = () =>\n // Lazily access constants.externalPath.\n path.join(constants.externalPath, 'blessed-contrib')\n\nconst lazyBlessedOptions = () =>\n Object.freeze({\n smartCSR: true,\n // Lazily access constants.WIN32.\n term: constants.WIN32 ? 'windows-ansi' : 'xterm',\n useBCE: true,\n })\n\nconst lazyBlessedPath = () =>\n // Lazily access constants.externalPath.\n path.join(constants.externalPath, 'blessed')\n\nconst lazyCoanaBinPath = () =>\n // Lazily access constants.coanaPath.\n path.join(constants.coanaPath, 'cli-wrapper.mjs')\n\nconst lazyCoanaPath = () =>\n // Lazily access constants.externalPath.\n path.join(constants.externalPath, '@coana-tech/cli')\n\nconst lazyDistCliPath = () =>\n // Lazily access constants.distPath.\n path.join(constants.distPath, 'cli.js')\n\nconst lazyDistPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'dist')\n\nconst lazyExternalPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'external')\n\nconst lazyGithubCachePath = () =>\n // Lazily access constants.socketCachePath.\n path.join(constants.socketCachePath, 'github')\n\nconst lazyHomePath = () => os.homedir()\n\nconst lazyInstrumentWithSentryPath = () =>\n // Lazily access constants.distPath.\n path.join(constants.distPath, 'instrument-with-sentry.js')\n\nconst lazyMinimumVersionByAgent = () =>\n new Map([\n // Bun >=1.1.39 supports the text-based lockfile.\n // https://bun.sh/blog/bun-lock-text-lockfile\n [BUN, '1.1.39'],\n // The npm version bundled with Node 18.\n // https://nodejs.org/en/about/previous-releases#looking-for-the-latest-release-of-a-version-branch\n ['npm', '10.8.2'],\n // 8.x is the earliest version to support Node 18.\n // https://pnpm.io/installation#compatibility\n // https://www.npmjs.com/package/pnpm?activeTab=versions\n [PNPM, '8.15.7'],\n // 4.x supports >= Node 18.12.0\n // https://github.com/yarnpkg/berry/blob/%40yarnpkg/core/4.1.0/CHANGELOG.md#400\n [YARN_BERRY, '4.0.0'],\n // Latest 1.x.\n // https://www.npmjs.com/package/yarn?activeTab=versions\n [YARN_CLASSIC, '1.22.22'],\n // vlt does not support overrides so we don't gate on it.\n [VLT, '*'],\n ])\n\nconst lazyNmBinPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'node_modules/.bin')\n\n// Redefine registryConstants.nodeHardenFlags to account for the\n// INLINED_SOCKET_CLI_SENTRY_BUILD environment variable.\nconst lazyNodeHardenFlags = () =>\n Object.freeze(\n // Lazily access constants.ENV.INLINED_SOCKET_CLI_SENTRY_BUILD.\n constants.ENV.INLINED_SOCKET_CLI_SENTRY_BUILD ||\n // Lazily access constants.WIN32.\n constants.WIN32\n ? []\n : // Harden Node security.\n // https://nodejs.org/en/learn/getting-started/security-best-practices\n [\n '--disable-proto',\n 'throw',\n // We have contributed the following patches to our dependencies to make\n // Node's --frozen-intrinsics workable.\n // √ https://github.com/SBoudrias/Inquirer.js/pull/1683\n // √ https://github.com/pnpm/components/pull/23\n '--frozen-intrinsics',\n '--no-deprecation',\n ],\n )\n\nconst lazyNodeMemoryFlags = () => {\n const flags = /*@__PURE__*/ require(\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'dist/flags.js'),\n )\n const getMaxOldSpaceSizeFlag = flags.getMaxOldSpaceSizeFlag\n const getMaxSemiSpaceSizeFlag = flags.getMaxSemiSpaceSizeFlag\n return Object.freeze([\n `--max-old-space-size=${getMaxOldSpaceSizeFlag()}`,\n `--max-semi-space-size=${getMaxSemiSpaceSizeFlag()}`,\n ])\n}\n\nconst lazyNpmCachePath = () => {\n const spawnHelpers = /*@__PURE__*/ require('@socketsecurity/registry/lib/spawn')\n const spawnSync = spawnHelpers.spawnSync\n return spawnSync(\n // Lazily access constants.npmExecPath.\n constants.npmExecPath,\n ['config', 'get', 'cache'],\n getNpmStdioPipeOptions(),\n ).stdout\n}\n\nconst lazyNpmGlobalPrefix = () => {\n const spawnHelpers = /*@__PURE__*/ require('@socketsecurity/registry/lib/spawn')\n const spawnSync = spawnHelpers.spawnSync\n return spawnSync(\n // Lazily access constants.npmExecPath.\n constants.npmExecPath,\n ['prefix', '-g'],\n getNpmStdioPipeOptions(),\n ).stdout\n}\n\nconst lazyNpmNmNodeGypPath = () =>\n path.join(\n // Lazily access constants.npmRealExecPath.\n constants.npmRealExecPath,\n '../../node_modules/node-gyp/bin/node-gyp.js',\n )\n\nconst lazyProcessEnv = () =>\n // Lazily access constants.ENV.\n Object.setPrototypeOf(\n Object.fromEntries(\n Object.entries(constants.ENV).reduce(\n (entries, entry) => {\n const { 0: key, 1: value } = entry\n if (key.startsWith('INLINED_SOCKET_CLI_')) {\n return entries\n }\n if (typeof value === 'string') {\n if (value) {\n entries.push(entry as [string, string])\n }\n } else if (typeof value === 'boolean' && value) {\n entries.push([key, '1'])\n }\n return entries\n },\n [] as Array<[string, string]>,\n ),\n ),\n null,\n )\n\nconst lazyRootPath = () => path.join(realpathSync.native(__dirname), '..')\n\nconst lazyShadowBinPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'shadow-npm-bin')\n\nconst lazyShadowNpmBinPath = () =>\n // Lazily access constants.distPath.\n path.join(constants.distPath, 'shadow-npm-bin.js')\n\nconst lazyShadowNpmInjectPath = () =>\n // Lazily access constants.distPath.\n path.join(constants.distPath, 'shadow-npm-inject.js')\n\nconst lazySocketAppDataPath = (): string | undefined => {\n // Get the OS app data directory:\n // - Win: %LOCALAPPDATA% or fail?\n // - Mac: %XDG_DATA_HOME% or fallback to \"~/Library/Application Support/\"\n // - Linux: %XDG_DATA_HOME% or fallback to \"~/.local/share/\"\n // Note: LOCALAPPDATA is typically: C:\\Users\\USERNAME\\AppData\n // Note: XDG stands for \"X Desktop Group\", nowadays \"freedesktop.org\"\n // On most systems that path is: $HOME/.local/share\n // Then append `socket/settings`, so:\n // - Win: %LOCALAPPDATA%\\socket\\settings or return undefined\n // - Mac: %XDG_DATA_HOME%/socket/settings or \"~/Library/Application Support/socket/settings\"\n // - Linux: %XDG_DATA_HOME%/socket/settings or \"~/.local/share/socket/settings\"\n\n // Lazily access constants.WIN32.\n const { WIN32 } = constants\n let dataHome: string | undefined = WIN32\n ? // Lazily access constants.ENV.LOCALAPPDATA\n constants.ENV.LOCALAPPDATA\n : // Lazily access constants.ENV.XDG_DATA_HOME\n constants.ENV.XDG_DATA_HOME\n if (!dataHome) {\n if (WIN32) {\n const logger = /*@__PURE__*/ require('@socketsecurity/registry/lib/logger')\n logger.warn(`Missing %${LOCALAPPDATA}%`)\n } else {\n dataHome = path.join(\n // Lazily access constants.homePath.\n constants.homePath,\n // Lazily access constants.DARWIN.\n constants.DARWIN ? 'Library/Application Support' : '.local/share',\n )\n }\n }\n return dataHome ? path.join(dataHome, 'socket/settings') : undefined\n}\n\nconst lazySocketCachePath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, '.cache')\n\nconst lazySocketRegistryPath = () =>\n // Lazily access constants.externalPath.\n path.join(constants.externalPath, '@socketsecurity/registry')\n\nconst lazyZshRcPath = () =>\n // Lazily access constants.homePath.\n path.join(constants.homePath, '.zshrc')\n\nconst constants: Constants = createConstantsObject(\n {\n ...registryConstantsAttribs.props,\n ALERT_TYPE_CRITICAL_CVE,\n ALERT_TYPE_CVE,\n ALERT_TYPE_MEDIUM_CVE,\n ALERT_TYPE_MILD_CVE,\n API_V0_URL,\n BINARY_LOCK_EXT,\n BUN,\n DOT_SOCKET_DOT_FACTS_JSON,\n DRY_RUN_LABEL,\n DRY_RUN_BAILING_NOW,\n DRY_RUN_NOT_SAVING,\n ENV: undefined,\n LOCK_EXT,\n NPM_BUGGY_OVERRIDES_PATCHED_VERSION,\n NPM_REGISTRY_URL,\n PNPM,\n REDACTED,\n SOCKET_CLI_ACCEPT_RISKS,\n SOCKET_CLI_BIN_NAME,\n SOCKET_CLI_FIX,\n SOCKET_CLI_ISSUES_URL,\n SOCKET_CLI_OPTIMIZE,\n SOCKET_CLI_SAFE_BIN,\n SOCKET_CLI_SAFE_PROGRESS,\n SOCKET_CLI_VIEW_ALL_RISKS,\n SOCKET_DEFAULT_BRANCH,\n SOCKET_DEFAULT_REPOSITORY,\n SOCKET_WEBSITE_URL,\n VLT,\n YARN,\n YARN_BERRY,\n YARN_CLASSIC,\n YARN_LOCK,\n bashRcPath: undefined,\n binPath: undefined,\n binCliPath: undefined,\n blessedContribPath: undefined,\n blessedOptions: undefined,\n blessedPath: undefined,\n coanaBinPath: undefined,\n coanaPath: undefined,\n distCliPath: undefined,\n distPath: undefined,\n externalPath: undefined,\n githubCachePath: undefined,\n homePath: undefined,\n instrumentWithSentryPath: undefined,\n minimumVersionByAgent: undefined,\n nmBinPath: undefined,\n nodeHardenFlags: undefined,\n nodeMemoryFlags: undefined,\n npmCachePath: undefined,\n npmGlobalPrefix: undefined,\n npmNmNodeGypPath: undefined,\n processEnv: undefined,\n rootPath: undefined,\n shadowBinPath: undefined,\n shadowNpmInjectPath: undefined,\n shadowNpmBinPath: undefined,\n socketAppDataPath: undefined,\n socketCachePath: undefined,\n socketRegistryPath: undefined,\n zshRcPath: undefined,\n },\n {\n getters: {\n ...registryConstantsAttribs.getters,\n ENV: LAZY_ENV,\n bashRcPath: lazyBashRcPath,\n binCliPath: lazyBinCliPath,\n binPath: lazyBinPath,\n blessedContribPath: lazyBlessedContribPath,\n blessedOptions: lazyBlessedOptions,\n blessedPath: lazyBlessedPath,\n coanaBinPath: lazyCoanaBinPath,\n coanaPath: lazyCoanaPath,\n distCliPath: lazyDistCliPath,\n distPath: lazyDistPath,\n externalPath: lazyExternalPath,\n githubCachePath: lazyGithubCachePath,\n homePath: lazyHomePath,\n instrumentWithSentryPath: lazyInstrumentWithSentryPath,\n minimumVersionByAgent: lazyMinimumVersionByAgent,\n nmBinPath: lazyNmBinPath,\n nodeHardenFlags: lazyNodeHardenFlags,\n nodeMemoryFlags: lazyNodeMemoryFlags,\n npmCachePath: lazyNpmCachePath,\n npmGlobalPrefix: lazyNpmGlobalPrefix,\n npmNmNodeGypPath: lazyNpmNmNodeGypPath,\n processEnv: lazyProcessEnv,\n rootPath: lazyRootPath,\n shadowBinPath: lazyShadowBinPath,\n shadowNpmBinPath: lazyShadowNpmBinPath,\n shadowNpmInjectPath: lazyShadowNpmInjectPath,\n socketAppDataPath: lazySocketAppDataPath,\n socketCachePath: lazySocketCachePath,\n socketRegistryPath: lazySocketRegistryPath,\n zshRcPath: lazyZshRcPath,\n },\n internals: {\n ...registryConstantsAttribs.internals,\n getIpc,\n getSentry() {\n return _Sentry\n },\n setSentry(Sentry: Sentry): boolean {\n if (_Sentry === undefined) {\n _Sentry = Sentry\n return true\n }\n return false\n },\n },\n },\n) as Constants\n\nexport default constants\n"],"names":["attributes","getIpc","_npmStdioPipeOptions","cwd","env","__proto__","DISABLE_GITHUB_CACHE","GITHUB_BASE_REF","GITHUB_REF_NAME","GITHUB_REF_TYPE","GITHUB_REPOSITORY","LOCALAPPDATA","constants","NODE_EXTRA_CA_CERTS","envAsString","PATH","SOCKET_CLI_ACCEPT_RISKS","SOCKET_CLI_API_BASE_URL","SOCKET_CLI_API_PROXY","SOCKET_CLI_API_TIMEOUT","SOCKET_CLI_API_TOKEN","SOCKET_CLI_CONFIG","SOCKET_CLI_GIT_USER_NAME","SOCKET_CLI_GITHUB_TOKEN","SOCKET_CLI_NO_API_TOKEN","SOCKET_CLI_NPM_PATH","SOCKET_CLI_ORG_SLUG","SOCKET_CLI_VIEW_ALL_RISKS","TERM","XDG_DATA_HOME","path","smartCSR","term","useBCE","Object","entries","WIN32","logger","ENV","bashRcPath","binPath","binCliPath","blessedContribPath","blessedOptions","blessedPath","coanaBinPath","coanaPath","distCliPath","distPath","externalPath","githubCachePath","homePath","instrumentWithSentryPath","minimumVersionByAgent","nmBinPath","nodeHardenFlags","nodeMemoryFlags","npmCachePath","npmGlobalPrefix","npmNmNodeGypPath","processEnv","rootPath","shadowBinPath","shadowNpmInjectPath","shadowNpmBinPath","socketAppDataPath","socketCachePath","socketRegistryPath","zshRcPath","getters","internals","getSentry","_Sentry"],"mappings":";;;;;;;;;;AAYA;AACA;AACA;AACA;AACA;AACA;AAEA;;AAEE;AACEA;;AAEAC;AACF;AACF;AAsJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;;AAEIC;AACEC;AACA;;;AAGJ;AACA;AACF;AAEA;;AACUC;AAAgB;AACxB;;AAEE;;AAGF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEEC;AACA;;AAEA;AACA;AACAC;AACA;AACA;;AAGA;AACA;AACA;AACA;AACAC;AACA;AACA;AACA;AACA;AACAC;AACA;AACA;AACAC;AACA;AACA;AACAC;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAEA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;AACA;AACAC;AACA;AACA;;AAEE;AACAC;AACI;;AAGN;AACA;AACA;AACA;AACAC;AAEE;AACA;AACAC;AACF;AACA;AACA;AACAC;AACA;AACAC;AACA;AACA;AACAC;AAEE;AACAH;AAGF;AACA;AACAI;AAEE;AACAJ;AACA;AACA;AACAA;AAIF;AACA;AACAK;AACA;AACA;AACAC;AAEE;;AAIF;AACAC;AACA;;AAIA;AACAC;AAIA;AACA;;AAMA;AACA;AACA;AACA;AACAC;AAEE;AACAT;AAEF;AACAU;AAGA;AACAC;AACA;AACAC;AAEE;AACAZ;AACF;AACAa;AAGA;AACAC;AACA;AACA;AACAC;AACF;AACF;AAEA;AACE;AACAC;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AAEIC;AACA;AACAC;AACAC;AACF;AAEF;AACE;AACAH;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AAEA;AACE;AACAA;AAEF;AAEI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGJ;AACE;AACAA;;AAEF;AACA;AACA;AAEI;AACAlB;AACE;AACAA;AAEE;AACA;AACA;AAGE;AACA;AACA;AACA;AACA;AAKV;;AAEI;;AAGF;AACA;AACA;AAIF;AAEA;AACE;AACA;AACA;AACE;AACAA;AAIJ;AAEA;AACE;AACA;AACA;AACE;AACAA;AAIJ;AAEA;AAEI;AACAA;AAIJ;AACE;AACAsB;;AAIgB;AAAQ;AAAS;AACzB;AACE;AACF;AACA;AACE;AACEC;AACF;;;AAGF;AACA;AACF;AAOR;AAEA;AACE;AACAL;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACQM;AAAM;;AAEV;;AAEA;;;AAGF;AACE;AACAC;AACF;;AAEI;AACAzB;AACA;AACAA;AAEJ;AACF;;AAEF;AAEA;AACE;AACAkB;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;;;;;;;;;;;;;AAcIQ;;;;;;;;;;;;;;;;;;;;;;AAsBAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACF;AAEEC;;AAEE/B;AACAC;AACAE;AACAD;AACAE;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAE;AACAD;AACAE;AACAC;AACAC;AACAC;;AAEFE;;;AAGEC;AACE;;;;AAIEC;AACA;AACF;AACA;AACF;AACF;AACF;;","debugId":"46195862-8827-42d8-8370-eb007ba7a51"}
1
+ {"version":3,"file":"constants.js","sources":["../src/constants.mts"],"sourcesContent":["import { realpathSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport os from 'node:os'\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nimport registryConstants from '@socketsecurity/registry/lib/constants'\n\nimport type { Agent } from './utils/package-environment.mts'\nimport type { Remap } from '@socketsecurity/registry/lib/objects'\nimport type { SpawnOptions } from '@socketsecurity/registry/lib/spawn'\n\nconst require = createRequire(import.meta.url)\nconst __filename = fileURLToPath(import.meta.url)\n// Using `path.dirname(__filename)` to resolve `__dirname` works for both 'dist'\n// AND 'src' directories because constants.js and constants.mts respectively are\n// in the root of each.\nconst __dirname = path.dirname(__filename)\n\nconst {\n kInternalsSymbol,\n [kInternalsSymbol as unknown as 'Symbol(kInternalsSymbol)']: {\n attributes: registryConstantsAttribs,\n createConstantsObject,\n getIpc,\n },\n} = registryConstants\n\ntype RegistryEnv = typeof registryConstants.ENV\n\ntype RegistryInternals = (typeof registryConstants)['Symbol(kInternalsSymbol)']\n\ntype Sentry = any\n\ntype Internals = Remap<\n Omit<RegistryInternals, 'getIpc'> &\n Readonly<{\n getIpc: {\n (): Promise<IPC>\n <K extends keyof IPC | undefined>(\n key?: K | undefined,\n ): Promise<K extends keyof IPC ? IPC[K] : IPC>\n }\n getSentry: () => Sentry\n setSentry(Sentry: Sentry): boolean\n }>\n>\n\ntype ENV = Remap<\n RegistryEnv &\n Readonly<{\n DISABLE_GITHUB_CACHE: boolean\n GITHUB_API_URL: string\n GITHUB_BASE_REF: string\n GITHUB_REF_NAME: string\n GITHUB_REF_TYPE: string\n GITHUB_REPOSITORY: string\n GITHUB_SERVER_URL: string\n GITHUB_TOKEN: string\n INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION: string\n INLINED_SOCKET_CLI_HOMEPAGE: string\n INLINED_SOCKET_CLI_LEGACY_BUILD: string\n INLINED_SOCKET_CLI_NAME: string\n INLINED_SOCKET_CLI_PUBLISHED_BUILD: string\n INLINED_SOCKET_CLI_SENTRY_BUILD: string\n INLINED_SOCKET_CLI_VERSION: string\n INLINED_SOCKET_CLI_VERSION_HASH: string\n INLINED_SOCKET_CLI_SYNP_VERSION: string\n LOCALAPPDATA: string\n NODE_COMPILE_CACHE: string\n NODE_EXTRA_CA_CERTS: string\n PATH: string\n SOCKET_CLI_ACCEPT_RISKS: boolean\n SOCKET_CLI_API_BASE_URL: string\n SOCKET_CLI_API_PROXY: string\n SOCKET_CLI_API_TIMEOUT: number\n SOCKET_CLI_API_TOKEN: string\n SOCKET_CLI_CONFIG: string\n SOCKET_CLI_GIT_USER_EMAIL: string\n SOCKET_CLI_GIT_USER_NAME: string\n SOCKET_CLI_GITHUB_TOKEN: string\n SOCKET_CLI_NO_API_TOKEN: boolean\n SOCKET_CLI_NPM_PATH: string\n SOCKET_CLI_ORG_SLUG: string\n SOCKET_CLI_VIEW_ALL_RISKS: boolean\n TERM: string\n XDG_DATA_HOME: string\n }>\n>\n\ntype ProcessEnv = {\n [K in keyof ENV]?: string\n}\n\ntype IPC = Readonly<{\n SOCKET_CLI_FIX?: string | undefined\n SOCKET_CLI_OPTIMIZE?: boolean | undefined\n SOCKET_CLI_SAFE_BIN?: string | undefined\n SOCKET_CLI_SAFE_PROGRESS?: boolean | undefined\n}>\n\ntype Constants = Remap<\n Omit<typeof registryConstants, 'Symbol(kInternalsSymbol)' | 'ENV' | 'IPC'> & {\n readonly 'Symbol(kInternalsSymbol)': Internals\n readonly ALERT_TYPE_CRITICAL_CVE: 'criticalCVE'\n readonly ALERT_TYPE_CVE: 'cve'\n readonly ALERT_TYPE_MEDIUM_CVE: 'mediumCVE'\n readonly ALERT_TYPE_MILD_CVE: 'mildCVE'\n readonly API_V0_URL: 'https://api.socket.dev/v0/'\n readonly BINARY_LOCK_EXT: '.lockb'\n readonly BUN: 'bun'\n readonly ENV: ENV\n readonly DOT_SOCKET_DOT_FACTS_JSON: '.socket.facts.json'\n readonly DRY_RUN_LABEL: '[DryRun]'\n readonly DRY_RUN_BAILING_NOW: '[DryRun] Bailing now'\n readonly DRY_RUN_NOT_SAVING: '[DryRun] Not saving'\n readonly IPC: IPC\n readonly LOCK_EXT: '.lock'\n readonly NPM_BUGGY_OVERRIDES_PATCHED_VERSION: '11.2.0'\n readonly NPM_REGISTRY_URL: 'https://registry.npmjs.org'\n readonly PNPM: 'pnpm'\n readonly REDACTED: '<redacted>'\n readonly SOCKET_CLI_ACCEPT_RISKS: 'SOCKET_CLI_ACCEPT_RISKS'\n readonly SOCKET_CLI_BIN_NAME: 'socket'\n readonly SOCKET_CLI_CONFIG: 'SOCKET_CLI_CONFIG'\n readonly SOCKET_CLI_FIX: 'SOCKET_CLI_FIX'\n readonly SOCKET_CLI_ISSUES_URL: 'https://github.com/SocketDev/socket-cli/issues'\n readonly SOCKET_CLI_OPTIMIZE: 'SOCKET_CLI_OPTIMIZE'\n readonly SOCKET_CLI_SAFE_BIN: 'SOCKET_CLI_SAFE_BIN'\n readonly SOCKET_CLI_SAFE_PROGRESS: 'SOCKET_CLI_SAFE_PROGRESS'\n readonly SOCKET_CLI_VIEW_ALL_RISKS: 'SOCKET_CLI_VIEW_ALL_RISKS'\n readonly SOCKET_DEFAULT_BRANCH: 'socket-default-branch'\n readonly SOCKET_DEFAULT_REPOSITORY: 'socket-default-repository'\n readonly SOCKET_WEBSITE_URL: 'https://socket.dev'\n readonly VLT: 'vlt'\n readonly YARN: 'yarn'\n readonly YARN_BERRY: 'yarn/berry'\n readonly YARN_CLASSIC: 'yarn/classic'\n readonly YARN_LOCK: 'yarn.lock'\n readonly bashRcPath: string\n readonly binCliPath: string\n readonly binPath: string\n readonly blessedContribPath: string\n readonly blessedOptions: {\n smartCSR: boolean\n term: string\n useBCE: boolean\n }\n readonly blessedPath: string\n readonly coanaBinPath: string\n readonly coanaPath: string\n readonly distCliPath: string\n readonly distPath: string\n readonly externalPath: string\n readonly githubCachePath: string\n readonly homePath: string\n readonly instrumentWithSentryPath: string\n readonly minimumVersionByAgent: Map<Agent, string>\n readonly nmBinPath: string\n readonly nodeHardenFlags: string[]\n readonly nodeMemoryFlags: string[]\n readonly npmCachePath: string\n readonly npmGlobalPrefix: string\n readonly npmNmNodeGypPath: string\n readonly processEnv: ProcessEnv\n readonly rootPath: string\n readonly shadowBinPath: string\n readonly shadowNpmBinPath: string\n readonly shadowNpmInjectPath: string\n readonly socketAppDataPath: string\n readonly socketCachePath: string\n readonly socketRegistryPath: string\n readonly zshRcPath: string\n }\n>\n\nconst ALERT_TYPE_CRITICAL_CVE = 'criticalCVE'\nconst ALERT_TYPE_CVE = 'cve'\nconst ALERT_TYPE_MEDIUM_CVE = 'mediumCVE'\nconst ALERT_TYPE_MILD_CVE = 'mildCVE'\nconst API_V0_URL = 'https://api.socket.dev/v0/'\nconst BINARY_LOCK_EXT = '.lockb'\nconst BUN = 'bun'\nconst DOT_SOCKET_DOT_FACTS_JSON = '.socket.facts.json'\nconst DRY_RUN_LABEL = '[DryRun]'\nconst DRY_RUN_BAILING_NOW = `${DRY_RUN_LABEL}: Bailing now`\nconst DRY_RUN_NOT_SAVING = `${DRY_RUN_LABEL}: Not saving`\nconst LOCALAPPDATA = 'LOCALAPPDATA'\nconst LOCK_EXT = '.lock'\nconst NPM_BUGGY_OVERRIDES_PATCHED_VERSION = '11.2.0'\nconst NPM_REGISTRY_URL = 'https://registry.npmjs.org'\nconst PNPM = 'pnpm'\nconst REDACTED = '<redacted>'\nconst SOCKET_CLI_ACCEPT_RISKS = 'SOCKET_CLI_ACCEPT_RISKS'\nconst SOCKET_CLI_BIN_NAME = 'socket'\nconst SOCKET_CLI_FIX = 'SOCKET_CLI_FIX'\nconst SOCKET_CLI_ISSUES_URL = 'https://github.com/SocketDev/socket-cli/issues'\nconst SOCKET_CLI_OPTIMIZE = 'SOCKET_CLI_OPTIMIZE'\nconst SOCKET_CLI_SAFE_BIN = 'SOCKET_CLI_SAFE_BIN'\nconst SOCKET_CLI_SAFE_PROGRESS = 'SOCKET_CLI_SAFE_PROGRESS'\nconst SOCKET_CLI_VIEW_ALL_RISKS = 'SOCKET_CLI_VIEW_ALL_RISKS'\nconst SOCKET_DEFAULT_BRANCH = 'socket-default-branch'\nconst SOCKET_DEFAULT_REPOSITORY = 'socket-default-repository'\nconst SOCKET_WEBSITE_URL = 'https://socket.dev'\nconst VLT = 'vlt'\nconst YARN = 'yarn'\nconst YARN_BERRY = 'yarn/berry'\nconst YARN_CLASSIC = 'yarn/classic'\nconst YARN_LOCK = 'yarn.lock'\n\nlet _Sentry: any\n\nlet _npmStdioPipeOptions: SpawnOptions | undefined\nfunction getNpmStdioPipeOptions() {\n if (_npmStdioPipeOptions === undefined) {\n _npmStdioPipeOptions = {\n cwd: process.cwd(),\n // Lazily access constants.WIN32.\n shell: constants.WIN32,\n }\n }\n return _npmStdioPipeOptions\n}\n\nconst LAZY_ENV = () => {\n const { env: processEnv } = process\n const envHelpers = /*@__PURE__*/ require('@socketsecurity/registry/lib/env')\n const utils = /*@__PURE__*/ require(\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'dist/utils.js'),\n )\n const envAsBoolean = envHelpers.envAsBoolean\n const envAsNumber = envHelpers.envAsNumber\n const envAsString = envHelpers.envAsString\n const getConfigValueOrUndef = utils.getConfigValueOrUndef\n const readOrDefaultSocketJson = utils.readOrDefaultSocketJson\n const GITHUB_TOKEN = envAsString(processEnv['GITHUB_TOKEN'])\n // We inline some environment values so that they CANNOT be influenced by user\n // provided environment variables.\n return Object.freeze({\n __proto__: null,\n // Lazily access registryConstants.ENV.\n ...registryConstants.ENV,\n // Disable using GitHub's workflow actions/cache.\n // https://github.com/actions/cache\n DISABLE_GITHUB_CACHE: envAsBoolean(processEnv['DISABLE_GITHUB_CACHE']),\n // The API URL. For example, https://api.github.com.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_API_URL:\n envAsString(processEnv['GITHUB_API_URL']) || 'https://api.github.com',\n // The name of the base ref or target branch of the pull request in a workflow\n // run. This is only set when the event that triggers a workflow run is either\n // pull_request or pull_request_target. For example, main.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_BASE_REF: envAsString(processEnv['GITHUB_BASE_REF']),\n // The short ref name of the branch or tag that triggered the GitHub workflow\n // run. This value matches the branch or tag name shown on GitHub. For example,\n // feature-branch-1. For pull requests, the format is <pr_number>/merge.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_REF_NAME: envAsString(processEnv['GITHUB_REF_NAME']),\n // The type of ref that triggered the workflow run. Valid values are branch or tag.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_REF_TYPE: envAsString(processEnv['GITHUB_REF_TYPE']),\n // The owner and repository name. For example, octocat/Hello-World.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_REPOSITORY: envAsString(processEnv['GITHUB_REPOSITORY']),\n // The URL of the GitHub server. For example, https://github.com.\n // https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace#list-of-default-environment-variables\n GITHUB_SERVER_URL:\n envAsString(processEnv['GITHUB_SERVER_URL']) || 'https://github.com',\n // The GITHUB_TOKEN secret is a GitHub App installation access token.\n // The token's permissions are limited to the repository that contains the\n // workflow.\n // https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#about-the-github_token-secret\n GITHUB_TOKEN,\n // Comp-time inlined @cyclonedx/cdxgen package version.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION']\".\n INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION: envAsString(\n process.env['INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION'],\n ),\n // Comp-time inlined Socket package homepage.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_HOMEPAGE']\".\n INLINED_SOCKET_CLI_HOMEPAGE: envAsString(\n process.env['INLINED_SOCKET_CLI_HOMEPAGE'],\n ),\n // Comp-time inlined flag to determine if this is the Legacy build.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_LEGACY_BUILD']\".\n INLINED_SOCKET_CLI_LEGACY_BUILD: envAsBoolean(\n process.env['INLINED_SOCKET_CLI_LEGACY_BUILD'],\n ),\n // Comp-time inlined Socket package name.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_NAME']\".\n INLINED_SOCKET_CLI_NAME: envAsString(\n process.env['INLINED_SOCKET_CLI_NAME'],\n ),\n // Comp-time inlined flag to determine if this is a published build.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD']\".\n INLINED_SOCKET_CLI_PUBLISHED_BUILD: envAsBoolean(\n process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD'],\n ),\n // Comp-time inlined flag to determine if this is the Sentry build.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']\".\n INLINED_SOCKET_CLI_SENTRY_BUILD: envAsBoolean(\n process.env['INLINED_SOCKET_CLI_SENTRY_BUILD'],\n ),\n // Comp-time inlined synp package version.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_SYNP_VERSION']\".\n INLINED_SOCKET_CLI_SYNP_VERSION: envAsString(\n process.env['INLINED_SOCKET_CLI_SYNP_VERSION'],\n ),\n // Comp-time inlined Socket package version.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_VERSION']\".\n INLINED_SOCKET_CLI_VERSION: envAsString(\n process.env['INLINED_SOCKET_CLI_VERSION'],\n ),\n // Comp-time inlined Socket package version hash.\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_VERSION_HASH']\".\n INLINED_SOCKET_CLI_VERSION_HASH: envAsString(\n process.env['INLINED_SOCKET_CLI_VERSION_HASH'],\n ),\n // The absolute location of the %localappdata% folder on Windows used to store\n // user-specific, non-roaming application data, like temporary files, cached\n // data, and program settings, that are specific to the current machine and user.\n LOCALAPPDATA: envAsString(processEnv[LOCALAPPDATA]),\n // Enable the module compile cache for the Node.js instance.\n // https://nodejs.org/api/cli.html#node_compile_cachedir\n NODE_COMPILE_CACHE:\n // Lazily access constants.SUPPORTS_NODE_COMPILE_CACHE_ENV_VAR.\n constants.SUPPORTS_NODE_COMPILE_CACHE_ENV_VAR\n ? // Lazily access constants.socketCachePath.\n constants.socketCachePath\n : '',\n // Well known \"root\" CAs (like VeriSign) will be extended with the extra\n // certificates in file. The file should consist of one or more trusted\n // certificates in PEM format.\n // https://nodejs.org/api/cli.html#node_extra_ca_certsfile\n NODE_EXTRA_CA_CERTS:\n envAsString(processEnv['NODE_EXTRA_CA_CERTS']) ||\n // Commonly used environment variable to specify the path to a single\n // PEM-encoded certificate file.\n envAsString(processEnv['SSL_CERT_FILE']),\n // PATH is an environment variable that lists directories where executable\n // programs are located. When a command is run, the system searches these\n // directories to find the executable.\n PATH: envAsString(processEnv['PATH']),\n // Accept risks of a Socket wrapped npm/npx run.\n SOCKET_CLI_ACCEPT_RISKS: envAsBoolean(processEnv[SOCKET_CLI_ACCEPT_RISKS]),\n // Change the base URL for Socket API calls.\n // https://github.com/SocketDev/socket-cli?tab=readme-ov-file#environment-variables-for-development\n SOCKET_CLI_API_BASE_URL:\n envAsString(processEnv['SOCKET_CLI_API_BASE_URL']) ||\n // TODO: Remove legacy environment variable name.\n envAsString(processEnv['SOCKET_SECURITY_API_BASE_URL']) ||\n getConfigValueOrUndef('apiBaseUrl') ||\n 'https://api.socket.dev/v0/',\n // Set the proxy that all requests are routed through.\n // https://github.com/SocketDev/socket-cli?tab=readme-ov-file#environment-variables-for-development\n SOCKET_CLI_API_PROXY:\n envAsString(processEnv['SOCKET_CLI_API_PROXY']) ||\n // TODO: Remove legacy environment variable name.\n envAsString(processEnv['SOCKET_SECURITY_API_PROXY']) ||\n // Commonly used environment variables to specify routing requests through\n // a proxy server.\n envAsString(processEnv['HTTPS_PROXY']) ||\n envAsString(processEnv['https_proxy']) ||\n envAsString(processEnv['HTTP_PROXY']) ||\n envAsString(processEnv['http_proxy']),\n // Set the timeout in milliseconds for Socket API requests.\n // https://nodejs.org/api/http.html#httprequesturl-options-callback\n SOCKET_CLI_API_TIMEOUT: envAsNumber(processEnv['SOCKET_CLI_API_TOKEN']),\n // Set the Socket API token.\n // https://github.com/SocketDev/socket-cli?tab=readme-ov-file#environment-variables\n SOCKET_CLI_API_TOKEN:\n envAsString(processEnv['SOCKET_CLI_API_TOKEN']) ||\n // TODO: Remove legacy environment variable names.\n envAsString(processEnv['SOCKET_CLI_API_KEY']) ||\n envAsString(processEnv['SOCKET_SECURITY_API_TOKEN']) ||\n envAsString(processEnv['SOCKET_SECURITY_API_KEY']),\n // A JSON stringified Socket configuration object.\n SOCKET_CLI_CONFIG: envAsString(processEnv['SOCKET_CLI_CONFIG']),\n // The git config user.email used by Socket CLI.\n SOCKET_CLI_GIT_USER_EMAIL:\n envAsString(processEnv['SOCKET_CLI_GIT_USER_EMAIL']) ||\n 'github-actions[bot]@users.noreply.github.com',\n // The git config user.name used by Socket CLI.\n SOCKET_CLI_GIT_USER_NAME:\n envAsString(processEnv['SOCKET_CLI_GIT_USER_NAME']) ||\n envAsString(processEnv['SOCKET_CLI_GIT_USERNAME']) ||\n 'github-actions[bot]',\n // Change the base URL for GitHub REST API calls.\n // https://docs.github.com/en/rest\n SOCKET_CLI_GITHUB_API_URL:\n envAsString(processEnv['SOCKET_CLI_GITHUB_API_URL']) ||\n readOrDefaultSocketJson(process.cwd())?.defaults?.scan?.github\n ?.githubApiUrl ||\n 'https://api.github.com',\n // A classic GitHub personal access token with the \"repo\" scope or a\n // fine-grained access token with at least read/write permissions set for\n // \"Contents\" and \"Pull Request\".\n // https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens\n SOCKET_CLI_GITHUB_TOKEN:\n envAsString(processEnv['SOCKET_CLI_GITHUB_TOKEN']) ||\n // TODO: Remove undocumented legacy environment variable name.\n envAsString(processEnv['SOCKET_SECURITY_GITHUB_PAT']) ||\n GITHUB_TOKEN,\n // Make the default API token `undefined`.\n SOCKET_CLI_NO_API_TOKEN: envAsBoolean(\n processEnv['SOCKET_CLI_NO_API_TOKEN'],\n ),\n // The absolute location of the npm directory.\n SOCKET_CLI_NPM_PATH: envAsString(processEnv['SOCKET_CLI_NPM_PATH']),\n // Specify the Socket organization slug.\n SOCKET_CLI_ORG_SLUG:\n envAsString(processEnv['SOCKET_CLI_ORG_SLUG']) ||\n // Coana CLI accepts the SOCKET_ORG_SLUG environment variable.\n envAsString(processEnv['SOCKET_ORG_SLUG']),\n // View all risks of a Socket wrapped npm/npx run.\n SOCKET_CLI_VIEW_ALL_RISKS: envAsBoolean(\n processEnv[SOCKET_CLI_VIEW_ALL_RISKS],\n ),\n // Specifies the type of terminal or terminal emulator being used by the process.\n TERM: envAsString(processEnv['TERM']),\n // The location of the base directory on Linux and MacOS used to store\n // user-specific data files, defaulting to $HOME/.local/share if not set or empty.\n XDG_DATA_HOME: envAsString(processEnv['XDG_DATA_HOME']),\n })\n}\n\nconst lazyBashRcPath = () =>\n // Lazily access constants.homePath.\n path.join(constants.homePath, '.bashrc')\n\nconst lazyBinPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'bin')\n\nconst lazyBinCliPath = () =>\n // Lazily access constants.binPath.\n path.join(constants.binPath, 'cli.js')\n\nconst lazyBlessedContribPath = () =>\n // Lazily access constants.externalPath.\n path.join(constants.externalPath, 'blessed-contrib')\n\nconst lazyBlessedOptions = () =>\n Object.freeze({\n smartCSR: true,\n // Lazily access constants.WIN32.\n term: constants.WIN32 ? 'windows-ansi' : 'xterm',\n useBCE: true,\n })\n\nconst lazyBlessedPath = () =>\n // Lazily access constants.externalPath.\n path.join(constants.externalPath, 'blessed')\n\nconst lazyCoanaBinPath = () =>\n // Lazily access constants.coanaPath.\n path.join(constants.coanaPath, 'cli-wrapper.mjs')\n\nconst lazyCoanaPath = () =>\n // Lazily access constants.externalPath.\n path.join(constants.externalPath, '@coana-tech/cli')\n\nconst lazyDistCliPath = () =>\n // Lazily access constants.distPath.\n path.join(constants.distPath, 'cli.js')\n\nconst lazyDistPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'dist')\n\nconst lazyExternalPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'external')\n\nconst lazyGithubCachePath = () =>\n // Lazily access constants.socketCachePath.\n path.join(constants.socketCachePath, 'github')\n\nconst lazyHomePath = () => os.homedir()\n\nconst lazyInstrumentWithSentryPath = () =>\n // Lazily access constants.distPath.\n path.join(constants.distPath, 'instrument-with-sentry.js')\n\nconst lazyMinimumVersionByAgent = () =>\n new Map([\n // Bun >=1.1.39 supports the text-based lockfile.\n // https://bun.sh/blog/bun-lock-text-lockfile\n [BUN, '1.1.39'],\n // The npm version bundled with Node 18.\n // https://nodejs.org/en/about/previous-releases#looking-for-the-latest-release-of-a-version-branch\n ['npm', '10.8.2'],\n // 8.x is the earliest version to support Node 18.\n // https://pnpm.io/installation#compatibility\n // https://www.npmjs.com/package/pnpm?activeTab=versions\n [PNPM, '8.15.7'],\n // 4.x supports >= Node 18.12.0\n // https://github.com/yarnpkg/berry/blob/%40yarnpkg/core/4.1.0/CHANGELOG.md#400\n [YARN_BERRY, '4.0.0'],\n // Latest 1.x.\n // https://www.npmjs.com/package/yarn?activeTab=versions\n [YARN_CLASSIC, '1.22.22'],\n // vlt does not support overrides so we don't gate on it.\n [VLT, '*'],\n ])\n\nconst lazyNmBinPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'node_modules/.bin')\n\n// Redefine registryConstants.nodeHardenFlags to account for the\n// INLINED_SOCKET_CLI_SENTRY_BUILD environment variable.\nconst lazyNodeHardenFlags = () =>\n Object.freeze(\n // Lazily access constants.ENV.INLINED_SOCKET_CLI_SENTRY_BUILD.\n constants.ENV.INLINED_SOCKET_CLI_SENTRY_BUILD ||\n // Lazily access constants.WIN32.\n constants.WIN32\n ? []\n : // Harden Node security.\n // https://nodejs.org/en/learn/getting-started/security-best-practices\n [\n '--disable-proto',\n 'throw',\n // We have contributed the following patches to our dependencies to make\n // Node's --frozen-intrinsics workable.\n // √ https://github.com/SBoudrias/Inquirer.js/pull/1683\n // √ https://github.com/pnpm/components/pull/23\n '--frozen-intrinsics',\n '--no-deprecation',\n ],\n )\n\nconst lazyNodeMemoryFlags = () => {\n const flags = /*@__PURE__*/ require(\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'dist/flags.js'),\n )\n const getMaxOldSpaceSizeFlag = flags.getMaxOldSpaceSizeFlag\n const getMaxSemiSpaceSizeFlag = flags.getMaxSemiSpaceSizeFlag\n return Object.freeze([\n `--max-old-space-size=${getMaxOldSpaceSizeFlag()}`,\n `--max-semi-space-size=${getMaxSemiSpaceSizeFlag()}`,\n ])\n}\n\nconst lazyNpmCachePath = () => {\n const spawnHelpers = /*@__PURE__*/ require('@socketsecurity/registry/lib/spawn')\n const spawnSync = spawnHelpers.spawnSync\n return spawnSync(\n // Lazily access constants.npmExecPath.\n constants.npmExecPath,\n ['config', 'get', 'cache'],\n getNpmStdioPipeOptions(),\n ).stdout\n}\n\nconst lazyNpmGlobalPrefix = () => {\n const spawnHelpers = /*@__PURE__*/ require('@socketsecurity/registry/lib/spawn')\n const spawnSync = spawnHelpers.spawnSync\n return spawnSync(\n // Lazily access constants.npmExecPath.\n constants.npmExecPath,\n ['prefix', '-g'],\n getNpmStdioPipeOptions(),\n ).stdout\n}\n\nconst lazyNpmNmNodeGypPath = () =>\n path.join(\n // Lazily access constants.npmRealExecPath.\n constants.npmRealExecPath,\n '../../node_modules/node-gyp/bin/node-gyp.js',\n )\n\nconst lazyProcessEnv = () =>\n // Lazily access constants.ENV.\n Object.setPrototypeOf(\n Object.fromEntries(\n Object.entries(constants.ENV).reduce(\n (entries, entry) => {\n const { 0: key, 1: value } = entry\n if (key.startsWith('INLINED_SOCKET_CLI_')) {\n return entries\n }\n if (typeof value === 'string') {\n if (value) {\n entries.push(entry as [string, string])\n }\n } else if (typeof value === 'boolean' && value) {\n entries.push([key, '1'])\n }\n return entries\n },\n [] as Array<[string, string]>,\n ),\n ),\n null,\n )\n\nconst lazyRootPath = () => path.join(realpathSync.native(__dirname), '..')\n\nconst lazyShadowBinPath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, 'shadow-npm-bin')\n\nconst lazyShadowNpmBinPath = () =>\n // Lazily access constants.distPath.\n path.join(constants.distPath, 'shadow-npm-bin.js')\n\nconst lazyShadowNpmInjectPath = () =>\n // Lazily access constants.distPath.\n path.join(constants.distPath, 'shadow-npm-inject.js')\n\nconst lazySocketAppDataPath = (): string | undefined => {\n // Get the OS app data directory:\n // - Win: %LOCALAPPDATA% or fail?\n // - Mac: %XDG_DATA_HOME% or fallback to \"~/Library/Application Support/\"\n // - Linux: %XDG_DATA_HOME% or fallback to \"~/.local/share/\"\n // Note: LOCALAPPDATA is typically: C:\\Users\\USERNAME\\AppData\n // Note: XDG stands for \"X Desktop Group\", nowadays \"freedesktop.org\"\n // On most systems that path is: $HOME/.local/share\n // Then append `socket/settings`, so:\n // - Win: %LOCALAPPDATA%\\socket\\settings or return undefined\n // - Mac: %XDG_DATA_HOME%/socket/settings or \"~/Library/Application Support/socket/settings\"\n // - Linux: %XDG_DATA_HOME%/socket/settings or \"~/.local/share/socket/settings\"\n\n // Lazily access constants.WIN32.\n const { WIN32 } = constants\n let dataHome: string | undefined = WIN32\n ? // Lazily access constants.ENV.LOCALAPPDATA\n constants.ENV.LOCALAPPDATA\n : // Lazily access constants.ENV.XDG_DATA_HOME\n constants.ENV.XDG_DATA_HOME\n if (!dataHome) {\n if (WIN32) {\n const logger = /*@__PURE__*/ require('@socketsecurity/registry/lib/logger')\n logger.warn(`Missing %${LOCALAPPDATA}%`)\n } else {\n dataHome = path.join(\n // Lazily access constants.homePath.\n constants.homePath,\n // Lazily access constants.DARWIN.\n constants.DARWIN ? 'Library/Application Support' : '.local/share',\n )\n }\n }\n return dataHome ? path.join(dataHome, 'socket/settings') : undefined\n}\n\nconst lazySocketCachePath = () =>\n // Lazily access constants.rootPath.\n path.join(constants.rootPath, '.cache')\n\nconst lazySocketRegistryPath = () =>\n // Lazily access constants.externalPath.\n path.join(constants.externalPath, '@socketsecurity/registry')\n\nconst lazyZshRcPath = () =>\n // Lazily access constants.homePath.\n path.join(constants.homePath, '.zshrc')\n\nconst constants: Constants = createConstantsObject(\n {\n ...registryConstantsAttribs.props,\n ALERT_TYPE_CRITICAL_CVE,\n ALERT_TYPE_CVE,\n ALERT_TYPE_MEDIUM_CVE,\n ALERT_TYPE_MILD_CVE,\n API_V0_URL,\n BINARY_LOCK_EXT,\n BUN,\n DOT_SOCKET_DOT_FACTS_JSON,\n DRY_RUN_LABEL,\n DRY_RUN_BAILING_NOW,\n DRY_RUN_NOT_SAVING,\n ENV: undefined,\n LOCK_EXT,\n NPM_BUGGY_OVERRIDES_PATCHED_VERSION,\n NPM_REGISTRY_URL,\n PNPM,\n REDACTED,\n SOCKET_CLI_ACCEPT_RISKS,\n SOCKET_CLI_BIN_NAME,\n SOCKET_CLI_FIX,\n SOCKET_CLI_ISSUES_URL,\n SOCKET_CLI_OPTIMIZE,\n SOCKET_CLI_SAFE_BIN,\n SOCKET_CLI_SAFE_PROGRESS,\n SOCKET_CLI_VIEW_ALL_RISKS,\n SOCKET_DEFAULT_BRANCH,\n SOCKET_DEFAULT_REPOSITORY,\n SOCKET_WEBSITE_URL,\n VLT,\n YARN,\n YARN_BERRY,\n YARN_CLASSIC,\n YARN_LOCK,\n bashRcPath: undefined,\n binPath: undefined,\n binCliPath: undefined,\n blessedContribPath: undefined,\n blessedOptions: undefined,\n blessedPath: undefined,\n coanaBinPath: undefined,\n coanaPath: undefined,\n distCliPath: undefined,\n distPath: undefined,\n externalPath: undefined,\n githubCachePath: undefined,\n homePath: undefined,\n instrumentWithSentryPath: undefined,\n minimumVersionByAgent: undefined,\n nmBinPath: undefined,\n nodeHardenFlags: undefined,\n nodeMemoryFlags: undefined,\n npmCachePath: undefined,\n npmGlobalPrefix: undefined,\n npmNmNodeGypPath: undefined,\n processEnv: undefined,\n rootPath: undefined,\n shadowBinPath: undefined,\n shadowNpmInjectPath: undefined,\n shadowNpmBinPath: undefined,\n socketAppDataPath: undefined,\n socketCachePath: undefined,\n socketRegistryPath: undefined,\n zshRcPath: undefined,\n },\n {\n getters: {\n ...registryConstantsAttribs.getters,\n ENV: LAZY_ENV,\n bashRcPath: lazyBashRcPath,\n binCliPath: lazyBinCliPath,\n binPath: lazyBinPath,\n blessedContribPath: lazyBlessedContribPath,\n blessedOptions: lazyBlessedOptions,\n blessedPath: lazyBlessedPath,\n coanaBinPath: lazyCoanaBinPath,\n coanaPath: lazyCoanaPath,\n distCliPath: lazyDistCliPath,\n distPath: lazyDistPath,\n externalPath: lazyExternalPath,\n githubCachePath: lazyGithubCachePath,\n homePath: lazyHomePath,\n instrumentWithSentryPath: lazyInstrumentWithSentryPath,\n minimumVersionByAgent: lazyMinimumVersionByAgent,\n nmBinPath: lazyNmBinPath,\n nodeHardenFlags: lazyNodeHardenFlags,\n nodeMemoryFlags: lazyNodeMemoryFlags,\n npmCachePath: lazyNpmCachePath,\n npmGlobalPrefix: lazyNpmGlobalPrefix,\n npmNmNodeGypPath: lazyNpmNmNodeGypPath,\n processEnv: lazyProcessEnv,\n rootPath: lazyRootPath,\n shadowBinPath: lazyShadowBinPath,\n shadowNpmBinPath: lazyShadowNpmBinPath,\n shadowNpmInjectPath: lazyShadowNpmInjectPath,\n socketAppDataPath: lazySocketAppDataPath,\n socketCachePath: lazySocketCachePath,\n socketRegistryPath: lazySocketRegistryPath,\n zshRcPath: lazyZshRcPath,\n },\n internals: {\n ...registryConstantsAttribs.internals,\n getIpc,\n getSentry() {\n return _Sentry\n },\n setSentry(Sentry: Sentry): boolean {\n if (_Sentry === undefined) {\n _Sentry = Sentry\n return true\n }\n return false\n },\n },\n },\n) as Constants\n\nexport default constants\n"],"names":["attributes","getIpc","_npmStdioPipeOptions","cwd","env","__proto__","DISABLE_GITHUB_CACHE","GITHUB_BASE_REF","GITHUB_REF_NAME","GITHUB_REF_TYPE","GITHUB_REPOSITORY","LOCALAPPDATA","constants","NODE_EXTRA_CA_CERTS","envAsString","PATH","SOCKET_CLI_ACCEPT_RISKS","SOCKET_CLI_API_BASE_URL","SOCKET_CLI_API_PROXY","SOCKET_CLI_API_TIMEOUT","SOCKET_CLI_API_TOKEN","SOCKET_CLI_CONFIG","SOCKET_CLI_GIT_USER_NAME","SOCKET_CLI_GITHUB_TOKEN","SOCKET_CLI_NO_API_TOKEN","SOCKET_CLI_NPM_PATH","SOCKET_CLI_ORG_SLUG","SOCKET_CLI_VIEW_ALL_RISKS","TERM","XDG_DATA_HOME","path","smartCSR","term","useBCE","Object","entries","WIN32","logger","ENV","bashRcPath","binPath","binCliPath","blessedContribPath","blessedOptions","blessedPath","coanaBinPath","coanaPath","distCliPath","distPath","externalPath","githubCachePath","homePath","instrumentWithSentryPath","minimumVersionByAgent","nmBinPath","nodeHardenFlags","nodeMemoryFlags","npmCachePath","npmGlobalPrefix","npmNmNodeGypPath","processEnv","rootPath","shadowBinPath","shadowNpmInjectPath","shadowNpmBinPath","socketAppDataPath","socketCachePath","socketRegistryPath","zshRcPath","getters","internals","getSentry","_Sentry"],"mappings":";;;;;;;;;;AAYA;AACA;AACA;AACA;AACA;AACA;AAEA;;AAEE;AACEA;;AAEAC;AACF;AACF;AAsJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;;AAEIC;AACEC;AACA;;;AAGJ;AACA;AACF;AAEA;;AACUC;AAAgB;AACxB;;AAEE;;AAGF;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEEC;AACA;;AAEA;AACA;AACAC;AACA;AACA;;AAGA;AACA;AACA;AACA;AACAC;AACA;AACA;AACA;AACA;AACAC;AACA;AACA;AACAC;AACA;AACA;AACAC;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAEA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;;AAIA;AACA;AACA;AACAC;AACA;AACA;;AAEE;AACAC;AACI;;AAGN;AACA;AACA;AACA;AACAC;AAEE;AACA;AACAC;AACF;AACA;AACA;AACAC;AACA;AACAC;AACA;AACA;AACAC;AAEE;AACAH;AAGF;AACA;AACAI;AAEE;AACAJ;AACA;AACA;AACAA;AAIF;AACA;AACAK;AACA;AACA;AACAC;AAEE;;AAIF;AACAC;AACA;;AAIA;AACAC;AAIA;AACA;;AAMA;AACA;AACA;AACA;AACAC;AAEE;AACAT;AAEF;AACAU;AAGA;AACAC;AACA;AACAC;AAEE;AACAZ;AACF;AACAa;AAGA;AACAC;AACA;AACA;AACAC;AACF;AACF;AAEA;AACE;AACAC;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AAEIC;AACA;AACAC;AACAC;AACF;AAEF;AACE;AACAH;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AAEA;AACE;AACAA;AAEF;AAEI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGJ;AACE;AACAA;;AAEF;AACA;AACA;AAEI;AACAlB;AACE;AACAA;AAEE;AACA;AACA;AAGE;AACA;AACA;AACA;AACA;AAKV;;AAEI;;AAGF;AACA;AACA;AAIF;AAEA;AACE;AACA;AACA;AACE;AACAA;AAIJ;AAEA;AACE;AACA;AACA;AACE;AACAA;AAIJ;AAEA;AAEI;AACAA;AAIJ;AACE;AACAsB;;AAIgB;AAAQ;AAAS;AACzB;AACE;AACF;AACA;AACE;AACEC;AACF;;;AAGF;AACA;AACF;AAOR;AAEA;AACE;AACAL;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACQM;AAAM;;AAEV;;AAEA;;;AAGF;AACE;AACAC;AACF;;AAEI;AACAzB;AACA;AACAA;AAEJ;AACF;;AAEF;AAEA;AACE;AACAkB;AAEF;AACE;AACAA;AAEF;AACE;AACAA;AAEF;;;;;;;;;;;;;AAcIQ;;;;;;;;;;;;;;;;;;;;;;AAsBAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACF;AAEEC;;AAEE/B;AACAC;AACAE;AACAD;AACAE;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAC;AACAE;AACAD;AACAE;AACAC;AACAC;AACAC;;AAEFE;;;AAGEC;AACE;;;;AAIEC;AACA;AACF;AACA;AACF;AACF;AACF;;","debugId":"5912d8a7-af3c-4876-bff6-a4debbcc9b8"}
@@ -190952,25 +190952,25 @@ var Spinner = class _Spinner {
190952
190952
  };
190953
190953
 
190954
190954
  // ../utils/src/command-utils.ts
190955
- async function execAndLogOnFailure(cmd, dir, options, logLevel = "info") {
190955
+ async function execAndLogOnFailure(cmd, dir, options) {
190956
190956
  const result = await execNeverFail(cmd, dir, options);
190957
- if (result.error) logCommandOutput(result, cmd, dir, logLevel);
190957
+ if (result.error) logCommandOutput(result, cmd, dir);
190958
190958
  return !result.error;
190959
190959
  }
190960
190960
  async function execPipeAndLogOnFailure(cmd, dir, options) {
190961
190961
  return execAndLogOnFailure(cmd, dir, { ...options, pipe: true });
190962
190962
  }
190963
- function logCommandOutput(cmdResult, cmd, dir, logLevel = "info") {
190963
+ function logCommandOutput(cmdResult, cmd, dir) {
190964
190964
  const { error, stdout, stderr } = cmdResult;
190965
- logger[logLevel](error ? `Error running command: ${cmd}` : `Result of running command: ${cmd}`);
190966
- logger[logLevel](`Directory: ${dir}`);
190965
+ logger.info(error ? `Error running command: ${cmd}` : `Result of running command: ${cmd}`);
190966
+ logger.info(`Directory: ${dir}`);
190967
190967
  if (error) {
190968
190968
  const em = error.message;
190969
- logger[logLevel](`Error: ${em?.endsWith?.(`
190969
+ logger.info(`Error: ${em?.endsWith?.(`
190970
190970
  ${stderr}`) ? em.slice(0, -stderr.length - 1) : em}`);
190971
190971
  }
190972
- logger[logLevel](`stdout: ${stdout}`);
190973
- logger[logLevel](`stderr: ${stderr}`);
190972
+ logger.info(`stdout: ${stdout}`);
190973
+ logger.info(`stderr: ${stderr}`);
190974
190974
  }
190975
190975
  async function execNeverFail(cmd, dir, options) {
190976
190976
  return new Promise((resolve24) => {
@@ -197761,14 +197761,6 @@ function parseSocketResponse(responseData) {
197761
197761
  throw new Error(`Unexpected response type from Socket API: ${typeof responseData}`);
197762
197762
  }
197763
197763
  }
197764
- function parseComputeArtifactsResponse(responseData) {
197765
- const response = parseSocketResponse(responseData);
197766
- return {
197767
- artifacts: response.filter((r2) => r2.type === "artifact").map((r2) => r2.value),
197768
- metadata: response.filter((r2) => r2.type === "metadata").flatMap((r2) => r2.value)
197769
- // There should always only be one metadata object
197770
- };
197771
- }
197772
197764
  async function createSocketTier1Scan(cliOptions, coanaCliVersion) {
197773
197765
  try {
197774
197766
  const url2 = getSocketApiUrl("tier1-reachability-scan");
@@ -197956,7 +197948,7 @@ async function fetchArtifactsFromManifestsTarHash(manifestsTarHash) {
197956
197948
  try {
197957
197949
  const url2 = getSocketApiUrl(`orgs/${process.env.SOCKET_ORG_SLUG}/compute-artifacts?tarHash=${manifestsTarHash}`);
197958
197950
  const responseData = (await axios2.post(url2, {}, { headers: getAuthHeaders() })).data;
197959
- return parseComputeArtifactsResponse(responseData);
197951
+ return parseSocketResponse(responseData);
197960
197952
  } catch (e) {
197961
197953
  if (e instanceof AxiosError2) {
197962
197954
  prettyPrintAxiosError(e);
@@ -197983,7 +197975,12 @@ async function computeSocketFactArtifacts(rootDir, relativeManifestFilePaths) {
197983
197975
  if (!uploadData.tarHash) {
197984
197976
  throw new Error("No tarHash received from upload-manifest-files response");
197985
197977
  }
197986
- return (await fetchArtifactsFromManifestsTarHash(uploadData.tarHash)).artifacts;
197978
+ const computeUrl = getSocketApiUrl(
197979
+ `orgs/${process.env.SOCKET_ORG_SLUG}/compute-artifacts?tarHash=${uploadData.tarHash}`
197980
+ );
197981
+ const computeResponse = await axios2.post(computeUrl, {}, { headers: getAuthHeaders() });
197982
+ const responseData = computeResponse.data;
197983
+ return parseSocketResponse(responseData);
197987
197984
  } catch (error) {
197988
197985
  logger.warn("Failed to compute socket fact artifacts", error);
197989
197986
  return void 0;
@@ -205299,23 +205296,23 @@ var Spinner2 = class _Spinner {
205299
205296
  };
205300
205297
 
205301
205298
  // ../utils/dist/command-utils.js
205302
- async function execAndLogOnFailure2(cmd, dir, options, logLevel = "info") {
205299
+ async function execAndLogOnFailure2(cmd, dir, options) {
205303
205300
  const result = await execNeverFail2(cmd, dir, options);
205304
205301
  if (result.error)
205305
- logCommandOutput2(result, cmd, dir, logLevel);
205302
+ logCommandOutput2(result, cmd, dir);
205306
205303
  return !result.error;
205307
205304
  }
205308
- function logCommandOutput2(cmdResult, cmd, dir, logLevel = "info") {
205305
+ function logCommandOutput2(cmdResult, cmd, dir) {
205309
205306
  const { error, stdout, stderr } = cmdResult;
205310
- logger[logLevel](error ? `Error running command: ${cmd}` : `Result of running command: ${cmd}`);
205311
- logger[logLevel](`Directory: ${dir}`);
205307
+ logger.info(error ? `Error running command: ${cmd}` : `Result of running command: ${cmd}`);
205308
+ logger.info(`Directory: ${dir}`);
205312
205309
  if (error) {
205313
205310
  const em = error.message;
205314
- logger[logLevel](`Error: ${em?.endsWith?.(`
205311
+ logger.info(`Error: ${em?.endsWith?.(`
205315
205312
  ${stderr}`) ? em.slice(0, -stderr.length - 1) : em}`);
205316
205313
  }
205317
- logger[logLevel](`stdout: ${stdout}`);
205318
- logger[logLevel](`stderr: ${stderr}`);
205314
+ logger.info(`stdout: ${stdout}`);
205315
+ logger.info(`stderr: ${stderr}`);
205319
205316
  }
205320
205317
  async function execNeverFail2(cmd, dir, options) {
205321
205318
  return new Promise((resolve24) => {
@@ -206486,19 +206483,18 @@ import { access as access2, cp, readdir as readdir3, stat as stat2 } from "fs/pr
206486
206483
  import { basename as basename4, join as join11, relative as relative6, resolve as resolve13 } from "path";
206487
206484
  var { uniq } = import_lodash5.default;
206488
206485
  var { isMatch } = import_micromatch.default;
206489
- function* parents(dir) {
206490
- let [curr, last2] = [dir, dir];
206486
+ function findParent(dir, predicate, wholePath) {
206487
+ let curr = dir;
206488
+ let last2 = dir;
206491
206489
  do {
206492
- yield curr;
206493
- [last2, curr] = [curr, resolve13(curr, "..")];
206490
+ const name = wholePath ? curr : basename4(curr);
206491
+ if (predicate(name))
206492
+ return curr;
206493
+ last2 = curr;
206494
+ curr = resolve13(curr, "..");
206494
206495
  } while (curr !== last2);
206495
206496
  return void 0;
206496
206497
  }
206497
- function findParent(dir, predicate, wholePath) {
206498
- for (const parent2 of parents(dir))
206499
- if (predicate(wholePath ? parent2 : basename4(parent2)))
206500
- return parent2;
206501
- }
206502
206498
 
206503
206499
  // ../utils/dist/constants.js
206504
206500
  var { once: once2 } = import_lodash6.default;
@@ -207382,18 +207378,17 @@ import { access as access3, cp as cp2, readdir as readdir4, stat as stat3 } from
207382
207378
  import { basename as basename5, join as join16, relative as relative7, resolve as resolve15 } from "path";
207383
207379
  var { uniq: uniq2 } = import_lodash8.default;
207384
207380
  var { isMatch: isMatch2 } = import_micromatch2.default;
207385
- function* parents2(dir) {
207386
- let [curr, last2] = [dir, dir];
207381
+ function findParent2(dir, predicate, wholePath) {
207382
+ let curr = dir;
207383
+ let last2 = dir;
207387
207384
  do {
207388
- yield curr;
207389
- [last2, curr] = [curr, resolve15(curr, "..")];
207385
+ const name = wholePath ? curr : basename5(curr);
207386
+ if (predicate(name)) return curr;
207387
+ last2 = curr;
207388
+ curr = resolve15(curr, "..");
207390
207389
  } while (curr !== last2);
207391
207390
  return void 0;
207392
207391
  }
207393
- function findParent2(dir, predicate, wholePath) {
207394
- for (const parent2 of parents2(dir))
207395
- if (predicate(wholePath ? parent2 : basename5(parent2))) return parent2;
207396
- }
207397
207392
  async function getFilesRelative(dir, excludeDirs) {
207398
207393
  async function helper(subDir, arrayOfFiles) {
207399
207394
  for (const item of await readdir4(join16(dir, subDir), { withFileTypes: true })) {
@@ -209359,7 +209354,6 @@ import { join as join20, resolve as resolve18 } from "path";
209359
209354
  import util3 from "util";
209360
209355
  var { once: once7 } = import_lodash13.default;
209361
209356
  var systemPython = once7(() => execFileSync2("which", ["python"], { encoding: "utf8" }).trim());
209362
- var hasPyenv = once7(async () => !(await execNeverFail("which pyenv")).error);
209363
209357
 
209364
209358
  // ../utils/src/pip-utils.ts
209365
209359
  async function isSetupPySetuptools(file) {
@@ -210108,8 +210102,8 @@ function getVulnerabilityDependencyType(vulnChainDetails, directDependencies, af
210108
210102
  finalDepType = depType;
210109
210103
  }
210110
210104
  }
210111
- const parents4 = vcd.parentsMap.get(devIdentifier);
210112
- for (const p3 of parents4 ?? []) {
210105
+ const parents2 = vcd.parentsMap.get(devIdentifier);
210106
+ for (const p3 of parents2 ?? []) {
210113
210107
  if (p3 === ROOT_NODE_STR) continue;
210114
210108
  const parentNode = vcd.transitiveDependencies[p3];
210115
210109
  if (afd && !afd.has(parentNode)) continue;
@@ -210231,17 +210225,17 @@ function computeVulnChainDetails(dependencyTree, dependencyIdentifier, parentsMa
210231
210225
  function addNode(currentIdentifier, childIdentifier, visited) {
210232
210226
  if (visited.has(currentIdentifier))
210233
210227
  return;
210234
- const parents4 = parentsMap.get(currentIdentifier);
210228
+ const parents2 = parentsMap.get(currentIdentifier);
210235
210229
  const newCurrentNode = transformToVulnChainNode(dependencyTree.transitiveDependencies[currentIdentifier]);
210236
210230
  res.transitiveDependencies[currentIdentifier] = newCurrentNode;
210237
210231
  if (childIdentifier && !newCurrentNode.children.includes(childIdentifier))
210238
210232
  newCurrentNode.children.push(childIdentifier);
210239
210233
  if (!childIdentifier)
210240
210234
  newCurrentNode.vulnerable = true;
210241
- if (!parents4)
210235
+ if (!parents2)
210242
210236
  return res;
210243
210237
  visited.add(currentIdentifier);
210244
- for (const parent2 of parents4) {
210238
+ for (const parent2 of parents2) {
210245
210239
  if (parent2 === ROOT_IDENTIFIER)
210246
210240
  res.children.push(currentIdentifier);
210247
210241
  else
@@ -210345,7 +210339,7 @@ function getAllToplevelAncestors(artifactMap, artifactId) {
210345
210339
  async function fetchArtifactsFromSocket(rootWorkingDirectory, manifestsTarHash) {
210346
210340
  logger.info("Fetching artifacts from Socket backend using manifests tar hash", manifestsTarHash);
210347
210341
  try {
210348
- const { artifacts } = await fetchArtifactsFromManifestsTarHash(manifestsTarHash);
210342
+ const artifacts = await fetchArtifactsFromManifestsTarHash(manifestsTarHash);
210349
210343
  const properPythonProjects = [];
210350
210344
  const venvExcludes = [
210351
210345
  "venv",
@@ -210499,7 +210493,7 @@ function computeVulnChainDetails2(artifacts, vulnerableArtifactId) {
210499
210493
  const currentArtifact = artifactMap.get(currentId);
210500
210494
  if (!currentArtifact)
210501
210495
  return;
210502
- const parents4 = parentsMap.get(currentId);
210496
+ const parents2 = parentsMap.get(currentId);
210503
210497
  const newCurrentNode = {
210504
210498
  packageName: getNameFromNamespaceAndName(currentArtifact.type, currentArtifact.namespace, currentArtifact.name),
210505
210499
  version: currentArtifact.version ?? void 0,
@@ -210518,8 +210512,8 @@ function computeVulnChainDetails2(artifacts, vulnerableArtifactId) {
210518
210512
  }
210519
210513
  }
210520
210514
  visited.add(currentId);
210521
- if (parents4) {
210522
- for (const parentId of parents4) {
210515
+ if (parents2) {
210516
+ for (const parentId of parents2) {
210523
210517
  addNode(parentId, currentId, visited);
210524
210518
  }
210525
210519
  }
@@ -213028,7 +213022,7 @@ __export(traversing_exports, {
213028
213022
  nextUntil: () => nextUntil,
213029
213023
  not: () => not,
213030
213024
  parent: () => parent,
213031
- parents: () => parents3,
213025
+ parents: () => parents,
213032
213026
  parentsUntil: () => parentsUntil,
213033
213027
  prev: () => prev,
213034
213028
  prevAll: () => prevAll,
@@ -214290,7 +214284,7 @@ function _removeDuplicates(elems) {
214290
214284
  return Array.from(new Set(elems));
214291
214285
  }
214292
214286
  var parent = _singleMatcher(({ parent: parent2 }) => parent2 && !isDocument(parent2) ? parent2 : null, _removeDuplicates);
214293
- var parents3 = _matcher((elem) => {
214287
+ var parents = _matcher((elem) => {
214294
214288
  const matched = [];
214295
214289
  while (elem.parent && !isDocument(elem.parent)) {
214296
214290
  matched.push(elem.parent);
@@ -225034,10 +225028,10 @@ var FixesTask = class {
225034
225028
  return;
225035
225029
  }
225036
225030
  }
225037
- const parents4 = this.getParents(pId, vulnChainDetails);
225031
+ const parents2 = this.getParents(pId, vulnChainDetails);
225038
225032
  let allowedVersionsForCId = potentialVersionsForFix[cId] ? [...potentialVersionsForFix[cId]] : await this.getSafeVersionsOfPackage(vulnChainDetails.transitiveDependencies[cId].packageName);
225039
- if (parents4.length !== 0) {
225040
- for (const parent2 of parents4) {
225033
+ if (parents2.length !== 0) {
225034
+ for (const parent2 of parents2) {
225041
225035
  await computeFix(parent2, pId, [key, ...visited]);
225042
225036
  if (res[pId])
225043
225037
  allowedVersionsForCId = await this.filterVersionsAllowedByParent(pId, res[pId], cId, allowedVersionsForCId);
@@ -225066,11 +225060,11 @@ var FixesTask = class {
225066
225060
  const deps = vulnChainDetails.transitiveDependencies;
225067
225061
  const vulnerablePackageIdentifiers = Object.entries(deps ?? []).filter(([_identifier, node]) => node.vulnerable).map(([identifier, _node]) => identifier);
225068
225062
  for (const pId of vulnerablePackageIdentifiers) {
225069
- const parents4 = this.getParents(pId, vulnChainDetails);
225070
- if (parents4.length === 0) {
225063
+ const parents2 = this.getParents(pId, vulnChainDetails);
225064
+ if (parents2.length === 0) {
225071
225065
  pickVersionWrapper(pId, [...potentialVersionsForFix[pId]]);
225072
225066
  } else {
225073
- for (const parent2 of parents4) {
225067
+ for (const parent2 of parents2) {
225074
225068
  await computeFix(parent2, pId, []);
225075
225069
  }
225076
225070
  }
@@ -225131,9 +225125,9 @@ var FixesTask = class {
225131
225125
  safeVersionsForC
225132
225126
  );
225133
225127
  const vs = await filterVersions(pId, versionsOfPAllowingSomeSafeVersions);
225134
- const parents4 = this.getParents(pId, vuln.vulnChainDetails);
225135
- if (parents4.length !== 0) {
225136
- for (const parent2 of parents4) {
225128
+ const parents2 = this.getParents(pId, vuln.vulnChainDetails);
225129
+ if (parents2.length !== 0) {
225130
+ for (const parent2 of parents2) {
225137
225131
  await computePotentialVersionsForFixWithCache(parent2, pId, vs);
225138
225132
  }
225139
225133
  } else {
@@ -225145,17 +225139,17 @@ var FixesTask = class {
225145
225139
  const deps = vuln.vulnChainDetails?.transitiveDependencies;
225146
225140
  const vulnerablePackageIdentifiers = Object.entries(deps ?? []).filter(([_identifier, node]) => node.vulnerable).map(([identifier, _node]) => identifier);
225147
225141
  for (const pId of vulnerablePackageIdentifiers) {
225148
- const parents4 = this.getParents(pId, vuln.vulnChainDetails);
225142
+ const parents2 = this.getParents(pId, vuln.vulnChainDetails);
225149
225143
  const safeVersionsForVulnerablePackage = await safeVersions(pId);
225150
225144
  const { upgrades, downgrades } = this.groupVersionsInUpgradesAndDowngrades(
225151
225145
  assertDefined(this.packageStructure.transitiveDependencies[pId].version),
225152
225146
  safeVersionsForVulnerablePackage
225153
225147
  );
225154
- if (parents4.length === 0) {
225148
+ if (parents2.length === 0) {
225155
225149
  if (upgrades.length > 0) res[pId] = upgrades;
225156
225150
  else if (downgrades.length > 0) res[pId] = downgrades;
225157
225151
  } else {
225158
- for (const parent2 of parents4) {
225152
+ for (const parent2 of parents2) {
225159
225153
  const resClone = { ...res };
225160
225154
  const alreadyComputedCacheClone = new Map(alreadyComputedCache);
225161
225155
  try {
@@ -225589,7 +225583,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
225589
225583
  }
225590
225584
 
225591
225585
  // dist/version.js
225592
- var version2 = "14.12.5";
225586
+ var version2 = "14.12.3";
225593
225587
 
225594
225588
  // dist/cli-core.js
225595
225589
  var { mapValues, omit, partition, pick } = import_lodash15.default;
@@ -73587,22 +73587,22 @@ import { join as join3 } from "path";
73587
73587
  // ../utils/src/command-utils.ts
73588
73588
  import assert from "assert";
73589
73589
  import { execFile } from "child_process";
73590
- async function execAndLogOnFailure(cmd, dir, options, logLevel = "info") {
73590
+ async function execAndLogOnFailure(cmd, dir, options) {
73591
73591
  const result = await execNeverFail(cmd, dir, options);
73592
- if (result.error) logCommandOutput(result, cmd, dir, logLevel);
73592
+ if (result.error) logCommandOutput(result, cmd, dir);
73593
73593
  return !result.error;
73594
73594
  }
73595
- function logCommandOutput(cmdResult, cmd, dir, logLevel = "info") {
73595
+ function logCommandOutput(cmdResult, cmd, dir) {
73596
73596
  const { error, stdout, stderr } = cmdResult;
73597
- logger[logLevel](error ? `Error running command: ${cmd}` : `Result of running command: ${cmd}`);
73598
- logger[logLevel](`Directory: ${dir}`);
73597
+ logger.info(error ? `Error running command: ${cmd}` : `Result of running command: ${cmd}`);
73598
+ logger.info(`Directory: ${dir}`);
73599
73599
  if (error) {
73600
73600
  const em = error.message;
73601
- logger[logLevel](`Error: ${em?.endsWith?.(`
73601
+ logger.info(`Error: ${em?.endsWith?.(`
73602
73602
  ${stderr}`) ? em.slice(0, -stderr.length - 1) : em}`);
73603
73603
  }
73604
- logger[logLevel](`stdout: ${stdout}`);
73605
- logger[logLevel](`stderr: ${stderr}`);
73604
+ logger.info(`stdout: ${stdout}`);
73605
+ logger.info(`stderr: ${stderr}`);
73606
73606
  }
73607
73607
  async function execNeverFail(cmd, dir, options) {
73608
73608
  return new Promise((resolve16) => {
@@ -73747,18 +73747,17 @@ function excludeFiles(excludedDirsRoot, filesRoot, files, excludeDirs) {
73747
73747
  )
73748
73748
  ).map((f2) => relative(filesRoot, f2));
73749
73749
  }
73750
- function* parents(dir) {
73751
- let [curr, last2] = [dir, dir];
73750
+ function findParent(dir, predicate, wholePath) {
73751
+ let curr = dir;
73752
+ let last2 = dir;
73752
73753
  do {
73753
- yield curr;
73754
- [last2, curr] = [curr, resolve(curr, "..")];
73754
+ const name2 = wholePath ? curr : basename(curr);
73755
+ if (predicate(name2)) return curr;
73756
+ last2 = curr;
73757
+ curr = resolve(curr, "..");
73755
73758
  } while (curr !== last2);
73756
73759
  return void 0;
73757
73760
  }
73758
- function findParent(dir, predicate, wholePath) {
73759
- for (const parent2 of parents(dir))
73760
- if (predicate(wholePath ? parent2 : basename(parent2))) return parent2;
73761
- }
73762
73761
  async function getFiles(dir, excludeDirs) {
73763
73762
  async function helper(currDir, arrayOfFiles) {
73764
73763
  for (const item of await readdir(currDir, { withFileTypes: true })) {
@@ -74202,7 +74201,6 @@ import { join as join4, resolve as resolve2 } from "path";
74202
74201
  import util3 from "util";
74203
74202
  var { once } = import_lodash4.default;
74204
74203
  var systemPython = once(() => execFileSync("which", ["python"], { encoding: "utf8" }).trim());
74205
- var hasPyenv = once(async () => !(await execNeverFail("which pyenv")).error);
74206
74204
  async function getPythonVersion(executable) {
74207
74205
  return runCommandResolveStdOut([executable, "-SIc", `import sys; print(*sys.version_info[:3], sep='.')`]);
74208
74206
  }
@@ -74233,9 +74231,11 @@ var PythonVersionsManager = class _PythonVersionsManager {
74233
74231
  // Extracts the python version specifier from the workspace and returns it as an array of semver parts.
74234
74232
  async getPythonSpecifier(workspacePath, checkPyProject = true) {
74235
74233
  const absPath = resolve2(this.projectDir, workspacePath);
74236
- for (const parent2 of parents(absPath))
74234
+ const pyenvOrigin = await runCommandResolveStdOut("pyenv version-origin", absPath);
74235
+ const pyenvRoot = process.env.PYENV_ROOT ?? await runCommandResolveStdOut("pyenv root");
74236
+ if (pyenvOrigin !== join4(pyenvRoot, "version"))
74237
74237
  try {
74238
- return [(await readFile3(join4(parent2, ".python-version"), "utf-8")).split("\n")[0].trim()];
74238
+ return [(await readFile3(pyenvOrigin, "utf-8")).split("\n")[0].trim()];
74239
74239
  } catch (e) {
74240
74240
  if (e.code !== "ENOENT") logger.warn("Failed to read python version file with error", e);
74241
74241
  }
@@ -74283,12 +74283,7 @@ var PythonVersionsManager = class _PythonVersionsManager {
74283
74283
  if (semVerSpec) {
74284
74284
  const systemVer = await getPythonVersion(systemPython());
74285
74285
  if (versionMatchesSemverParts(systemVer, semVerSpec)) return systemPython();
74286
- if (!await hasPyenv())
74287
- throw Error(
74288
- `System Python (${systemVer}) does not satisfy the specifier '${semVerSpec.join(", ")}'. A matching interpreter can automatically be installed if 'pyenv' is available.`
74289
- );
74290
- } else if (!await hasPyenv() || _PythonVersionsManager.getGlobalPythonVersion() === "system")
74291
- return systemPython();
74286
+ }
74292
74287
  return resolve2(await _PythonVersionsManager.getPythonPrefixMatchingSpecifier(semVerSpec), "bin", "python");
74293
74288
  }
74294
74289
  // Throws an error if the python version is not installed.
@@ -77171,7 +77166,7 @@ __export(traversing_exports, {
77171
77166
  nextUntil: () => nextUntil,
77172
77167
  not: () => not,
77173
77168
  parent: () => parent,
77174
- parents: () => parents2,
77169
+ parents: () => parents,
77175
77170
  parentsUntil: () => parentsUntil,
77176
77171
  prev: () => prev,
77177
77172
  prevAll: () => prevAll,
@@ -78433,7 +78428,7 @@ function _removeDuplicates(elems) {
78433
78428
  return Array.from(new Set(elems));
78434
78429
  }
78435
78430
  var parent = _singleMatcher(({ parent: parent2 }) => parent2 && !isDocument(parent2) ? parent2 : null, _removeDuplicates);
78436
- var parents2 = _matcher((elem) => {
78431
+ var parents = _matcher((elem) => {
78437
78432
  const matched = [];
78438
78433
  while (elem.parent && !isDocument(elem.parent)) {
78439
78434
  matched.push(elem.parent);
@@ -96453,9 +96448,9 @@ var PythonCodeAwareVulnerabilityScanner = class {
96453
96448
  const packagesToExclude = heuristic.getPackagesToExcludeFromAnalysis?.(vulns);
96454
96449
  const packagesToInstall = uniqBy(preInstalledDepInfos.filter((n) => !packagesToExclude?.has(n.packageName)), "packageName");
96455
96450
  if (!await this.tryUsingPreinstalledVirtualEnv(packagesToInstall)) {
96456
- logger.info(`Setting up virtual environment`);
96451
+ logger.info("Setting up virtual environment");
96457
96452
  await this.prepareVirtualEnv(packagesToInstall);
96458
- logger.info("Done setting up virtual environment");
96453
+ logger.debug("Done setting up virtual environment");
96459
96454
  }
96460
96455
  }
96461
96456
  async runAnalysis(vulns, heuristic, analyzesAllVulns) {
@@ -96517,7 +96512,7 @@ runpy.run_module("mambalade", alter_sys=True)
96517
96512
  "--",
96518
96513
  ...filesToAnalyze
96519
96514
  ];
96520
- logger.debug(`Running mambalade on ${filesToAnalyze.length} files for vulnerabilities:
96515
+ logger.info(`Running mambalade on ${filesToAnalyze.length} files for vulnerabilities:
96521
96516
  ${vulnAccPaths.join("\n")}`);
96522
96517
  logger.debug(`Running python executable: ${pythonExecutable}`);
96523
96518
  logger.debug(`With args: ${mambaladeArgs.slice(1).join(" ")}`);
@@ -96526,7 +96521,7 @@ ${vulnAccPaths.join("\n")}`);
96526
96521
  logger.debug("Done running mambalade");
96527
96522
  const errors = stderr.split("\n").filter((line) => line.startsWith("ERROR:") && !/^ERROR: Excluded distribution/.test(line));
96528
96523
  if (errors.length > 0)
96529
- logger.debug(`Error messages from mambalade:
96524
+ logger.info(`Error messages from mambalade:
96530
96525
  ${errors.join("\n")}`);
96531
96526
  const result = JSON.parse(await readFile10(vulnsOutputFile, "utf-8"));
96532
96527
  logger.debug("Analysis result:", JSON.stringify(result, null, 2));
@@ -96551,8 +96546,8 @@ ${errors.join("\n")}`);
96551
96546
  packageInstallationStats: this.virtualEnvInfo.packageInstallationStats
96552
96547
  // Including stats in all analysis diagnostics since we might discard the first one that actually installs it due to analysis timeout.
96553
96548
  };
96554
- logger.debug("Analysis diagnostics:");
96555
- logger.debug(JSON.stringify(omit(diagnostics, this.numberAnalysesRun === 0 ? [] : ["packageInstallationStats"]), null, 2));
96549
+ logger.info("Analysis diagnostics:");
96550
+ logger.info(JSON.stringify(omit(diagnostics, this.numberAnalysesRun === 0 ? [] : ["packageInstallationStats"]), null, 2));
96556
96551
  return {
96557
96552
  type: "success",
96558
96553
  diagnostics,
@@ -96597,25 +96592,21 @@ ${msg}`;
96597
96592
  rootWorkingDir: projectTmpDir,
96598
96593
  reachabilityAnalysisOptions: options
96599
96594
  }, projectTmpDir);
96600
- try {
96601
- await scanner.prepareVirtualEnv([]);
96602
- const sitePackagesDir = scanner.virtualEnvInfo.virtualEnvPathToSitePackages;
96603
- for (const dep of dependencies) {
96604
- const dependencyDir = join20(sitePackagesDir, basename9(dep));
96605
- logger.info(`Copying ${dep} to ${dependencyDir}`);
96606
- await cp5(dep, dependencyDir, { recursive: true });
96607
- fileMappings.set(dependencyDir, dep);
96608
- }
96609
- const result = await scanner.runAnalysis([vuln], MambaladeHeuristics.ALL_PACKAGES, false);
96610
- if (result.type === "error")
96611
- return { error: result.message, terminatedEarly: true };
96612
- return {
96613
- detectedOccurrences: transformSourceLocations2(app, fileMappings, result.computeDetectedOccurrences({ ...vuln, url: "" })),
96614
- terminatedEarly: result.terminatedEarly
96615
- };
96616
- } finally {
96617
- await scanner.cleanup();
96618
- }
96595
+ await scanner.prepareVirtualEnv([]);
96596
+ const sitePackagesDir = scanner.virtualEnvInfo.virtualEnvPathToSitePackages;
96597
+ for (const dep of dependencies) {
96598
+ const dependencyDir = join20(sitePackagesDir, basename9(dep));
96599
+ logger.info(`Copying ${dep} to ${dependencyDir}`);
96600
+ await cp5(dep, dependencyDir, { recursive: true });
96601
+ fileMappings.set(dependencyDir, dep);
96602
+ }
96603
+ const result = await scanner.runAnalysis([vuln], MambaladeHeuristics.ALL_PACKAGES, false);
96604
+ if (result.type === "error")
96605
+ return { error: result.message, terminatedEarly: true };
96606
+ return {
96607
+ detectedOccurrences: transformSourceLocations2(app, fileMappings, result.computeDetectedOccurrences({ ...vuln, url: "" })),
96608
+ terminatedEarly: result.terminatedEarly
96609
+ };
96619
96610
  });
96620
96611
  }
96621
96612
  static async runOnDependencyChain(chain, vuln, options) {
@@ -96637,7 +96628,7 @@ ${msg}`;
96637
96628
  const candidate = findBestWheel(packageName, version3, meta);
96638
96629
  if (candidate) {
96639
96630
  const filename = candidate.url.split("/").at(-1);
96640
- if (await downloadFile(candidate.url, join20(tmpDir, filename)) && await execAndLogOnFailure(["unzip", filename], tmpDir, void 0, "debug"))
96631
+ if (await downloadFile(candidate.url, join20(tmpDir, filename)) && await execAndLogOnFailure(["unzip", filename], tmpDir))
96641
96632
  return;
96642
96633
  }
96643
96634
  await exec(cmdt`uv pip install --python-platform ${uvPythonPlatform} --target ${tmpDir} --no-deps ${packageName}==${version3}`);
@@ -96686,8 +96677,6 @@ ${msg}`;
96686
96677
  }
96687
96678
  // public for testing only
96688
96679
  async prepareVirtualEnv(packages) {
96689
- if (!await hasUv())
96690
- throw new Error("uv (https://docs.astral.sh/uv/) is missing, but is required for Python analysis");
96691
96680
  const tmpDir = await createTmpDirectory("coana-python-analysis-venv");
96692
96681
  const virtualEnvFolder = join20(tmpDir, ".venv");
96693
96682
  const pythonExecutable = await this.vm.getPythonExecutableForWorkspace(this.projectDir, false);
@@ -96720,12 +96709,12 @@ ${msg}`;
96720
96709
  return true;
96721
96710
  const filename = candidate.url.split("/").at(-1);
96722
96711
  if (await downloadFile(candidate.url, join20(tmpDir, filename)) && await execAndLogOnFailure(cmdt`${uvTool(pythonExecutable)} --from installer==0.7.0 python -m installer
96723
- --no-compile-bytecode --prefix .venv ${filename}`, tmpDir, void 0, "debug")) {
96712
+ --no-compile-bytecode --prefix .venv ${filename}`, tmpDir)) {
96724
96713
  installStats.installedUsingSpecializedInstallCommand.push(packageName);
96725
96714
  return false;
96726
96715
  }
96727
96716
  } catch (e) {
96728
- logger.debug(`Failed to construct specialized install command for ${packageName}==${version3}`, e);
96717
+ logger.info(`Failed to construct specialized install command for ${packageName}==${version3}`, e);
96729
96718
  }
96730
96719
  return true;
96731
96720
  }, 4);
@@ -96734,7 +96723,13 @@ ${msg}`;
96734
96723
  const installPipDeps = once3(async () => exec([...uvInstallBase, "pip", "wheel"]));
96735
96724
  for (const { packageName, version: version3, requirement } of failingPackages) {
96736
96725
  const requirementToInstall = requirement ?? `${packageName}==${version3}`;
96737
- let success = await execAndLogOnFailure([...uvInstallBase, "--no-deps", "--no-binary", packageName, requirementToInstall], void 0, void 0, "debug");
96726
+ let success = await execAndLogOnFailure([
96727
+ ...uvInstallBase,
96728
+ "--no-deps",
96729
+ "--no-binary",
96730
+ packageName,
96731
+ requirementToInstall
96732
+ ]);
96738
96733
  if (!success) {
96739
96734
  await installPipDeps();
96740
96735
  success = await execAndLogOnFailure(
@@ -96743,9 +96738,7 @@ ${msg}`;
96743
96738
  cmdt`.venv/bin/python -m pip
96744
96739
  --no-input --require-virtualenv --disable-pip-version-check --no-cache-dir --isolated install
96745
96740
  --no-deps --ignore-requires-python --no-compile --no-binary ${packageName} ${requirementToInstall}`,
96746
- tmpDir,
96747
- void 0,
96748
- "debug"
96741
+ tmpDir
96749
96742
  );
96750
96743
  }
96751
96744
  (success ? installStats.installedWithoutOnlyBinary : installStats.failedToInstall).push(packageName);
@@ -96836,7 +96829,7 @@ async function getPythonInterpreter() {
96836
96829
  }
96837
96830
  async function setupMambalade() {
96838
96831
  const venvDir = await createTmpDirectory("mambalade-venv");
96839
- logger.debug("Creating Mambalade virtual environment");
96832
+ logger.info("Creating Mambalade virtual environment");
96840
96833
  const pythonInterpreter = await getPythonInterpreter();
96841
96834
  await exec(cmdt`${pythonInterpreter} -SIm venv ${venvDir}`);
96842
96835
  const mambaladeWheelsPath = join20(COANA_REPOS_PATH(), "mambalade", "dist");
@@ -96844,12 +96837,11 @@ async function setupMambalade() {
96844
96837
  const mambaladeWheels = wheelFiles.filter((f2) => f2.endsWith(".whl")).map((f2) => join20(mambaladeWheelsPath, f2));
96845
96838
  if (!mambaladeWheels.length)
96846
96839
  throw new Error(`No mambalade wheel files found in ${mambaladeWheelsPath}`);
96847
- logger.debug(`Installing mambalade wheels: ${mambaladeWheels.join(", ")}`);
96840
+ logger.info(`Installing mambalade wheels: ${mambaladeWheels.join(", ")}`);
96848
96841
  await exec(cmdt`${venvDir}/bin/pip install --no-deps ${mambaladeWheels}`);
96849
- logger.debug("Mambalade virtual environment setup complete");
96842
+ logger.info("Mambalade virtual environment setup complete");
96850
96843
  return venvDir;
96851
96844
  }
96852
- var hasUv = once3(async () => !(await execNeverFail("which uv")).error);
96853
96845
 
96854
96846
  // dist/whole-program-code-aware-vulnerability-scanner/python/phantom-deps.js
96855
96847
  var { uniq: uniq8 } = import_lodash15.default;
@@ -96945,7 +96937,8 @@ var PipAnalyzer = class {
96945
96937
  this.heuristic = MambaladeHeuristics.createOnlyVulnPathPackagesHeuristic(this.preInstalledDepInfos);
96946
96938
  }
96947
96939
  prepareScanner = once4(async () => {
96948
- await this.scanner.prepareDependencies(this.preInstalledDepInfos, this.state.vulnerabilities.filter((v) => Array.isArray(v.vulnerabilityAccessPaths)), this.heuristic);
96940
+ const { vulnerabilities } = this.state;
96941
+ await this.scanner.prepareDependencies(this.preInstalledDepInfos, vulnerabilities.filter((v) => Array.isArray(v.vulnerabilityAccessPaths)), this.heuristic);
96949
96942
  return this.scanner;
96950
96943
  });
96951
96944
  async runPhantomDependencyAnalysis() {
@@ -96977,13 +96970,14 @@ function getPreInstalledDepInfos(workspaceData) {
96977
96970
  }));
96978
96971
  } else {
96979
96972
  workspaceData.type;
96980
- return workspaceData.data.artifacts.filter((a2) => {
96973
+ const artifactsWithVersion = workspaceData.data.artifacts.filter((a2) => {
96981
96974
  if (!a2.version) {
96982
96975
  logger.warn(`Artifact ${a2.name} has no version information`);
96983
96976
  return false;
96984
96977
  }
96985
96978
  return true;
96986
- }).map(({ name: name2, version: version3 }) => ({ packageName: name2, version: version3 }));
96979
+ });
96980
+ return artifactsWithVersion.map((a2) => ({ packageName: a2.name, version: a2.version }));
96987
96981
  }
96988
96982
  }
96989
96983
 
@@ -97174,7 +97168,6 @@ async function analyzeWithHeuristics(state, vulns, heuristicsInOrder, doNotRecom
97174
97168
  const enqueueWithoutSplitting = !allowSplitInBuckets && initialBucketContainingAllVulns && !state.reachabilityAnalysisOptions.timeoutInSeconds;
97175
97169
  await sendErrorAnalysisMetadata(result.message, !allowSplitInBuckets && isLastHeuristic(bucket.heuristic.name) && !enqueueWithoutSplitting, !allowSplitInBuckets);
97176
97170
  if (enqueueWithoutSplitting) {
97177
- logger.info("Analysis failed, retrying different configuration.");
97178
97171
  enqueueBucket(vulnDepIdentifiers);
97179
97172
  return;
97180
97173
  }
@@ -97184,7 +97177,6 @@ async function analyzeWithHeuristics(state, vulns, heuristicsInOrder, doNotRecom
97184
97177
  }
97185
97178
  }
97186
97179
  if (allowSplitInBuckets) {
97187
- logger.info("Analysis failed, rerunning analysis multiple times with fewer vulnerabilities per run.");
97188
97180
  const middle = Math.floor(vulnDepIdentifiers.length / 2);
97189
97181
  enqueueBucket(vulnDepIdentifiers.slice(0, middle));
97190
97182
  enqueueBucket(vulnDepIdentifiers.slice(middle));
@@ -97287,6 +97279,9 @@ function getHeuristicFromName(state, heuristicName, ecosystem) {
97287
97279
  if (ecosystem === "NPM") {
97288
97280
  return heuristics[heuristicName];
97289
97281
  } else if (ecosystem === "PIP") {
97282
+ if (state.workspaceData.type !== "coana") {
97283
+ throw new Error("MambaladeHeuristics only supports Coana data for analysis");
97284
+ }
97290
97285
  if (heuristicName in MambaladeHeuristics)
97291
97286
  return MambaladeHeuristics[heuristicName];
97292
97287
  else if (heuristicName === "ONLY_VULN_PATH_PACKAGES") {
@@ -97522,16 +97517,16 @@ function canDismissVulnerability(phantomDependencies, vulnChainDetails) {
97522
97517
  const recHelper = (nodeIdentifier, depth) => {
97523
97518
  if (depth === 0)
97524
97519
  return void 0;
97525
- const parents3 = parentsMap.get(nodeIdentifier).filter((parent2) => parent2 !== ROOT_NODE_STR);
97520
+ const parents2 = parentsMap.get(nodeIdentifier).filter((parent2) => parent2 !== ROOT_NODE_STR);
97526
97521
  const thisReachabilityPrecomp = nodeIdentifier === vulnNodeIdentifier ? "Reachable" : vulnChainDetails.transitiveDependencies[nodeIdentifier].reachabilityPrecomp;
97527
97522
  if (!thisReachabilityPrecomp)
97528
97523
  return void 0;
97529
97524
  const thisMayReachVulnerableNode = ["Reachable", "Unknown"].includes(thisReachabilityPrecomp);
97530
- if (parents3.length === 0 && thisMayReachVulnerableNode) {
97525
+ if (parents2.length === 0 && thisMayReachVulnerableNode) {
97531
97526
  canDismiss = false;
97532
97527
  }
97533
- if (parents3) {
97534
- const parentsReachabilityPrecomp = parents3.map((p) => recHelper(p, depth - 1));
97528
+ if (parents2) {
97529
+ const parentsReachabilityPrecomp = parents2.map((p) => recHelper(p, depth - 1));
97535
97530
  if (parentsReachabilityPrecomp.some((reachabilityPrecomp) => !reachabilityPrecomp) && thisMayReachVulnerableNode) {
97536
97531
  canDismiss = false;
97537
97532
  }
@@ -97560,7 +97555,6 @@ var dashboardAPI2 = new DashboardAPI(process.env.SOCKET_MODE === "true", process
97560
97555
  async function runReachabilityAnalysis(state) {
97561
97556
  const projectDir = resolve15(state.subprojectDir, state.workspacePath);
97562
97557
  const ecosystem = state.workspaceData.data.type;
97563
- logger.info(`Preparing for running reachability analysis for project at "${relative6(state.rootWorkingDir, projectDir) || "."}" (${ecosystem})`);
97564
97558
  const constructor = ecosystemAnalyzer[ecosystem];
97565
97559
  if (!constructor)
97566
97560
  throw Error(`No analyzer associated with ecosystem ${ecosystem}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socket",
3
- "version": "1.0.102",
3
+ "version": "1.0.103",
4
4
  "description": "CLI for Socket.dev",
5
5
  "homepage": "https://github.com/SocketDev/socket-cli",
6
6
  "license": "MIT",
@@ -85,7 +85,7 @@
85
85
  "@babel/preset-typescript": "7.27.1",
86
86
  "@babel/runtime": "7.28.3",
87
87
  "@biomejs/biome": "2.2.2",
88
- "@coana-tech/cli": "14.12.5",
88
+ "@coana-tech/cli": "14.12.3",
89
89
  "@cyclonedx/cdxgen": "11.6.0",
90
90
  "@dotenvx/dotenvx": "1.49.0",
91
91
  "@eslint/compat": "1.3.2",