@socketsecurity/lib 6.0.6 → 6.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -1
- package/README.md +1 -1
- package/dist/ai/agent-context.d.mts +103 -0
- package/dist/ai/agent-context.js +157 -0
- package/dist/ai/backends.d.mts +83 -0
- package/dist/ai/backends.js +173 -0
- package/dist/ai/credentials.d.mts +49 -0
- package/dist/ai/credentials.js +82 -0
- package/dist/ai/discover.d.mts +6 -2
- package/dist/ai/discover.js +4 -3
- package/dist/ai/exec.d.mts +52 -0
- package/dist/ai/exec.js +92 -0
- package/dist/ai/http.d.mts +132 -0
- package/dist/ai/http.js +130 -0
- package/dist/ai/profiles.d.mts +41 -6
- package/dist/ai/profiles.js +52 -10
- package/dist/ai/route.d.mts +69 -0
- package/dist/ai/route.js +156 -0
- package/dist/ai/spawn.d.mts +10 -2
- package/dist/ai/spawn.js +56 -31
- package/dist/ai/subagent-status.d.mts +48 -0
- package/dist/ai/subagent-status.js +57 -0
- package/dist/ai/tier.d.mts +60 -0
- package/dist/ai/tier.js +53 -0
- package/dist/ai/types.d.mts +31 -6
- package/dist/ai/worktree.d.mts +6 -6
- package/dist/ai/worktree.js +5 -1
- package/dist/ansi/strip.d.ts +1 -1
- package/dist/ansi/strip.js +0 -2
- package/dist/archives/_internal.js +7 -9
- package/dist/archives/extract.js +1 -1
- package/dist/archives/tar.js +7 -7
- package/dist/archives/zip.js +5 -7
- package/dist/argv/flag-predicates.d.ts +12 -12
- package/dist/argv/flag-predicates.js +17 -17
- package/dist/argv/flag-types.d.ts +18 -18
- package/dist/argv/flag-types.js +4 -4
- package/dist/argv/parse.d.ts +20 -3
- package/dist/argv/parse.js +1 -1
- package/dist/arrays/_internal.js +11 -12
- package/dist/arrays/chunk.js +0 -1
- package/dist/arrays/join.d.ts +37 -3
- package/dist/arrays/join.js +47 -7
- package/dist/arrays/unique.js +0 -1
- package/dist/bin/_internal.d.ts +1 -1
- package/dist/bin/_internal.js +1 -1
- package/dist/bin/exec.js +2 -3
- package/dist/bin/find.js +17 -17
- package/dist/bin/prim.cjs +36175 -35861
- package/dist/bin/resolve.js +13 -14
- package/dist/bin/which.js +8 -8
- package/dist/cache/ttl/store.js +6 -6
- package/dist/checks/primordials-defaults.d.ts +3 -3
- package/dist/checks/primordials-defaults.js +3 -3
- package/dist/checks/primordials.js +4 -3
- package/dist/{bin → cli}/check-primordials.d.ts +18 -13
- package/dist/{bin → cli}/check-primordials.js +58 -55
- package/dist/{bin → cli}/check.js +3 -3
- package/dist/{bin → cli}/socket-lib.d.ts +1 -1
- package/dist/{bin → cli}/socket-lib.js +4 -4
- package/dist/colors/socket-palette.js +7 -9
- package/dist/compression/_internal.d.ts +12 -12
- package/dist/compression/_internal.js +18 -18
- package/dist/compression/brotli.d.ts +26 -27
- package/dist/compression/brotli.js +39 -35
- package/dist/compression/gzip.d.ts +23 -23
- package/dist/compression/gzip.js +46 -42
- package/dist/constants/agents.d.ts +3 -1
- package/dist/constants/agents.js +15 -11
- package/dist/constants/licenses.js +3 -3
- package/dist/constants/node.d.ts +23 -0
- package/dist/constants/node.js +47 -15
- package/dist/constants/packages.d.ts +3 -0
- package/dist/constants/packages.js +24 -29
- package/dist/constants/platform.d.ts +30 -3
- package/dist/constants/platform.js +72 -12
- package/dist/constants/runtime.d.ts +22 -0
- package/dist/constants/runtime.js +32 -0
- package/dist/constants/socket.d.ts +2 -6
- package/dist/constants/socket.js +12 -14
- package/dist/cover/code.js +10 -10
- package/dist/cover/formatters.js +5 -5
- package/dist/crypto/hash.d.ts +30 -2
- package/dist/crypto/hash.js +47 -13
- package/dist/debug/_internal.js +4 -6
- package/dist/debug/caller-info.js +3 -4
- package/dist/debug/namespace.d.ts +7 -0
- package/dist/debug/namespace.js +21 -12
- package/dist/debug/output.js +21 -24
- package/dist/debug/types.d.ts +4 -4
- package/dist/dlx/arborist.js +18 -8
- package/dist/dlx/binary-cache.js +15 -15
- package/dist/dlx/binary-download.d.ts +1 -1
- package/dist/dlx/binary-download.js +11 -11
- package/dist/dlx/binary-resolution.js +17 -15
- package/dist/dlx/binary-types.d.ts +5 -5
- package/dist/dlx/binary.js +5 -5
- package/dist/dlx/cache.js +1 -1
- package/dist/dlx/detect.d.ts +42 -25
- package/dist/dlx/detect.js +86 -77
- package/dist/dlx/dir.js +2 -2
- package/dist/dlx/firewall.d.ts +9 -1
- package/dist/dlx/firewall.js +1 -1
- package/dist/dlx/lockfile.d.ts +19 -18
- package/dist/dlx/lockfile.js +19 -16
- package/dist/dlx/manifest.d.ts +6 -6
- package/dist/dlx/manifest.js +5 -5
- package/dist/dlx/package.d.ts +10 -10
- package/dist/dlx/package.js +20 -16
- package/dist/dlx/packages.js +4 -4
- package/dist/dlx/paths.js +7 -7
- package/dist/dlx/spec.js +1 -1
- package/dist/dlx/types.d.ts +28 -27
- package/dist/eco/cargo/parse-lockfile.d.ts +2 -3
- package/dist/eco/cargo/parse-lockfile.js +5 -5
- package/dist/eco/manifest/analyze-lockfile.js +2 -2
- package/dist/eco/manifest/detect-format.js +5 -5
- package/dist/eco/manifest/find-packages.js +2 -2
- package/dist/eco/manifest/get-package-versions.js +2 -2
- package/dist/eco/manifest/get-package.js +2 -2
- package/dist/eco/manifest/parse-lockfile.js +2 -2
- package/dist/eco/manifest/parse-manifest.js +2 -2
- package/dist/eco/manifest/parse.js +2 -2
- package/dist/eco/npm/npm/exec.js +2 -2
- package/dist/eco/npm/npm/flags.js +7 -12
- package/dist/eco/npm/npm/parse-lockfile.d.ts +17 -18
- package/dist/eco/npm/npm/parse-lockfile.js +4 -4
- package/dist/eco/npm/parse-package-json.d.ts +11 -0
- package/dist/eco/npm/parse-package-json.js +3 -3
- package/dist/eco/npm/pnpm/exec.d.ts +1 -1
- package/dist/eco/npm/pnpm/exec.js +5 -5
- package/dist/eco/npm/pnpm/flags.js +0 -3
- package/dist/eco/npm/pnpm/parse-lockfile.d.ts +6 -4
- package/dist/eco/npm/pnpm/parse-lockfile.js +7 -7
- package/dist/eco/npm/script.js +9 -6
- package/dist/eco/npm/yarnpkg/yarn/exec.js +4 -4
- package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.d.ts +3 -4
- package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.js +9 -9
- package/dist/effects/pulse-frames.d.ts +3 -1
- package/dist/effects/shimmer-keyframes.d.ts +1 -1
- package/dist/effects/shimmer-terminal.d.ts +1 -1
- package/dist/env/boolean.js +0 -1
- package/dist/env/ci.js +0 -1
- package/dist/env/debug.js +0 -1
- package/dist/env/github-status.d.ts +51 -0
- package/dist/env/github-status.js +90 -0
- package/dist/env/github.js +0 -8
- package/dist/env/home.js +0 -1
- package/dist/env/locale.js +0 -3
- package/dist/env/node-auth-token.js +0 -1
- package/dist/env/node-env.js +0 -1
- package/dist/env/node-version-managers.d.ts +53 -0
- package/dist/env/node-version-managers.js +90 -0
- package/dist/env/npm.js +0 -5
- package/dist/env/number.js +0 -1
- package/dist/env/package-manager.js +3 -6
- package/dist/env/path.js +0 -1
- package/dist/env/pre-commit.js +1 -2
- package/dist/env/proxy.js +1 -1
- package/dist/env/rewire.d.ts +8 -6
- package/dist/env/rewire.js +16 -17
- package/dist/env/shell.js +0 -1
- package/dist/env/socket-cli.js +5 -18
- package/dist/env/socket-mcp.d.ts +114 -0
- package/dist/env/socket-mcp.js +146 -0
- package/dist/env/socket.d.ts +8 -109
- package/dist/env/socket.js +22 -167
- package/dist/env/string.js +0 -1
- package/dist/env/temp-dir.js +0 -3
- package/dist/env/term.js +0 -1
- package/dist/env/test.js +3 -6
- package/dist/env/windows.js +0 -4
- package/dist/env/xdg.js +0 -3
- package/dist/errors/predicates.js +1 -1
- package/dist/events/exit/_internal.d.ts +11 -9
- package/dist/events/exit/_internal.js +31 -35
- package/dist/events/exit/handler.js +3 -4
- package/dist/events/exit/intercept.js +4 -6
- package/dist/events/exit/lifecycle.js +16 -18
- package/dist/events/exit/signals.js +1 -2
- package/dist/events/exit/types.d.ts +6 -5
- package/dist/external/@npmcli/package-json.js +2 -2
- package/dist/external/@npmcli/promise-spawn.js +3 -1
- package/dist/external/npm-pack.js +2 -2
- package/dist/external/pico-pack.js +4 -2
- package/dist/external/which.js +3 -1
- package/dist/external-tools/bazel/asset-names.d.ts +1 -1
- package/dist/external-tools/bazel/asset-names.js +5 -2
- package/dist/external-tools/bazel/from-download.d.ts +1 -1
- package/dist/external-tools/bazel/from-download.js +5 -2
- package/dist/external-tools/bazel/read-bazel-version-file.js +1 -1
- package/dist/external-tools/bazel/resolve-bazel-version.js +4 -0
- package/dist/external-tools/bazel/resolve.d.ts +3 -3
- package/dist/external-tools/bazel/resolve.js +16 -8
- package/dist/external-tools/bazel/types.d.ts +1 -1
- package/dist/external-tools/cdxgen/asset-names.d.ts +1 -1
- package/dist/external-tools/cdxgen/asset-names.js +5 -2
- package/dist/external-tools/cdxgen/from-download.d.ts +1 -1
- package/dist/external-tools/cdxgen/from-download.js +7 -4
- package/dist/external-tools/cdxgen/from-vfs.js +1 -1
- package/dist/external-tools/cdxgen/resolve.d.ts +3 -3
- package/dist/external-tools/cdxgen/resolve.js +16 -8
- package/dist/external-tools/cdxgen/types.d.ts +1 -1
- package/dist/external-tools/from-download.d.ts +3 -3
- package/dist/external-tools/from-download.js +12 -6
- package/dist/external-tools/from-pip-venv.d.ts +1 -1
- package/dist/external-tools/from-pip-venv.js +12 -5
- package/dist/external-tools/janus/asset-names.d.ts +1 -1
- package/dist/external-tools/janus/asset-names.js +5 -2
- package/dist/external-tools/janus/from-download.d.ts +1 -1
- package/dist/external-tools/janus/from-download.js +5 -2
- package/dist/external-tools/janus/from-vfs.js +1 -1
- package/dist/external-tools/janus/resolve.d.ts +3 -3
- package/dist/external-tools/janus/resolve.js +16 -8
- package/dist/external-tools/janus/types.d.ts +1 -1
- package/dist/external-tools/jre/asset-names.d.ts +1 -1
- package/dist/external-tools/jre/asset-names.js +5 -2
- package/dist/external-tools/jre/detect-platform-arch.d.ts +10 -6
- package/dist/external-tools/jre/detect-platform-arch.js +29 -14
- package/dist/external-tools/jre/from-download.d.ts +1 -1
- package/dist/external-tools/jre/from-download.js +7 -4
- package/dist/external-tools/jre/from-java-home.js +2 -2
- package/dist/external-tools/jre/from-vfs.js +3 -3
- package/dist/external-tools/jre/resolve.d.ts +3 -3
- package/dist/external-tools/jre/resolve.js +16 -8
- package/dist/external-tools/jre/types.d.ts +1 -1
- package/dist/external-tools/manifest.d.ts +25 -7
- package/dist/external-tools/manifest.js +13 -13
- package/dist/external-tools/opengrep/asset-names.d.ts +1 -1
- package/dist/external-tools/opengrep/asset-names.js +5 -2
- package/dist/external-tools/opengrep/from-download.d.ts +1 -1
- package/dist/external-tools/opengrep/from-download.js +5 -2
- package/dist/external-tools/opengrep/from-vfs.js +1 -1
- package/dist/external-tools/opengrep/resolve.d.ts +3 -3
- package/dist/external-tools/opengrep/resolve.js +16 -8
- package/dist/external-tools/opengrep/types.d.ts +1 -1
- package/dist/external-tools/python/asset-names.d.ts +76 -0
- package/dist/external-tools/python/asset-names.js +111 -0
- package/dist/external-tools/python/dlx.d.ts +80 -0
- package/dist/external-tools/python/dlx.js +98 -0
- package/dist/external-tools/python/from-download.d.ts +53 -0
- package/dist/external-tools/python/from-download.js +75 -0
- package/dist/external-tools/python/from-path.d.ts +7 -0
- package/dist/external-tools/python/from-path.js +23 -0
- package/dist/external-tools/python/pin.d.ts +121 -0
- package/dist/external-tools/python/pin.js +176 -0
- package/dist/external-tools/python/pip-install.d.ts +75 -0
- package/dist/external-tools/python/pip-install.js +142 -0
- package/dist/external-tools/python/resolve.d.ts +42 -0
- package/dist/external-tools/python/resolve.js +66 -0
- package/dist/external-tools/python/types.d.ts +49 -0
- package/dist/external-tools/sbt/asset-names.d.ts +1 -1
- package/dist/external-tools/sbt/asset-names.js +5 -2
- package/dist/external-tools/sbt/from-download.d.ts +1 -1
- package/dist/external-tools/sbt/from-download.js +5 -2
- package/dist/external-tools/sbt/from-vfs.js +1 -1
- package/dist/external-tools/sbt/resolve.d.ts +3 -3
- package/dist/external-tools/sbt/resolve.js +16 -8
- package/dist/external-tools/sbt/types.d.ts +1 -1
- package/dist/external-tools/skillspector/from-dlx.d.ts +1 -1
- package/dist/external-tools/skillspector/from-dlx.js +10 -3
- package/dist/external-tools/skillspector/from-path.js +3 -5
- package/dist/external-tools/skillspector/from-vfs.js +1 -1
- package/dist/external-tools/skillspector/resolve.d.ts +2 -2
- package/dist/external-tools/skillspector/resolve.js +14 -6
- package/dist/external-tools/synp/asset-names.d.ts +1 -1
- package/dist/external-tools/synp/asset-names.js +6 -2
- package/dist/external-tools/synp/from-download.d.ts +1 -1
- package/dist/external-tools/synp/from-download.js +7 -4
- package/dist/external-tools/synp/from-vfs.js +1 -1
- package/dist/external-tools/synp/resolve.d.ts +3 -3
- package/dist/external-tools/synp/resolve.js +16 -8
- package/dist/external-tools/trivy/asset-names.d.ts +1 -1
- package/dist/external-tools/trivy/asset-names.js +5 -2
- package/dist/external-tools/trivy/from-download.d.ts +1 -1
- package/dist/external-tools/trivy/from-download.js +7 -4
- package/dist/external-tools/trivy/from-vfs.js +1 -1
- package/dist/external-tools/trivy/resolve.d.ts +3 -3
- package/dist/external-tools/trivy/resolve.js +16 -8
- package/dist/external-tools/trivy/types.d.ts +1 -1
- package/dist/external-tools/trufflehog/asset-names.d.ts +1 -1
- package/dist/external-tools/trufflehog/asset-names.js +5 -2
- package/dist/external-tools/trufflehog/from-download.d.ts +1 -1
- package/dist/external-tools/trufflehog/from-download.js +7 -4
- package/dist/external-tools/trufflehog/from-vfs.js +1 -1
- package/dist/external-tools/trufflehog/resolve.d.ts +3 -3
- package/dist/external-tools/trufflehog/resolve.js +16 -8
- package/dist/external-tools/trufflehog/types.d.ts +1 -1
- package/dist/fs/_internal.d.ts +1 -1
- package/dist/fs/_internal.js +7 -7
- package/dist/fs/access.js +5 -9
- package/dist/fs/allowed-dirs-cache.d.ts +47 -0
- package/dist/fs/allowed-dirs-cache.js +69 -0
- package/dist/fs/encoding.js +5 -7
- package/dist/fs/{find-up.js → find.js} +12 -14
- package/dist/fs/inspect.js +7 -13
- package/dist/fs/read-dir.js +7 -10
- package/dist/fs/read-file.js +8 -14
- package/dist/fs/read-json-cache.d.ts +13 -4
- package/dist/fs/read-json-cache.js +9 -6
- package/dist/fs/read-json.js +4 -6
- package/dist/fs/resolve-module.js +7 -3
- package/dist/fs/safe.d.ts +1 -1
- package/dist/fs/safe.js +13 -14
- package/dist/fs/unique.js +4 -5
- package/dist/fs/validate.js +1 -2
- package/dist/fs/write-json.js +4 -5
- package/dist/git/_internal.js +11 -11
- package/dist/git/changed.js +4 -4
- package/dist/git/repo.js +5 -7
- package/dist/git/staged.js +12 -4
- package/dist/git/tracked.d.ts +84 -0
- package/dist/git/tracked.js +163 -0
- package/dist/git/unstaged.js +12 -4
- package/dist/github/ghsa.js +2 -2
- package/dist/github/refs-cache.d.ts +1 -1
- package/dist/github/refs-cache.js +5 -5
- package/dist/github/refs-graphql.js +4 -0
- package/dist/github/refs-rest.js +9 -5
- package/dist/github/refs.js +15 -10
- package/dist/github/{fetch.js → request.js} +13 -2
- package/dist/github/token.js +1 -1
- package/dist/github/types.d.ts +1 -1
- package/dist/globs/_internal.js +8 -10
- package/dist/globs/match.js +13 -7
- package/dist/globs/matcher.d.ts +3 -3
- package/dist/globs/matcher.js +16 -14
- package/dist/globs/stream.js +1 -2
- package/dist/globs/types.d.ts +24 -24
- package/dist/http-request/_internal.d.ts +1 -1
- package/dist/http-request/browser.js +10 -4
- package/dist/http-request/checksum-file.d.ts +55 -0
- package/dist/http-request/checksum-file.js +95 -0
- package/dist/http-request/download-types.d.ts +15 -23
- package/dist/http-request/download.js +3 -3
- package/dist/http-request/{browser-fetch.d.ts → fetch/browser.d.ts} +2 -2
- package/dist/http-request/{browser-fetch.js → fetch/browser.js} +4 -4
- package/dist/http-request/headers.js +1 -2
- package/dist/http-request/request-attempt.js +38 -34
- package/dist/http-request/request-types.d.ts +2 -2
- package/dist/http-request/request.js +1 -1
- package/dist/http-request/user-agent.js +4 -5
- package/dist/integrity.d.ts +92 -18
- package/dist/integrity.js +125 -30
- package/dist/ipc/directory.js +2 -2
- package/dist/ipc/paths.js +1 -1
- package/dist/ipc/write.js +1 -1
- package/dist/ipc-cli/get.js +12 -12
- package/dist/json/edit.js +51 -44
- package/dist/json/format.js +1 -1
- package/dist/json/parse.d.ts +1 -1
- package/dist/json/parse.js +3 -7
- package/dist/logger/_internal.d.ts +4 -4
- package/dist/logger/_internal.js +3 -3
- package/dist/logger/colors.js +4 -3
- package/dist/logger/console-methods.d.ts +132 -0
- package/dist/logger/console-methods.js +169 -0
- package/dist/logger/console.d.ts +12 -0
- package/dist/logger/console.js +42 -11
- package/dist/logger/indentation-methods.d.ts +81 -0
- package/dist/logger/indentation-methods.js +121 -0
- package/dist/logger/node.d.ts +16 -338
- package/dist/logger/node.js +75 -608
- package/dist/logger/options.d.ts +39 -0
- package/dist/logger/options.js +47 -0
- package/dist/logger/semantic-methods.d.ts +63 -0
- package/dist/logger/semantic-methods.js +108 -0
- package/dist/logger/stream-methods.d.ts +63 -0
- package/dist/logger/stream-methods.js +101 -0
- package/dist/logger/stream.d.ts +37 -0
- package/dist/logger/stream.js +42 -0
- package/dist/logger/symbols-builder.js +9 -9
- package/dist/logger/symbols.d.ts +2 -25
- package/dist/logger/symbols.js +53 -74
- package/dist/logger/types.d.ts +1 -1
- package/dist/memo/types.d.ts +6 -6
- package/dist/native-messaging/host.d.ts +20 -0
- package/dist/native-messaging/host.js +120 -0
- package/dist/native-messaging/index.d.ts +5 -0
- package/dist/native-messaging/index.js +22 -0
- package/dist/native-messaging/install.d.ts +60 -0
- package/dist/native-messaging/install.js +144 -0
- package/dist/native-messaging/rate-limit.d.ts +69 -0
- package/dist/native-messaging/rate-limit.js +119 -0
- package/dist/native-messaging/run.d.ts +10 -0
- package/dist/native-messaging/run.js +17 -0
- package/dist/node/async-hooks.js +4 -3
- package/dist/node/child-process.js +4 -3
- package/dist/node/crypto.js +4 -3
- package/dist/node/events.js +4 -3
- package/dist/node/fs-promises.js +4 -3
- package/dist/node/fs.d.ts +22 -6
- package/dist/node/fs.js +17 -3
- package/dist/node/http.js +4 -3
- package/dist/node/https.js +4 -3
- package/dist/node/module.js +10 -6
- package/dist/node/os.d.ts +10 -2
- package/dist/node/os.js +12 -4
- package/dist/node/path.d.ts +11 -2
- package/dist/node/path.js +18 -4
- package/dist/node/timers-promises.js +4 -3
- package/dist/node/url.js +4 -3
- package/dist/node/util.js +4 -3
- package/dist/objects/getters.js +6 -8
- package/dist/objects/inspect.js +1 -4
- package/dist/objects/mutate.js +4 -5
- package/dist/objects/predicates.js +1 -5
- package/dist/objects/sort.js +3 -7
- package/dist/packages/edit-class.d.ts +2 -3
- package/dist/packages/edit-class.js +53 -48
- package/dist/packages/edit.js +12 -14
- package/dist/packages/exports.js +15 -21
- package/dist/packages/fetch.d.ts +16 -0
- package/dist/packages/fetch.js +81 -0
- package/dist/packages/find.d.ts +55 -0
- package/dist/packages/find.js +65 -0
- package/dist/packages/isolation.js +14 -14
- package/dist/packages/licenses.js +18 -18
- package/dist/packages/manifest.js +16 -19
- package/dist/packages/metadata-extensions.d.ts +14 -0
- package/dist/packages/metadata-extensions.js +43 -0
- package/dist/packages/normalize.js +6 -10
- package/dist/packages/provenance.js +17 -19
- package/dist/packages/read.d.ts +29 -0
- package/dist/packages/read.js +66 -0
- package/dist/packages/specs.d.ts +48 -1
- package/dist/packages/specs.js +75 -12
- package/dist/packages/tarball.d.ts +24 -0
- package/dist/packages/tarball.js +81 -0
- package/dist/packages/types.d.ts +22 -22
- package/dist/packages/validation.js +0 -3
- package/dist/paths/_internal.d.ts +2 -1
- package/dist/paths/_internal.js +7 -19
- package/dist/paths/conversion.js +5 -9
- package/dist/paths/dirnames.d.ts +1 -0
- package/dist/paths/dirnames.js +2 -0
- package/dist/paths/filenames.d.ts +0 -1
- package/dist/paths/filenames.js +0 -2
- package/dist/paths/normalize.js +4 -5
- package/dist/paths/packages.js +4 -7
- package/dist/paths/predicates.js +9 -16
- package/dist/paths/resolve.js +17 -25
- package/dist/paths/rewire.d.ts +5 -0
- package/dist/paths/rewire.js +3 -3
- package/dist/paths/socket.d.ts +74 -111
- package/dist/paths/socket.js +106 -139
- package/dist/paths/walk.d.ts +1 -1
- package/dist/paths/walk.js +4 -4
- package/dist/perf/report.js +2 -2
- package/dist/perf/types.d.ts +1 -1
- package/dist/pkg-ext/data.js +1 -1
- package/dist/primordials/array.js +9 -9
- package/dist/primordials/date.js +2 -2
- package/dist/primordials/error.js +3 -3
- package/dist/primordials/headers.d.ts +10 -0
- package/dist/primordials/headers.js +23 -0
- package/dist/primordials/intl.d.ts +13 -0
- package/dist/primordials/intl.js +26 -0
- package/dist/primordials/math.js +33 -33
- package/dist/primordials/number.js +9 -9
- package/dist/primordials/object.js +5 -5
- package/dist/primordials/process.d.ts +88 -0
- package/dist/primordials/process.js +132 -0
- package/dist/primordials/string.d.ts +2 -2
- package/dist/primordials/string.js +6 -6
- package/dist/primordials/symbol.js +3 -3
- package/dist/primordials/uncurry.d.ts +1 -2
- package/dist/primordials/uncurry.js +9 -9
- package/dist/process/abort.js +3 -3
- package/dist/process/lock-manager.js +8 -8
- package/dist/process/spawn/_internal.js +6 -8
- package/dist/process/spawn/child.js +20 -14
- package/dist/process/spawn/errors.js +3 -5
- package/dist/process/spawn/kill-tree.d.ts +53 -0
- package/dist/process/spawn/kill-tree.js +85 -0
- package/dist/process/spawn/stdio.js +0 -1
- package/dist/process/spawn/types.d.ts +5 -5
- package/dist/process/transient.js +2 -2
- package/dist/promises/_internal.d.ts +2 -1
- package/dist/promises/_internal.js +2 -6
- package/dist/promises/iterate.js +11 -15
- package/dist/promises/options.js +3 -6
- package/dist/promises/retry.js +4 -5
- package/dist/promises/timers.d.ts +30 -0
- package/dist/promises/timers.js +48 -0
- package/dist/regexps/spec.js +1 -1
- package/dist/releases/github-archives.d.ts +6 -6
- package/dist/releases/github-archives.js +3 -3
- package/dist/releases/github-asset-url.d.ts +1 -1
- package/dist/releases/github-asset-url.js +5 -5
- package/dist/releases/github-downloads.d.ts +1 -1
- package/dist/releases/github-downloads.js +3 -3
- package/dist/releases/github-listing.d.ts +12 -4
- package/dist/releases/github-listing.js +20 -7
- package/dist/releases/github-retry-config.js +1 -1
- package/dist/releases/github-types.d.ts +6 -6
- package/dist/releases/socket-btm-binary-naming.d.ts +107 -0
- package/dist/releases/socket-btm-binary-naming.js +155 -0
- package/dist/releases/socket-btm.d.ts +8 -115
- package/dist/releases/socket-btm.js +16 -159
- package/dist/schema/types.d.ts +4 -5
- package/dist/schema/validate.js +1 -1
- package/dist/sea/detect.js +6 -6
- package/dist/secrets/_internal.d.ts +2 -2
- package/dist/secrets/_internal.js +2 -2
- package/dist/secrets/compare.d.ts +45 -0
- package/dist/secrets/compare.js +61 -0
- package/dist/secrets/find.d.ts +2 -2
- package/dist/secrets/find.js +10 -4
- package/dist/secrets/keychain.d.ts +1 -1
- package/dist/secrets/keychain.js +6 -4
- package/dist/secrets/linux.js +40 -52
- package/dist/secrets/macos.d.ts +2 -3
- package/dist/secrets/macos.js +24 -33
- package/dist/secrets/rc.d.ts +4 -4
- package/dist/secrets/rc.js +27 -17
- package/dist/secrets/socket-api-token.d.ts +4 -4
- package/dist/secrets/socket-api-token.js +26 -9
- package/dist/secrets/windows.js +32 -37
- package/dist/shadow/skip.js +2 -2
- package/dist/shell/parse.d.ts +32 -0
- package/dist/shell/parse.js +60 -0
- package/dist/smol/detect.js +9 -10
- package/dist/smol/http.js +6 -7
- package/dist/smol/https.js +6 -7
- package/dist/smol/manifest.d.ts +1 -1
- package/dist/smol/manifest.js +6 -7
- package/dist/smol/path.d.ts +1 -1
- package/dist/smol/path.js +7 -8
- package/dist/smol/primordial.d.ts +4 -0
- package/dist/smol/primordial.js +6 -7
- package/dist/smol/purl.d.ts +1 -1
- package/dist/smol/purl.js +7 -8
- package/dist/smol/versions.js +6 -7
- package/dist/smol/vfs.js +6 -7
- package/dist/sorts/_internal.js +6 -8
- package/dist/sorts/natural.js +10 -12
- package/dist/sorts/semver.js +1 -2
- package/dist/sorts/strings.js +0 -1
- package/dist/sorts/types.d.ts +1 -1
- package/dist/spinner/create-spinner-class.d.ts +38 -0
- package/dist/spinner/create-spinner-class.js +302 -0
- package/dist/spinner/default.js +8 -9
- package/dist/spinner/spinner-internals.d.ts +36 -0
- package/dist/spinner/spinner-internals.js +105 -0
- package/dist/spinner/spinner-shimmer-methods.d.ts +54 -0
- package/dist/spinner/spinner-shimmer-methods.js +143 -0
- package/dist/spinner/spinner-status-methods.d.ts +40 -0
- package/dist/spinner/spinner-status-methods.js +133 -0
- package/dist/spinner/spinner.d.ts +8 -5
- package/dist/spinner/spinner.js +19 -706
- package/dist/spinner/types.d.ts +3 -1
- package/dist/spinner/with.d.ts +10 -0
- package/dist/spinner/with.js +16 -2
- package/dist/stdio/divider.js +1 -1
- package/dist/stdio/footer.js +3 -3
- package/dist/stdio/header.js +4 -4
- package/dist/stdio/progress.js +10 -6
- package/dist/stdio/prompts.d.ts +7 -5
- package/dist/stdio/prompts.js +7 -8
- package/dist/stdio/stdout.js +3 -3
- package/dist/streams/parallel.js +3 -5
- package/dist/streams/transform.js +2 -3
- package/dist/strings/format.js +2 -6
- package/dist/strings/predicates.js +0 -2
- package/dist/strings/search.js +1 -2
- package/dist/strings/transform.js +0 -3
- package/dist/strings/width.js +9 -10
- package/dist/tables/bordered.js +4 -3
- package/dist/tables/padding.js +1 -1
- package/dist/tables/simple.js +8 -5
- package/dist/temporal/instant.js +1 -1
- package/dist/temporal/slots.js +6 -6
- package/dist/temporal/system.js +9 -9
- package/dist/themes/context.d.ts +3 -2
- package/dist/themes/context.js +4 -5
- package/dist/themes/themes.js +15 -15
- package/dist/themes/types.d.ts +3 -3
- package/dist/url/assert-safe.d.ts +29 -0
- package/dist/url/assert-safe.js +54 -0
- package/dist/url/parse.js +0 -2
- package/dist/url/predicates.d.ts +31 -1
- package/dist/url/predicates.js +43 -3
- package/dist/url/search-params.js +3 -9
- package/dist/url/types.d.ts +9 -5
- package/dist/versions/_internal.js +3 -3
- package/dist/words/article.js +0 -1
- package/dist/words/capitalize.js +0 -1
- package/dist/words/pluralize.js +15 -5
- package/package.json +419 -216
- package/dist/external-tools/uv/asset-names.d.ts +0 -36
- package/dist/external-tools/uv/asset-names.js +0 -70
- package/dist/external-tools/uv/from-download.d.ts +0 -17
- package/dist/external-tools/uv/from-download.js +0 -47
- package/dist/external-tools/uv/from-path.d.ts +0 -5
- package/dist/external-tools/uv/from-path.js +0 -22
- package/dist/external-tools/uv/from-vfs.d.ts +0 -7
- package/dist/external-tools/uv/from-vfs.js +0 -26
- package/dist/external-tools/uv/resolve.d.ts +0 -25
- package/dist/external-tools/uv/resolve.js +0 -53
- package/dist/external-tools/uv/types.d.ts +0 -24
- package/dist/fs/path-cache.d.ts +0 -21
- package/dist/fs/path-cache.js +0 -34
- package/dist/http-request/checksums.d.ts +0 -69
- package/dist/http-request/checksums.js +0 -108
- package/dist/http-request/http-request.d.ts +0 -12
- package/dist/http-request/http-request.js +0 -11
- package/dist/packages/operations.d.ts +0 -113
- package/dist/packages/operations.js +0 -304
- package/dist/ssri/convert.d.ts +0 -48
- package/dist/ssri/convert.js +0 -69
- package/dist/ssri/parse.d.ts +0 -27
- package/dist/ssri/parse.js +0 -41
- package/dist/ssri/validate.d.ts +0 -41
- package/dist/ssri/validate.js +0 -56
- /package/dist/{bin → cli}/check.d.ts +0 -0
- /package/dist/external-tools/{uv → python}/types.js +0 -0
- /package/dist/fs/{find-up.d.ts → find.d.ts} +0 -0
- /package/dist/github/{fetch.d.ts → request.d.ts} +0 -0
package/dist/env/socket-cli.js
CHANGED
|
@@ -24,9 +24,8 @@ const require_env_number = require('./number.js');
|
|
|
24
24
|
*
|
|
25
25
|
* @returns Whether to accept all risks
|
|
26
26
|
*/
|
|
27
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
28
27
|
function getSocketCliAcceptRisks() {
|
|
29
|
-
return
|
|
28
|
+
return require_env_boolean.envAsBoolean(require_env_rewire.getEnvValue("SOCKET_CLI_ACCEPT_RISKS"));
|
|
30
29
|
}
|
|
31
30
|
/**
|
|
32
31
|
* Socket CLI API base URL (alternative name). Checks SOCKET_CLI_API_BASE_URL
|
|
@@ -42,7 +41,6 @@ function getSocketCliAcceptRisks() {
|
|
|
42
41
|
*
|
|
43
42
|
* @returns API base URL or undefined
|
|
44
43
|
*/
|
|
45
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
46
44
|
function getSocketCliApiBaseUrl() {
|
|
47
45
|
return require_env_rewire.getEnvValue("SOCKET_CLI_API_BASE_URL") || require_env_rewire.getEnvValue("SOCKET_SECURITY_API_BASE_URL");
|
|
48
46
|
}
|
|
@@ -62,7 +60,6 @@ function getSocketCliApiBaseUrl() {
|
|
|
62
60
|
*
|
|
63
61
|
* @returns API proxy URL or undefined
|
|
64
62
|
*/
|
|
65
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
66
63
|
function getSocketCliApiProxy() {
|
|
67
64
|
return require_env_rewire.getEnvValue("SOCKET_CLI_API_PROXY") || require_env_rewire.getEnvValue("SOCKET_SECURITY_API_PROXY") || require_env_rewire.getEnvValue("HTTPS_PROXY") || require_env_rewire.getEnvValue("https_proxy") || require_env_rewire.getEnvValue("HTTP_PROXY") || require_env_rewire.getEnvValue("http_proxy");
|
|
68
65
|
}
|
|
@@ -79,9 +76,8 @@ function getSocketCliApiProxy() {
|
|
|
79
76
|
*
|
|
80
77
|
* @returns API timeout in milliseconds
|
|
81
78
|
*/
|
|
82
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
83
79
|
function getSocketCliApiTimeout() {
|
|
84
|
-
return
|
|
80
|
+
return require_env_number.envAsNumber(require_env_rewire.getEnvValue("SOCKET_CLI_API_TIMEOUT"));
|
|
85
81
|
}
|
|
86
82
|
/**
|
|
87
83
|
* Bootstrap cache directory path. Set by bootstrap wrappers to pass dlx cache
|
|
@@ -97,7 +93,6 @@ function getSocketCliApiTimeout() {
|
|
|
97
93
|
*
|
|
98
94
|
* @returns Bootstrap cache directory or undefined
|
|
99
95
|
*/
|
|
100
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
101
96
|
function getSocketCliBootstrapCacheDir() {
|
|
102
97
|
return require_env_rewire.getEnvValue("SOCKET_CLI_BOOTSTRAP_CACHE_DIR");
|
|
103
98
|
}
|
|
@@ -115,7 +110,6 @@ function getSocketCliBootstrapCacheDir() {
|
|
|
115
110
|
*
|
|
116
111
|
* @returns Bootstrap package spec or undefined
|
|
117
112
|
*/
|
|
118
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
119
113
|
function getSocketCliBootstrapSpec() {
|
|
120
114
|
return require_env_rewire.getEnvValue("SOCKET_CLI_BOOTSTRAP_SPEC");
|
|
121
115
|
}
|
|
@@ -132,7 +126,6 @@ function getSocketCliBootstrapSpec() {
|
|
|
132
126
|
*
|
|
133
127
|
* @returns Config file path or undefined
|
|
134
128
|
*/
|
|
135
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
136
129
|
function getSocketCliConfig() {
|
|
137
130
|
return require_env_rewire.getEnvValue("SOCKET_CLI_CONFIG");
|
|
138
131
|
}
|
|
@@ -149,7 +142,6 @@ function getSocketCliConfig() {
|
|
|
149
142
|
*
|
|
150
143
|
* @returns Fix mode value or undefined
|
|
151
144
|
*/
|
|
152
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
153
145
|
function getSocketCliFix() {
|
|
154
146
|
return require_env_rewire.getEnvValue("SOCKET_CLI_FIX");
|
|
155
147
|
}
|
|
@@ -167,7 +159,6 @@ function getSocketCliFix() {
|
|
|
167
159
|
*
|
|
168
160
|
* @returns GitHub token or undefined
|
|
169
161
|
*/
|
|
170
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
171
162
|
function getSocketCliGithubToken() {
|
|
172
163
|
return require_env_rewire.getEnvValue("SOCKET_CLI_GITHUB_TOKEN") || require_env_rewire.getEnvValue("SOCKET_SECURITY_GITHUB_PAT") || require_env_rewire.getEnvValue("GITHUB_TOKEN");
|
|
173
164
|
}
|
|
@@ -185,9 +176,8 @@ function getSocketCliGithubToken() {
|
|
|
185
176
|
*
|
|
186
177
|
* @returns Whether to skip API token requirement
|
|
187
178
|
*/
|
|
188
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
189
179
|
function getSocketCliNoApiToken() {
|
|
190
|
-
return
|
|
180
|
+
return require_env_boolean.envAsBoolean(require_env_rewire.getEnvValue("SOCKET_CLI_NO_API_TOKEN"));
|
|
191
181
|
}
|
|
192
182
|
/**
|
|
193
183
|
* Controls Socket CLI optimization mode.
|
|
@@ -203,9 +193,8 @@ function getSocketCliNoApiToken() {
|
|
|
203
193
|
*
|
|
204
194
|
* @returns Whether optimization mode is enabled
|
|
205
195
|
*/
|
|
206
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
207
196
|
function getSocketCliOptimize() {
|
|
208
|
-
return
|
|
197
|
+
return require_env_boolean.envAsBoolean(require_env_rewire.getEnvValue("SOCKET_CLI_OPTIMIZE"));
|
|
209
198
|
}
|
|
210
199
|
/**
|
|
211
200
|
* Socket CLI organization slug identifier (alternative name). Checks
|
|
@@ -221,7 +210,6 @@ function getSocketCliOptimize() {
|
|
|
221
210
|
*
|
|
222
211
|
* @returns Organization slug or undefined
|
|
223
212
|
*/
|
|
224
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
225
213
|
function getSocketCliOrgSlug() {
|
|
226
214
|
return require_env_rewire.getEnvValue("SOCKET_CLI_ORG_SLUG") || require_env_rewire.getEnvValue("SOCKET_ORG_SLUG");
|
|
227
215
|
}
|
|
@@ -239,9 +227,8 @@ function getSocketCliOrgSlug() {
|
|
|
239
227
|
*
|
|
240
228
|
* @returns Whether to view all risks
|
|
241
229
|
*/
|
|
242
|
-
/*@__NO_SIDE_EFFECTS__*/
|
|
243
230
|
function getSocketCliViewAllRisks() {
|
|
244
|
-
return
|
|
231
|
+
return require_env_boolean.envAsBoolean(require_env_rewire.getEnvValue("SOCKET_CLI_VIEW_ALL_RISKS"));
|
|
245
232
|
}
|
|
246
233
|
|
|
247
234
|
//#endregion
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Socket MCP HTTP server environment variable getters. Covers the MCP
|
|
3
|
+
* transport (HTTP mode, port) and the OAuth credentials / proxy-trust
|
|
4
|
+
* settings the MCP HTTP server reads at startup.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Whether the MCP server should run in HTTP mode. MCP_HTTP_MODE — when set to
|
|
8
|
+
* the literal string `'true'`, the MCP server serves over HTTP instead of
|
|
9
|
+
* stdio. Returns `false` for any other value (including unset).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ;```typescript
|
|
13
|
+
* import { getMcpHttpMode } from '@socketsecurity/lib/env/socket-mcp'
|
|
14
|
+
*
|
|
15
|
+
* if (getMcpHttpMode()) {
|
|
16
|
+
* startHttpServer()
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @returns `true` if HTTP mode is enabled, `false` otherwise
|
|
21
|
+
*/
|
|
22
|
+
export declare function getMcpHttpMode(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* MCP HTTP server listen port. MCP_PORT — port the MCP HTTP server binds to.
|
|
25
|
+
* Defaults to `3000` (matches socket-mcp's documented default). Invalid /
|
|
26
|
+
* non-numeric values also fall back to `3000`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ;```typescript
|
|
30
|
+
* import { getMcpPort } from '@socketsecurity/lib/env/socket-mcp'
|
|
31
|
+
*
|
|
32
|
+
* const port = getMcpPort()
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @returns The MCP server port (default `3000`)
|
|
36
|
+
*/
|
|
37
|
+
export declare function getMcpPort(): number;
|
|
38
|
+
/**
|
|
39
|
+
* OAuth introspection client ID for the MCP HTTP server.
|
|
40
|
+
* SOCKET_OAUTH_INTROSPECTION_CLIENT_ID — client credential used to call the
|
|
41
|
+
* issuer's introspection endpoint. Empty string when unset.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ;```typescript
|
|
45
|
+
* import { getSocketOauthIntrospectionClientId } from '@socketsecurity/lib/env/socket-mcp'
|
|
46
|
+
*
|
|
47
|
+
* const clientId = getSocketOauthIntrospectionClientId()
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @returns The OAuth client ID, or `''` if not set
|
|
51
|
+
*/
|
|
52
|
+
export declare function getSocketOauthIntrospectionClientId(): string;
|
|
53
|
+
/**
|
|
54
|
+
* OAuth introspection client secret for the MCP HTTP server.
|
|
55
|
+
* SOCKET_OAUTH_INTROSPECTION_CLIENT_SECRET — paired with the client ID for
|
|
56
|
+
* authenticated introspection requests. Empty string when unset.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ;```typescript
|
|
60
|
+
* import { getSocketOauthIntrospectionClientSecret } from '@socketsecurity/lib/env/socket-mcp'
|
|
61
|
+
*
|
|
62
|
+
* const clientSecret = getSocketOauthIntrospectionClientSecret()
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* @returns The OAuth client secret, or `''` if not set
|
|
66
|
+
*/
|
|
67
|
+
export declare function getSocketOauthIntrospectionClientSecret(): string;
|
|
68
|
+
/**
|
|
69
|
+
* OAuth issuer URL for the MCP HTTP server. SOCKET_OAUTH_ISSUER — issuer to
|
|
70
|
+
* validate inbound OAuth tokens against. Returns the empty string when unset;
|
|
71
|
+
* callers treat empty as "no issuer configured".
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ;```typescript
|
|
75
|
+
* import { getSocketOauthIssuer } from '@socketsecurity/lib/env/socket-mcp'
|
|
76
|
+
*
|
|
77
|
+
* const issuer = getSocketOauthIssuer()
|
|
78
|
+
* if (issuer) { ... }
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @returns The OAuth issuer URL, or `''` if not set
|
|
82
|
+
*/
|
|
83
|
+
export declare function getSocketOauthIssuer(): string;
|
|
84
|
+
/**
|
|
85
|
+
* Required OAuth scopes for the MCP HTTP server. SOCKET_OAUTH_REQUIRED_SCOPES —
|
|
86
|
+
* whitespace-separated list of scopes inbound tokens must carry. Defaults to
|
|
87
|
+
* `'packages:list'` (the minimum scope socket-mcp's depscore tool needs).
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ;```typescript
|
|
91
|
+
* import { getSocketOauthRequiredScopes } from '@socketsecurity/lib/env/socket-mcp'
|
|
92
|
+
*
|
|
93
|
+
* const scopes = getSocketOauthRequiredScopes().split(/\s+/u)
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @returns The required-scopes string, defaulting to `'packages:list'`
|
|
97
|
+
*/
|
|
98
|
+
export declare function getSocketOauthRequiredScopes(): string;
|
|
99
|
+
/**
|
|
100
|
+
* Whether the MCP HTTP server should trust upstream proxy headers. TRUST_PROXY
|
|
101
|
+
* — when set to the literal string `'true'`, the server honors
|
|
102
|
+
* `X-Forwarded-Host` / `X-Forwarded-Proto` when composing OAuth metadata URLs.
|
|
103
|
+
* Off by default to prevent header spoofing when no upstream proxy is present.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ;```typescript
|
|
107
|
+
* import { getTrustProxy } from '@socketsecurity/lib/env/socket-mcp'
|
|
108
|
+
*
|
|
109
|
+
* if (getTrustProxy()) { ... }
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @returns `true` if proxy headers are trusted, `false` otherwise
|
|
113
|
+
*/
|
|
114
|
+
export declare function getTrustProxy(): boolean;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Socket Lib - Built with rolldown */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_primordials_number = require('../primordials/number.js');
|
|
5
|
+
const require_env_rewire = require('./rewire.js');
|
|
6
|
+
const require_env_number = require('./number.js');
|
|
7
|
+
|
|
8
|
+
//#region src/env/socket-mcp.ts
|
|
9
|
+
/**
|
|
10
|
+
* @file Socket MCP HTTP server environment variable getters. Covers the MCP
|
|
11
|
+
* transport (HTTP mode, port) and the OAuth credentials / proxy-trust
|
|
12
|
+
* settings the MCP HTTP server reads at startup.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Whether the MCP server should run in HTTP mode. MCP_HTTP_MODE — when set to
|
|
16
|
+
* the literal string `'true'`, the MCP server serves over HTTP instead of
|
|
17
|
+
* stdio. Returns `false` for any other value (including unset).
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ;```typescript
|
|
21
|
+
* import { getMcpHttpMode } from '@socketsecurity/lib/env/socket-mcp'
|
|
22
|
+
*
|
|
23
|
+
* if (getMcpHttpMode()) {
|
|
24
|
+
* startHttpServer()
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @returns `true` if HTTP mode is enabled, `false` otherwise
|
|
29
|
+
*/
|
|
30
|
+
function getMcpHttpMode() {
|
|
31
|
+
return require_env_rewire.getEnvValue("MCP_HTTP_MODE") === "true";
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* MCP HTTP server listen port. MCP_PORT — port the MCP HTTP server binds to.
|
|
35
|
+
* Defaults to `3000` (matches socket-mcp's documented default). Invalid /
|
|
36
|
+
* non-numeric values also fall back to `3000`.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ;```typescript
|
|
40
|
+
* import { getMcpPort } from '@socketsecurity/lib/env/socket-mcp'
|
|
41
|
+
*
|
|
42
|
+
* const port = getMcpPort()
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @returns The MCP server port (default `3000`)
|
|
46
|
+
*/
|
|
47
|
+
function getMcpPort() {
|
|
48
|
+
const parsed = require_env_number.envAsNumber(require_env_rewire.getEnvValue("MCP_PORT"));
|
|
49
|
+
return require_primordials_number.NumberIsFinite(parsed) && parsed > 0 ? parsed : 3e3;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* OAuth introspection client ID for the MCP HTTP server.
|
|
53
|
+
* SOCKET_OAUTH_INTROSPECTION_CLIENT_ID — client credential used to call the
|
|
54
|
+
* issuer's introspection endpoint. Empty string when unset.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ;```typescript
|
|
58
|
+
* import { getSocketOauthIntrospectionClientId } from '@socketsecurity/lib/env/socket-mcp'
|
|
59
|
+
*
|
|
60
|
+
* const clientId = getSocketOauthIntrospectionClientId()
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @returns The OAuth client ID, or `''` if not set
|
|
64
|
+
*/
|
|
65
|
+
function getSocketOauthIntrospectionClientId() {
|
|
66
|
+
return require_env_rewire.getEnvValue("SOCKET_OAUTH_INTROSPECTION_CLIENT_ID") ?? "";
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* OAuth introspection client secret for the MCP HTTP server.
|
|
70
|
+
* SOCKET_OAUTH_INTROSPECTION_CLIENT_SECRET — paired with the client ID for
|
|
71
|
+
* authenticated introspection requests. Empty string when unset.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ;```typescript
|
|
75
|
+
* import { getSocketOauthIntrospectionClientSecret } from '@socketsecurity/lib/env/socket-mcp'
|
|
76
|
+
*
|
|
77
|
+
* const clientSecret = getSocketOauthIntrospectionClientSecret()
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @returns The OAuth client secret, or `''` if not set
|
|
81
|
+
*/
|
|
82
|
+
function getSocketOauthIntrospectionClientSecret() {
|
|
83
|
+
return require_env_rewire.getEnvValue("SOCKET_OAUTH_INTROSPECTION_CLIENT_SECRET") ?? "";
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* OAuth issuer URL for the MCP HTTP server. SOCKET_OAUTH_ISSUER — issuer to
|
|
87
|
+
* validate inbound OAuth tokens against. Returns the empty string when unset;
|
|
88
|
+
* callers treat empty as "no issuer configured".
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ;```typescript
|
|
92
|
+
* import { getSocketOauthIssuer } from '@socketsecurity/lib/env/socket-mcp'
|
|
93
|
+
*
|
|
94
|
+
* const issuer = getSocketOauthIssuer()
|
|
95
|
+
* if (issuer) { ... }
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @returns The OAuth issuer URL, or `''` if not set
|
|
99
|
+
*/
|
|
100
|
+
function getSocketOauthIssuer() {
|
|
101
|
+
return require_env_rewire.getEnvValue("SOCKET_OAUTH_ISSUER") ?? "";
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Required OAuth scopes for the MCP HTTP server. SOCKET_OAUTH_REQUIRED_SCOPES —
|
|
105
|
+
* whitespace-separated list of scopes inbound tokens must carry. Defaults to
|
|
106
|
+
* `'packages:list'` (the minimum scope socket-mcp's depscore tool needs).
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ;```typescript
|
|
110
|
+
* import { getSocketOauthRequiredScopes } from '@socketsecurity/lib/env/socket-mcp'
|
|
111
|
+
*
|
|
112
|
+
* const scopes = getSocketOauthRequiredScopes().split(/\s+/u)
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @returns The required-scopes string, defaulting to `'packages:list'`
|
|
116
|
+
*/
|
|
117
|
+
function getSocketOauthRequiredScopes() {
|
|
118
|
+
return require_env_rewire.getEnvValue("SOCKET_OAUTH_REQUIRED_SCOPES") ?? "packages:list";
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Whether the MCP HTTP server should trust upstream proxy headers. TRUST_PROXY
|
|
122
|
+
* — when set to the literal string `'true'`, the server honors
|
|
123
|
+
* `X-Forwarded-Host` / `X-Forwarded-Proto` when composing OAuth metadata URLs.
|
|
124
|
+
* Off by default to prevent header spoofing when no upstream proxy is present.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ;```typescript
|
|
128
|
+
* import { getTrustProxy } from '@socketsecurity/lib/env/socket-mcp'
|
|
129
|
+
*
|
|
130
|
+
* if (getTrustProxy()) { ... }
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* @returns `true` if proxy headers are trusted, `false` otherwise
|
|
134
|
+
*/
|
|
135
|
+
function getTrustProxy() {
|
|
136
|
+
return require_env_rewire.getEnvValue("TRUST_PROXY") === "true";
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
//#endregion
|
|
140
|
+
exports.getMcpHttpMode = getMcpHttpMode;
|
|
141
|
+
exports.getMcpPort = getMcpPort;
|
|
142
|
+
exports.getSocketOauthIntrospectionClientId = getSocketOauthIntrospectionClientId;
|
|
143
|
+
exports.getSocketOauthIntrospectionClientSecret = getSocketOauthIntrospectionClientSecret;
|
|
144
|
+
exports.getSocketOauthIssuer = getSocketOauthIssuer;
|
|
145
|
+
exports.getSocketOauthRequiredScopes = getSocketOauthRequiredScopes;
|
|
146
|
+
exports.getTrustProxy = getTrustProxy;
|
package/dist/env/socket.d.ts
CHANGED
|
@@ -1,38 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Socket Security environment variable getters.
|
|
3
3
|
*/
|
|
4
|
-
/**
|
|
5
|
-
* Whether the MCP server should run in HTTP mode. MCP_HTTP_MODE — when set to
|
|
6
|
-
* the literal string `'true'`, the MCP server serves over HTTP instead of
|
|
7
|
-
* stdio. Returns `false` for any other value (including unset).
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ;```typescript
|
|
11
|
-
* import { getMcpHttpMode } from '@socketsecurity/lib/env/socket'
|
|
12
|
-
*
|
|
13
|
-
* if (getMcpHttpMode()) {
|
|
14
|
-
* startHttpServer()
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* @returns `true` if HTTP mode is enabled, `false` otherwise
|
|
19
|
-
*/
|
|
20
|
-
export declare function getMcpHttpMode(): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* MCP HTTP server listen port. MCP_PORT — port the MCP HTTP server binds to.
|
|
23
|
-
* Defaults to `3000` (matches socket-mcp's documented default). Invalid /
|
|
24
|
-
* non-numeric values also fall back to `3000`.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ;```typescript
|
|
28
|
-
* import { getMcpPort } from '@socketsecurity/lib/env/socket'
|
|
29
|
-
*
|
|
30
|
-
* const port = getMcpPort()
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* @returns The MCP server port (default `3000`)
|
|
34
|
-
*/
|
|
35
|
-
export declare function getMcpPort(): number;
|
|
36
4
|
/**
|
|
37
5
|
* SOCKET_ACCEPT_RISKS environment variable getter. Whether to accept all Socket
|
|
38
6
|
* Security risks.
|
|
@@ -308,67 +276,6 @@ export declare function getSocketNoApiToken(): boolean;
|
|
|
308
276
|
* @returns The Socket NPM registry URL, or `undefined` if not set
|
|
309
277
|
*/
|
|
310
278
|
export declare function getSocketNpmRegistry(): string | undefined;
|
|
311
|
-
/**
|
|
312
|
-
* OAuth introspection client ID for the MCP HTTP server.
|
|
313
|
-
* SOCKET_OAUTH_INTROSPECTION_CLIENT_ID — client credential used to call the
|
|
314
|
-
* issuer's introspection endpoint. Empty string when unset.
|
|
315
|
-
*
|
|
316
|
-
* @example
|
|
317
|
-
* ;```typescript
|
|
318
|
-
* import { getSocketOauthIntrospectionClientId } from '@socketsecurity/lib/env/socket'
|
|
319
|
-
*
|
|
320
|
-
* const clientId = getSocketOauthIntrospectionClientId()
|
|
321
|
-
* ```
|
|
322
|
-
*
|
|
323
|
-
* @returns The OAuth client ID, or `''` if not set
|
|
324
|
-
*/
|
|
325
|
-
export declare function getSocketOauthIntrospectionClientId(): string;
|
|
326
|
-
/**
|
|
327
|
-
* OAuth introspection client secret for the MCP HTTP server.
|
|
328
|
-
* SOCKET_OAUTH_INTROSPECTION_CLIENT_SECRET — paired with the client ID for
|
|
329
|
-
* authenticated introspection requests. Empty string when unset.
|
|
330
|
-
*
|
|
331
|
-
* @example
|
|
332
|
-
* ;```typescript
|
|
333
|
-
* import { getSocketOauthIntrospectionClientSecret } from '@socketsecurity/lib/env/socket'
|
|
334
|
-
*
|
|
335
|
-
* const clientSecret = getSocketOauthIntrospectionClientSecret()
|
|
336
|
-
* ```
|
|
337
|
-
*
|
|
338
|
-
* @returns The OAuth client secret, or `''` if not set
|
|
339
|
-
*/
|
|
340
|
-
export declare function getSocketOauthIntrospectionClientSecret(): string;
|
|
341
|
-
/**
|
|
342
|
-
* OAuth issuer URL for the MCP HTTP server. SOCKET_OAUTH_ISSUER — issuer to
|
|
343
|
-
* validate inbound OAuth tokens against. Returns the empty string when unset;
|
|
344
|
-
* callers treat empty as "no issuer configured".
|
|
345
|
-
*
|
|
346
|
-
* @example
|
|
347
|
-
* ;```typescript
|
|
348
|
-
* import { getSocketOauthIssuer } from '@socketsecurity/lib/env/socket'
|
|
349
|
-
*
|
|
350
|
-
* const issuer = getSocketOauthIssuer()
|
|
351
|
-
* if (issuer) { ... }
|
|
352
|
-
* ```
|
|
353
|
-
*
|
|
354
|
-
* @returns The OAuth issuer URL, or `''` if not set
|
|
355
|
-
*/
|
|
356
|
-
export declare function getSocketOauthIssuer(): string;
|
|
357
|
-
/**
|
|
358
|
-
* Required OAuth scopes for the MCP HTTP server. SOCKET_OAUTH_REQUIRED_SCOPES —
|
|
359
|
-
* whitespace-separated list of scopes inbound tokens must carry. Defaults to
|
|
360
|
-
* `'packages:list'` (the minimum scope socket-mcp's depscore tool needs).
|
|
361
|
-
*
|
|
362
|
-
* @example
|
|
363
|
-
* ;```typescript
|
|
364
|
-
* import { getSocketOauthRequiredScopes } from '@socketsecurity/lib/env/socket'
|
|
365
|
-
*
|
|
366
|
-
* const scopes = getSocketOauthRequiredScopes().split(/\s+/u)
|
|
367
|
-
* ```
|
|
368
|
-
*
|
|
369
|
-
* @returns The required-scopes string, defaulting to `'packages:list'`
|
|
370
|
-
*/
|
|
371
|
-
export declare function getSocketOauthRequiredScopes(): string;
|
|
372
279
|
/**
|
|
373
280
|
* SOCKET_ORG_SLUG environment variable getter. Socket Security organization
|
|
374
281
|
* slug identifier.
|
|
@@ -414,6 +321,13 @@ export declare function getSocketRegistryUrl(): string | undefined;
|
|
|
414
321
|
* @returns The repository name, or `undefined` if neither is set
|
|
415
322
|
*/
|
|
416
323
|
export declare function getSocketRepositoryName(): string | undefined;
|
|
324
|
+
/**
|
|
325
|
+
* SOCKET_STATE_DIR environment variable getter. Overrides the default Socket
|
|
326
|
+
* state directory (~/.socket/_state) location.
|
|
327
|
+
*
|
|
328
|
+
* @returns The state directory path, or `undefined` if not set
|
|
329
|
+
*/
|
|
330
|
+
export declare function getSocketStateDirEnv(): string | undefined;
|
|
417
331
|
/**
|
|
418
332
|
* SOCKET_VIEW_ALL_RISKS environment variable getter. Whether to view all Socket
|
|
419
333
|
* Security risks.
|
|
@@ -430,19 +344,4 @@ export declare function getSocketRepositoryName(): string | undefined;
|
|
|
430
344
|
* @returns `true` if viewing all risks, `false` otherwise
|
|
431
345
|
*/
|
|
432
346
|
export declare function getSocketViewAllRisks(): boolean;
|
|
433
|
-
|
|
434
|
-
* Whether the MCP HTTP server should trust upstream proxy headers. TRUST_PROXY
|
|
435
|
-
* — when set to the literal string `'true'`, the server honors
|
|
436
|
-
* `X-Forwarded-Host` / `X-Forwarded-Proto` when composing OAuth metadata URLs.
|
|
437
|
-
* Off by default to prevent header spoofing when no upstream proxy is present.
|
|
438
|
-
*
|
|
439
|
-
* @example
|
|
440
|
-
* ;```typescript
|
|
441
|
-
* import { getTrustProxy } from '@socketsecurity/lib/env/socket'
|
|
442
|
-
*
|
|
443
|
-
* if (getTrustProxy()) { ... }
|
|
444
|
-
* ```
|
|
445
|
-
*
|
|
446
|
-
* @returns `true` if proxy headers are trusted, `false` otherwise
|
|
447
|
-
*/
|
|
448
|
-
export declare function getTrustProxy(): boolean;
|
|
347
|
+
export { getMcpHttpMode, getMcpPort, getSocketOauthIntrospectionClientId, getSocketOauthIntrospectionClientSecret, getSocketOauthIssuer, getSocketOauthRequiredScopes, getTrustProxy, } from './socket-mcp';
|