@socketsecurity/sdk 3.4.1 → 3.5.0
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 +17 -0
- package/README.md +1 -1
- package/dist/constants.d.ts +3 -1
- package/dist/http-client.d.ts +1 -36
- package/dist/index.d.ts +1 -1
- package/dist/index.js +262 -152
- package/dist/socket-sdk-class.d.ts +35 -31
- package/dist/types.d.ts +28 -8
- package/package.json +9 -6
- package/types/api.d.ts +112 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
6
|
|
|
7
|
+
## [3.5.0](https://github.com/SocketDev/socket-sdk-js/releases/tag/v3.5.0) - 2026-04-03
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **checkMalware**: New API method for normalized malware detection across public and org tokens
|
|
12
|
+
- Public tokens use the firewall API with client-side `publicPolicy` filtering
|
|
13
|
+
- Org tokens use the batch PURL API with full server-assigned org policy
|
|
14
|
+
- Both paths return the same normalized `MalwareCheckResult` shape
|
|
15
|
+
- New exported types: `MalwareCheckAlert`, `MalwareCheckPackage`, `MalwareCheckResult`, `MalwareCheckScore`
|
|
16
|
+
- New audit log action types: `CreateTicket`, `DisconnectJiraIntegration`, `JiraIntegrationConnected`
|
|
17
|
+
- New `alert-resolution` permission scope (list, create, read, delete)
|
|
18
|
+
- New `workspace` parameter for `createOrgFullScan` package entries
|
|
19
|
+
- New `SocketSBOMScore` schema for supply chain risk score breakdowns with formulas and components
|
|
20
|
+
- New `skillPreExecution` alert type and policy action
|
|
21
|
+
- Full scan `include_scores` and `include_scores_details` query parameters with `scores` ndjson event
|
|
22
|
+
- Batch PURL `timeoutSec` parameter for scan result timeout control
|
|
23
|
+
|
|
7
24
|
## [3.4.1](https://github.com/SocketDev/socket-sdk-js/releases/tag/v3.4.1) - 2026-03-12
|
|
8
25
|
|
|
9
26
|
### Changed
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://socket.dev/npm/package/@socketsecurity/sdk)
|
|
4
4
|
[](https://github.com/SocketDev/socket-sdk-js/actions/workflows/ci.yml)
|
|
5
|
-

|
|
6
6
|
|
|
7
7
|
[](https://twitter.com/SocketSecurity)
|
|
8
8
|
[](https://bsky.app/profile/socket.dev)
|
package/dist/constants.d.ts
CHANGED
|
@@ -12,5 +12,7 @@ export declare const MIN_HTTP_TIMEOUT = 5000;
|
|
|
12
12
|
export declare const MAX_RESPONSE_SIZE: number;
|
|
13
13
|
export declare const MAX_STREAM_SIZE: number;
|
|
14
14
|
export declare const SOCKET_PUBLIC_BLOB_STORE_URL = "https://socketusercontent.com";
|
|
15
|
+
export declare const MAX_FIREWALL_COMPONENTS = 8;
|
|
16
|
+
export declare const SOCKET_FIREWALL_API_URL = "https://firewall-api.socket.dev/purl";
|
|
15
17
|
export declare const httpAgentNames: Set<string>;
|
|
16
|
-
export declare const publicPolicy: Map<"ambiguousClassifier" | "badEncoding" | "badSemver" | "badSemverDependency" | "bidi" | "binScriptConfusion" | "chromeContentScript" | "chromeHostPermission" | "chromePermission" | "chromeWildcardHostPermission" | "chronoAnomaly" | "compromisedSSHKey" | "copyleftLicense" | "criticalCVE" | "cve" | "debugAccess" | "deprecated" | "deprecatedException" | "deprecatedLicense" | "didYouMean" | "dynamicRequire" | "emptyPackage" | "envVars" | "explicitlyUnlicensedItem" | "extraneousDependency" | "fileDependency" | "filesystemAccess" | "floatingDependency" | "generic" | "ghaArgToEnv" | "ghaArgToOutput" | "ghaArgToSink" | "ghaContextToEnv" | "ghaContextToOutput" | "ghaContextToSink" | "ghaEnvToSink" | "gitDependency" | "gitHubDependency" | "gptAnomaly" | "gptDidYouMean" | "gptMalware" | "gptSecurity" | "hasNativeCode" | "highEntropyStrings" | "homoglyphs" | "httpDependency" | "installScripts" | "invalidPackageJSON" | "invisibleChars" | "licenseChange" | "licenseException" | "licenseSpdxDisj" | "longStrings" | "majorRefactor" | "malware" | "manifestConfusion" | "mediumCVE" | "mildCVE" | "minifiedFile" | "miscLicenseIssues" | "missingAuthor" | "missingDependency" | "missingLicense" | "missingTarball" | "mixedLicense" | "modifiedException" | "modifiedLicense" | "networkAccess" | "newAuthor" | "noAuthorData" | "noBugTracker" | "noLicenseFound" | "noREADME" | "noRepository" | "noTests" | "noV1" | "noWebsite" | "nonOSILicense" | "nonSPDXLicense" | "nonpermissiveLicense" | "notice" | "obfuscatedFile" | "obfuscatedRequire" | "peerDependency" | "potentialVulnerability" | "recentlyPublished" | "semverAnomaly" | "shellAccess" | "shellScriptOverride" | "shrinkwrap" | "skillAutonomyAbuse" | "skillCommandInjection" | "skillDataExfiltration" | "skillDiscoveryAbuse" | "skillHardcodedSecrets" | "skillObfuscation" | "skillPromptInjection" | "skillResourceAbuse" | "skillSupplyChain" | "skillToolAbuse" | "skillToolChaining" | "skillTransitiveTrust" | "socketUpgradeAvailable" | "suspiciousStarActivity" | "suspiciousString" | "telemetry" | "tooManyFiles" | "trivialPackage" | "troll" | "typeModuleCompatibility" | "uncaughtOptionalDependency" | "unclearLicense" | "unidentifiedLicense" | "unmaintained" | "unpopularPackage" | "unpublished" | "unresolvedRequire" | "unsafeCopyright" | "unstableOwnership" | "unusedDependency" | "urlStrings" | "usesEval" | "vsxActivationWildcard" | "vsxDebuggerContribution" | "vsxExtensionDependency" | "vsxExtensionPack" | "vsxProposedApiUsage" | "vsxUntrustedWorkspaceSupported" | "vsxVirtualWorkspaceSupported" | "vsxWebviewContribution" | "vsxWorkspaceContainsActivation" | "zeroWidth", ALERT_ACTION>;
|
|
18
|
+
export declare const publicPolicy: Map<"ambiguousClassifier" | "badEncoding" | "badSemver" | "badSemverDependency" | "bidi" | "binScriptConfusion" | "chromeContentScript" | "chromeHostPermission" | "chromePermission" | "chromeWildcardHostPermission" | "chronoAnomaly" | "compromisedSSHKey" | "copyleftLicense" | "criticalCVE" | "cve" | "debugAccess" | "deprecated" | "deprecatedException" | "deprecatedLicense" | "didYouMean" | "dynamicRequire" | "emptyPackage" | "envVars" | "explicitlyUnlicensedItem" | "extraneousDependency" | "fileDependency" | "filesystemAccess" | "floatingDependency" | "generic" | "ghaArgToEnv" | "ghaArgToOutput" | "ghaArgToSink" | "ghaContextToEnv" | "ghaContextToOutput" | "ghaContextToSink" | "ghaEnvToSink" | "gitDependency" | "gitHubDependency" | "gptAnomaly" | "gptDidYouMean" | "gptMalware" | "gptSecurity" | "hasNativeCode" | "highEntropyStrings" | "homoglyphs" | "httpDependency" | "installScripts" | "invalidPackageJSON" | "invisibleChars" | "licenseChange" | "licenseException" | "licenseSpdxDisj" | "longStrings" | "majorRefactor" | "malware" | "manifestConfusion" | "mediumCVE" | "mildCVE" | "minifiedFile" | "miscLicenseIssues" | "missingAuthor" | "missingDependency" | "missingLicense" | "missingTarball" | "mixedLicense" | "modifiedException" | "modifiedLicense" | "networkAccess" | "newAuthor" | "noAuthorData" | "noBugTracker" | "noLicenseFound" | "noREADME" | "noRepository" | "noTests" | "noV1" | "noWebsite" | "nonOSILicense" | "nonSPDXLicense" | "nonpermissiveLicense" | "notice" | "obfuscatedFile" | "obfuscatedRequire" | "peerDependency" | "potentialVulnerability" | "recentlyPublished" | "semverAnomaly" | "shellAccess" | "shellScriptOverride" | "shrinkwrap" | "skillAutonomyAbuse" | "skillCommandInjection" | "skillDataExfiltration" | "skillDiscoveryAbuse" | "skillHardcodedSecrets" | "skillObfuscation" | "skillPreExecution" | "skillPromptInjection" | "skillResourceAbuse" | "skillSupplyChain" | "skillToolAbuse" | "skillToolChaining" | "skillTransitiveTrust" | "socketUpgradeAvailable" | "suspiciousStarActivity" | "suspiciousString" | "telemetry" | "tooManyFiles" | "trivialPackage" | "troll" | "typeModuleCompatibility" | "uncaughtOptionalDependency" | "unclearLicense" | "unidentifiedLicense" | "unmaintained" | "unpopularPackage" | "unpublished" | "unresolvedRequire" | "unsafeCopyright" | "unstableOwnership" | "unusedDependency" | "urlStrings" | "usesEval" | "vsxActivationWildcard" | "vsxDebuggerContribution" | "vsxExtensionDependency" | "vsxExtensionPack" | "vsxProposedApiUsage" | "vsxUntrustedWorkspaceSupported" | "vsxVirtualWorkspaceSupported" | "vsxWebviewContribution" | "vsxWorkspaceContainsActivation" | "zeroWidth", ALERT_ACTION>;
|
package/dist/http-client.d.ts
CHANGED
|
@@ -76,30 +76,6 @@ export declare function getResponse(req: ClientRequest): Promise<IncomingMessage
|
|
|
76
76
|
* @throws {SyntaxError} When response body contains invalid JSON
|
|
77
77
|
*/
|
|
78
78
|
export declare function getResponseJson(response: IncomingMessage, method?: string | undefined, url?: string | undefined): Promise<JsonValue | undefined>;
|
|
79
|
-
/**
|
|
80
|
-
* Create DELETE request with automatic retry logic.
|
|
81
|
-
* Retries on network errors and 5xx responses.
|
|
82
|
-
*
|
|
83
|
-
* @param retries - Number of retry attempts (default: 0, retries disabled)
|
|
84
|
-
* @param retryDelay - Initial delay in ms (default: 100)
|
|
85
|
-
*/
|
|
86
|
-
export declare function createDeleteRequestWithRetry(baseUrl: string, urlPath: string, options?: RequestOptionsWithHooks | undefined, retries?: number, retryDelay?: number): Promise<IncomingMessage>;
|
|
87
|
-
/**
|
|
88
|
-
* Create GET request with automatic retry logic.
|
|
89
|
-
* Retries on network errors and 5xx responses.
|
|
90
|
-
*
|
|
91
|
-
* @param retries - Number of retry attempts (default: 0, retries disabled)
|
|
92
|
-
* @param retryDelay - Initial delay in ms (default: 100)
|
|
93
|
-
*/
|
|
94
|
-
export declare function createGetRequestWithRetry(baseUrl: string, urlPath: string, options?: RequestOptionsWithHooks | undefined, retries?: number, retryDelay?: number): Promise<IncomingMessage>;
|
|
95
|
-
/**
|
|
96
|
-
* Create request with JSON payload and automatic retry logic.
|
|
97
|
-
* Retries on network errors and 5xx responses.
|
|
98
|
-
*
|
|
99
|
-
* @param retries - Number of retry attempts (default: 0, retries disabled)
|
|
100
|
-
* @param retryDelay - Initial delay in ms (default: 100)
|
|
101
|
-
*/
|
|
102
|
-
export declare function createRequestWithJsonAndRetry(method: SendMethod, baseUrl: string, urlPath: string, json: unknown, options?: RequestOptionsWithHooks | undefined, retries?: number, retryDelay?: number): Promise<IncomingMessage>;
|
|
103
79
|
/**
|
|
104
80
|
* Check if HTTP response has a successful status code (2xx range).
|
|
105
81
|
* Returns true for status codes between 200-299, false otherwise.
|
|
@@ -109,15 +85,4 @@ export declare function isResponseOk(response: IncomingMessage): boolean;
|
|
|
109
85
|
* Transform artifact data based on authentication status.
|
|
110
86
|
* Filters and compacts response data for public/free-tier users.
|
|
111
87
|
*/
|
|
112
|
-
export declare function reshapeArtifactForPublicPolicy<T extends Record<string, unknown>>(data: T, isAuthenticated: boolean, actions?: string | undefined): T;
|
|
113
|
-
/**
|
|
114
|
-
* Retry helper for HTTP requests with exponential backoff.
|
|
115
|
-
* Wraps any async HTTP function and retries on failure.
|
|
116
|
-
*
|
|
117
|
-
* @param fn - Async function to retry
|
|
118
|
-
* @param retries - Number of retry attempts (default: 0, retries disabled)
|
|
119
|
-
* @param retryDelay - Initial delay in ms (default: 100)
|
|
120
|
-
* @returns Result of the function call
|
|
121
|
-
* @throws {Error} Last error if all retries exhausted
|
|
122
|
-
*/
|
|
123
|
-
export declare function withRetry<T>(fn: () => Promise<T>, retries?: number, retryDelay?: number): Promise<T>;
|
|
88
|
+
export declare function reshapeArtifactForPublicPolicy<T extends Record<string, unknown>>(data: T, isAuthenticated: boolean, actions?: string | undefined, policy?: Map<string, string> | undefined): T;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { createRequestBodyForFilepaths, createRequestBodyForJson, createUploadRe
|
|
|
8
8
|
export { createDeleteRequest, createGetRequest, createRequestWithJson, getErrorResponseBody, getHttpModule, getResponse, getResponseJson, isResponseOk, ResponseError, reshapeArtifactForPublicPolicy, } from './http-client';
|
|
9
9
|
export { calculateTotalQuotaCost, getAllMethodRequirements, getMethodRequirements, getMethodsByPermissions, getMethodsByQuotaCost, getQuotaCost, getQuotaUsageSummary, getRequiredPermissions, hasQuotaForMethods, } from './quota-utils';
|
|
10
10
|
export { SocketSdk } from './socket-sdk-class';
|
|
11
|
-
export type { ALERT_ACTION, ALERT_TYPE, Agent, ArtifactPatches, BatchPackageFetchResultType, BatchPackageStreamOptions, CompactSocketArtifact, CompactSocketArtifactAlert, CreateDependenciesSnapshotOptions,
|
|
11
|
+
export type { ALERT_ACTION, ALERT_TYPE, Agent, ArtifactPatches, BatchPackageFetchResultType, BatchPackageStreamOptions, CompactSocketArtifact, CompactSocketArtifactAlert, CreateDependenciesSnapshotOptions, CustomResponseType, Entitlement, EntitlementsResponse, FileValidationCallback, FileValidationResult, GetOptions, GotOptions, HeadersRecord, MalwareCheckAlert, MalwareCheckPackage, MalwareCheckResult, MalwareCheckScore, PatchFile, PatchRecord, PatchViewResponse, TelemetryConfig, PostOrgTelemetryPayload, PostOrgTelemetryResponse, QueryParams, RequestInfo, RequestOptions, RequestOptionsWithHooks, ResponseInfo, SecurityAlert, SendMethod, SendOptions, SocketArtifact, SocketArtifactAlert, SocketArtifactWithExtras, SocketId, SocketMetricSchema, SocketSdkArrayElement, SocketSdkData, SocketSdkErrorResult, SocketSdkGenericResult, SocketSdkOperations, SocketSdkOptions, SocketSdkResult, SocketSdkSuccessResult, StreamOrgFullScanOptions, UploadManifestFilesError, UploadManifestFilesOptions, UploadManifestFilesResponse, UploadManifestFilesReturnType, Vulnerability, } from './types';
|
|
12
12
|
export type { CreateFullScanOptions, DeleteRepositoryLabelResult, DeleteResult, FullScanItem, FullScanListData, FullScanListResult, FullScanResult, GetRepositoryOptions, ListFullScansOptions, ListRepositoriesOptions, OrganizationItem, OrganizationsResult, RepositoriesListData, RepositoriesListResult, RepositoryItem, RepositoryLabelItem, RepositoryLabelResult, RepositoryLabelsListData, RepositoryLabelsListResult, RepositoryListItem, RepositoryResult, StreamFullScanOptions, StrictErrorResult, StrictResult, } from './types-strict';
|
|
13
13
|
export { createUserAgentFromPkgJson } from './user-agent';
|
|
14
14
|
export { calculateWordSetSimilarity, filterRedundantCause, normalizeBaseUrl, promiseWithResolvers, queryToSearchParams, resolveAbsPaths, resolveBasePath, shouldOmitReason, };
|
package/dist/index.js
CHANGED
|
@@ -71,7 +71,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
71
71
|
// package.json
|
|
72
72
|
var package_default = {
|
|
73
73
|
name: "@socketsecurity/sdk",
|
|
74
|
-
version: "3.
|
|
74
|
+
version: "3.5.0",
|
|
75
75
|
description: "SDK for the Socket API client",
|
|
76
76
|
homepage: "https://github.com/SocketDev/socket-sdk-js",
|
|
77
77
|
license: "MIT",
|
|
@@ -130,16 +130,18 @@ var package_default = {
|
|
|
130
130
|
publish: "node scripts/publish.mjs",
|
|
131
131
|
"publish:ci": "node scripts/publish.mjs --tag ${DIST_TAG:-latest}",
|
|
132
132
|
claude: "node scripts/claude.mjs",
|
|
133
|
+
security: "agentshield scan && { command -v zizmor >/dev/null && zizmor .github/ || echo 'zizmor not installed \u2014 run pnpm run setup to install'; }",
|
|
133
134
|
test: "node scripts/test.mjs",
|
|
134
135
|
type: "tsgo --noEmit -p .config/tsconfig.check.json",
|
|
135
136
|
update: "node scripts/update.mjs"
|
|
136
137
|
},
|
|
137
138
|
dependencies: {
|
|
138
|
-
"@socketregistry/packageurl-js": "1.
|
|
139
|
-
"@socketsecurity/lib": "5.
|
|
139
|
+
"@socketregistry/packageurl-js": "1.4.1",
|
|
140
|
+
"@socketsecurity/lib": "5.11.4",
|
|
140
141
|
"form-data": "4.0.5"
|
|
141
142
|
},
|
|
142
143
|
devDependencies: {
|
|
144
|
+
"@anthropic-ai/claude-code": "2.1.89",
|
|
143
145
|
"@babel/generator": "7.28.5",
|
|
144
146
|
"@babel/parser": "7.26.3",
|
|
145
147
|
"@babel/traverse": "7.26.4",
|
|
@@ -154,6 +156,7 @@ var package_default = {
|
|
|
154
156
|
acorn: "8.15.0",
|
|
155
157
|
del: "8.0.1",
|
|
156
158
|
"dev-null-cli": "2.0.0",
|
|
159
|
+
"ecc-agentshield": "1.4.0",
|
|
157
160
|
esbuild: "0.25.11",
|
|
158
161
|
"fast-glob": "3.3.3",
|
|
159
162
|
"http2-wrapper": "2.2.1",
|
|
@@ -180,10 +183,10 @@ var package_default = {
|
|
|
180
183
|
strict: true
|
|
181
184
|
},
|
|
182
185
|
engines: {
|
|
183
|
-
node: ">=18",
|
|
184
|
-
pnpm: ">=10.
|
|
186
|
+
node: ">=18.20.8",
|
|
187
|
+
pnpm: ">=10.33.0"
|
|
185
188
|
},
|
|
186
|
-
packageManager: "pnpm@10.
|
|
189
|
+
packageManager: "pnpm@10.33.0",
|
|
187
190
|
pnpm: {
|
|
188
191
|
ignoredBuiltDependencies: [
|
|
189
192
|
"esbuild",
|
|
@@ -216,6 +219,8 @@ var MIN_HTTP_TIMEOUT = 5e3;
|
|
|
216
219
|
var MAX_RESPONSE_SIZE = 10 * 1024 * 1024;
|
|
217
220
|
var MAX_STREAM_SIZE = 100 * 1024 * 1024;
|
|
218
221
|
var SOCKET_PUBLIC_BLOB_STORE_URL = "https://socketusercontent.com";
|
|
222
|
+
var MAX_FIREWALL_COMPONENTS = 8;
|
|
223
|
+
var SOCKET_FIREWALL_API_URL = "https://firewall-api.socket.dev/purl";
|
|
219
224
|
var httpAgentNames = /* @__PURE__ */ new Set(["http", "https", "http2"]);
|
|
220
225
|
var publicPolicy = /* @__PURE__ */ new Map([
|
|
221
226
|
// error (1):
|
|
@@ -327,6 +332,7 @@ var publicPolicy = /* @__PURE__ */ new Map([
|
|
|
327
332
|
|
|
328
333
|
// src/utils.ts
|
|
329
334
|
var import_node_path = __toESM(require("node:path"));
|
|
335
|
+
var import_node_process = __toESM(require("node:process"));
|
|
330
336
|
var import_memoization = require("@socketsecurity/lib/memoization");
|
|
331
337
|
var import_normalize = require("@socketsecurity/lib/paths/normalize");
|
|
332
338
|
function normalizeToWordSet(s) {
|
|
@@ -405,7 +411,7 @@ function resolveAbsPaths(filepaths, pathsRelativeTo) {
|
|
|
405
411
|
return filepaths.map((p) => (0, import_normalize.normalizePath)(import_node_path.default.resolve(basePath, p)));
|
|
406
412
|
}
|
|
407
413
|
function resolveBasePath(pathsRelativeTo = ".") {
|
|
408
|
-
return (0, import_normalize.normalizePath)(import_node_path.default.resolve(
|
|
414
|
+
return (0, import_normalize.normalizePath)(import_node_path.default.resolve(import_node_process.default.cwd(), pathsRelativeTo));
|
|
409
415
|
}
|
|
410
416
|
function shouldOmitReason(errorMessage, reason, threshold = 0.6) {
|
|
411
417
|
if (!reason || !reason.trim()) {
|
|
@@ -803,9 +809,10 @@ function isResponseOk(response) {
|
|
|
803
809
|
const { statusCode } = response;
|
|
804
810
|
return statusCode ? statusCode >= 200 && statusCode < 300 : false;
|
|
805
811
|
}
|
|
806
|
-
function reshapeArtifactForPublicPolicy(data, isAuthenticated, actions) {
|
|
812
|
+
function reshapeArtifactForPublicPolicy(data, isAuthenticated, actions, policy) {
|
|
807
813
|
if (!isAuthenticated) {
|
|
808
814
|
const allowedActions = actions?.trim() ? actions.split(",") : void 0;
|
|
815
|
+
const resolvedPolicy = policy ?? publicPolicy;
|
|
809
816
|
const reshapeArtifact = (artifact) => ({
|
|
810
817
|
name: artifact.name,
|
|
811
818
|
version: artifact.version,
|
|
@@ -818,17 +825,19 @@ function reshapeArtifactForPublicPolicy(data, isAuthenticated, actions) {
|
|
|
818
825
|
// Compact the alerts array to reduce response size for non-authenticated
|
|
819
826
|
// requests.
|
|
820
827
|
alerts: artifact.alerts?.filter((alert) => {
|
|
828
|
+
const action = resolvedPolicy.get(alert.type);
|
|
821
829
|
if (alert.severity === "low") {
|
|
822
830
|
return false;
|
|
823
831
|
}
|
|
824
|
-
if (allowedActions &&
|
|
832
|
+
if (allowedActions && action && !allowedActions.includes(action)) {
|
|
825
833
|
return false;
|
|
826
834
|
}
|
|
827
835
|
return true;
|
|
828
836
|
}).map((alert) => ({
|
|
829
|
-
|
|
837
|
+
action: resolvedPolicy.get(alert.type),
|
|
838
|
+
key: alert.key,
|
|
830
839
|
severity: alert.severity,
|
|
831
|
-
|
|
840
|
+
type: alert.type
|
|
832
841
|
}))
|
|
833
842
|
});
|
|
834
843
|
if (data["artifacts"]) {
|
|
@@ -1064,6 +1073,7 @@ function hasQuotaForMethods(availableQuota, methodNames) {
|
|
|
1064
1073
|
var import_node_events = __toESM(require("node:events"));
|
|
1065
1074
|
var import_node_fs3 = require("node:fs");
|
|
1066
1075
|
var import_node_path4 = __toESM(require("node:path"));
|
|
1076
|
+
var import_node_process2 = __toESM(require("node:process"));
|
|
1067
1077
|
var import_node_readline = __toESM(require("node:readline"));
|
|
1068
1078
|
var import_cache_with_ttl = require("@socketsecurity/lib/cache-with-ttl");
|
|
1069
1079
|
var import_core = require("@socketsecurity/lib/constants/core");
|
|
@@ -1077,7 +1087,7 @@ var import_promises = require("@socketsecurity/lib/promises");
|
|
|
1077
1087
|
var import_suppress_warnings = require("@socketsecurity/lib/suppress-warnings");
|
|
1078
1088
|
var import_url = require("@socketsecurity/lib/url");
|
|
1079
1089
|
var abortSignal = (0, import_process.getAbortSignal)();
|
|
1080
|
-
var SocketSdk = class {
|
|
1090
|
+
var SocketSdk = class _SocketSdk {
|
|
1081
1091
|
#apiToken;
|
|
1082
1092
|
#baseUrl;
|
|
1083
1093
|
#cache;
|
|
@@ -1191,11 +1201,12 @@ var SocketSdk = class {
|
|
|
1191
1201
|
);
|
|
1192
1202
|
if ((0, import_objects.isObjectObject)(artifact)) {
|
|
1193
1203
|
yield this.#handleApiSuccess(
|
|
1194
|
-
/* c8 ignore next
|
|
1204
|
+
/* c8 ignore next 8 - Public token artifact reshaping branch for policy compliance. */
|
|
1195
1205
|
isPublicToken ? reshapeArtifactForPublicPolicy(
|
|
1196
1206
|
artifact,
|
|
1197
1207
|
false,
|
|
1198
|
-
queryParams?.["actions"]
|
|
1208
|
+
queryParams?.["actions"],
|
|
1209
|
+
publicPolicy
|
|
1199
1210
|
) : artifact
|
|
1200
1211
|
);
|
|
1201
1212
|
}
|
|
@@ -1336,7 +1347,6 @@ var SocketSdk = class {
|
|
|
1336
1347
|
* Extract text content from HTTP response stream.
|
|
1337
1348
|
* Internal method with size limits to prevent memory exhaustion.
|
|
1338
1349
|
*/
|
|
1339
|
-
/* c8 ignore start - unused utility method reserved for future text response handling */
|
|
1340
1350
|
async #getResponseText(response) {
|
|
1341
1351
|
const chunks = [];
|
|
1342
1352
|
let size = 0;
|
|
@@ -1350,7 +1360,6 @@ var SocketSdk = class {
|
|
|
1350
1360
|
}
|
|
1351
1361
|
return Buffer.concat(chunks).toString("utf8");
|
|
1352
1362
|
}
|
|
1353
|
-
/* c8 ignore stop */
|
|
1354
1363
|
/**
|
|
1355
1364
|
* Handle API error responses and convert to standardized error result.
|
|
1356
1365
|
* Internal error handling with status code analysis and message formatting.
|
|
@@ -1547,14 +1556,17 @@ var SocketSdk = class {
|
|
|
1547
1556
|
const url = `${this.#baseUrl}orgs/${encodeURIComponent(orgSlug)}/purl?${queryToSearchParams(queryParams)}`;
|
|
1548
1557
|
let res;
|
|
1549
1558
|
try {
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1559
|
+
res = await this.#executeWithRetry(async () => {
|
|
1560
|
+
const req = getHttpModule(this.#baseUrl).request(url, {
|
|
1561
|
+
method: "POST",
|
|
1562
|
+
...this.#reqOptions
|
|
1563
|
+
}).end(JSON.stringify(componentsObj));
|
|
1564
|
+
const response = await getResponse(req);
|
|
1565
|
+
if (!isResponseOk(response)) {
|
|
1566
|
+
throw new ResponseError(response, "POST Request failed", url);
|
|
1567
|
+
}
|
|
1568
|
+
return response;
|
|
1569
|
+
});
|
|
1558
1570
|
} catch (e) {
|
|
1559
1571
|
return await this.#handleApiError(e);
|
|
1560
1572
|
}
|
|
@@ -1620,11 +1632,12 @@ var SocketSdk = class {
|
|
|
1620
1632
|
);
|
|
1621
1633
|
if ((0, import_objects.isObjectObject)(artifact)) {
|
|
1622
1634
|
results.push(
|
|
1623
|
-
/* c8 ignore next
|
|
1635
|
+
/* c8 ignore next 8 - Public token artifact reshaping for policy compliance. */
|
|
1624
1636
|
isPublicToken ? reshapeArtifactForPublicPolicy(
|
|
1625
1637
|
artifact,
|
|
1626
1638
|
false,
|
|
1627
|
-
queryParams?.["actions"]
|
|
1639
|
+
queryParams?.["actions"],
|
|
1640
|
+
publicPolicy
|
|
1628
1641
|
) : artifact
|
|
1629
1642
|
);
|
|
1630
1643
|
}
|
|
@@ -1713,6 +1726,111 @@ var SocketSdk = class {
|
|
|
1713
1726
|
}
|
|
1714
1727
|
}
|
|
1715
1728
|
}
|
|
1729
|
+
/**
|
|
1730
|
+
* Check packages for malware and security alerts.
|
|
1731
|
+
*
|
|
1732
|
+
* For small sets (≤ MAX_FIREWALL_COMPONENTS), uses parallel firewall API
|
|
1733
|
+
* requests which return full artifact data including score and alert details.
|
|
1734
|
+
*
|
|
1735
|
+
* For larger sets, uses the batch PURL API for efficiency.
|
|
1736
|
+
*
|
|
1737
|
+
* Both paths normalize alerts through publicPolicy and only return
|
|
1738
|
+
* malware-relevant results.
|
|
1739
|
+
*
|
|
1740
|
+
* @param components - Array of package URLs to check
|
|
1741
|
+
* @returns Normalized results with policy-filtered alerts per package
|
|
1742
|
+
*/
|
|
1743
|
+
async checkMalware(components) {
|
|
1744
|
+
if (components.length <= MAX_FIREWALL_COMPONENTS) {
|
|
1745
|
+
return this.#checkMalwareFirewall(components);
|
|
1746
|
+
}
|
|
1747
|
+
return this.#checkMalwareBatch(components);
|
|
1748
|
+
}
|
|
1749
|
+
// Small-set path: parallel firewall API requests per PURL.
|
|
1750
|
+
// Returns full artifact data (score, alert props, categories, fix info).
|
|
1751
|
+
async #checkMalwareFirewall(components) {
|
|
1752
|
+
const packages = [];
|
|
1753
|
+
const results = await Promise.allSettled(
|
|
1754
|
+
components.map(async ({ purl }) => {
|
|
1755
|
+
const urlPath = `/${encodeURIComponent(purl)}`;
|
|
1756
|
+
const response = await createGetRequest(
|
|
1757
|
+
SOCKET_FIREWALL_API_URL,
|
|
1758
|
+
urlPath,
|
|
1759
|
+
this.#reqOptions
|
|
1760
|
+
);
|
|
1761
|
+
if (!isResponseOk(response)) return void 0;
|
|
1762
|
+
const json = await getResponseJson(response);
|
|
1763
|
+
return json;
|
|
1764
|
+
})
|
|
1765
|
+
);
|
|
1766
|
+
for (const settled of results) {
|
|
1767
|
+
if (settled.status === "rejected" || !settled.value) continue;
|
|
1768
|
+
packages.push(_SocketSdk.#normalizeArtifact(settled.value, publicPolicy));
|
|
1769
|
+
}
|
|
1770
|
+
return {
|
|
1771
|
+
cause: void 0,
|
|
1772
|
+
data: packages,
|
|
1773
|
+
error: void 0,
|
|
1774
|
+
status: 200,
|
|
1775
|
+
success: true
|
|
1776
|
+
};
|
|
1777
|
+
}
|
|
1778
|
+
// Multi-component path: batch PURL API request, normalized to publicPolicy.
|
|
1779
|
+
async #checkMalwareBatch(components) {
|
|
1780
|
+
const result = await this.batchPackageFetch(
|
|
1781
|
+
{ components },
|
|
1782
|
+
{ alerts: true, cachedResultsOnly: true }
|
|
1783
|
+
);
|
|
1784
|
+
if (!result.success) {
|
|
1785
|
+
return {
|
|
1786
|
+
cause: result.cause,
|
|
1787
|
+
data: void 0,
|
|
1788
|
+
error: result.error,
|
|
1789
|
+
status: result.status,
|
|
1790
|
+
success: false
|
|
1791
|
+
};
|
|
1792
|
+
}
|
|
1793
|
+
const packages = [];
|
|
1794
|
+
for (const artifact of result.data) {
|
|
1795
|
+
packages.push(_SocketSdk.#normalizeArtifact(artifact, publicPolicy));
|
|
1796
|
+
}
|
|
1797
|
+
return {
|
|
1798
|
+
cause: void 0,
|
|
1799
|
+
data: packages,
|
|
1800
|
+
error: void 0,
|
|
1801
|
+
status: 200,
|
|
1802
|
+
success: true
|
|
1803
|
+
};
|
|
1804
|
+
}
|
|
1805
|
+
// Normalize an artifact into MalwareCheckPackage.
|
|
1806
|
+
// When policy is provided, derive action from the map.
|
|
1807
|
+
// When policy is undefined, use server-assigned alert.action.
|
|
1808
|
+
static #normalizeArtifact(artifact, policy) {
|
|
1809
|
+
const alerts = [];
|
|
1810
|
+
if (artifact.alerts) {
|
|
1811
|
+
for (const alert of artifact.alerts) {
|
|
1812
|
+
const action = policy ? policy.get(alert.type) ?? "ignore" : alert.action ?? "ignore";
|
|
1813
|
+
if (action === "error" || action === "warn") {
|
|
1814
|
+
alerts.push({
|
|
1815
|
+
category: alert.category,
|
|
1816
|
+
fix: alert.fix ? { description: alert.fix.description, type: alert.fix.type } : void 0,
|
|
1817
|
+
key: alert.key,
|
|
1818
|
+
props: alert.props,
|
|
1819
|
+
severity: alert.severity,
|
|
1820
|
+
type: alert.type
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
return {
|
|
1826
|
+
alerts,
|
|
1827
|
+
name: artifact.name,
|
|
1828
|
+
namespace: artifact.namespace,
|
|
1829
|
+
score: artifact.score,
|
|
1830
|
+
type: artifact.type,
|
|
1831
|
+
version: artifact.version
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1716
1834
|
/**
|
|
1717
1835
|
* Create a snapshot of project dependencies by uploading manifest files.
|
|
1718
1836
|
* Analyzes dependency files to generate a comprehensive security report.
|
|
@@ -2367,41 +2485,31 @@ var SocketSdk = class {
|
|
|
2367
2485
|
}
|
|
2368
2486
|
}
|
|
2369
2487
|
/**
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
* @param options.baseUrl - Override blob store URL (for testing)
|
|
2382
|
-
* @returns Promise<string> - The patch file content as UTF-8 string
|
|
2383
|
-
* @throws Error if blob not found (404) or download fails
|
|
2384
|
-
*
|
|
2385
|
-
* @example
|
|
2386
|
-
* ```typescript
|
|
2387
|
-
* const sdk = new SocketSdk('your-api-token')
|
|
2388
|
-
* // First get patch metadata
|
|
2389
|
-
* const patch = await sdk.viewPatch('my-org', 'patch-uuid')
|
|
2390
|
-
* // Then download the actual patched file
|
|
2391
|
-
* const fileContent = await sdk.downloadPatch(patch.files['index.js'].socketBlob)
|
|
2392
|
-
* ```
|
|
2393
|
-
*/
|
|
2488
|
+
* Download full scan files as a tar archive.
|
|
2489
|
+
*
|
|
2490
|
+
* Streams the full scan file contents to the specified output path as a tar file.
|
|
2491
|
+
* Includes size limit enforcement to prevent excessive disk usage.
|
|
2492
|
+
*
|
|
2493
|
+
* @param orgSlug - Organization identifier
|
|
2494
|
+
* @param fullScanId - Full scan identifier
|
|
2495
|
+
* @param outputPath - Local file path to write the tar archive
|
|
2496
|
+
* @returns Download result with success/error status
|
|
2497
|
+
* @throws {Error} When server returns 5xx status codes
|
|
2498
|
+
*/
|
|
2394
2499
|
async downloadOrgFullScanFilesAsTar(orgSlug, fullScanId, outputPath) {
|
|
2395
2500
|
const url = `${this.#baseUrl}orgs/${encodeURIComponent(orgSlug)}/full-scans/${encodeURIComponent(fullScanId)}/files.tar`;
|
|
2396
2501
|
try {
|
|
2397
|
-
const
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2502
|
+
const res = await this.#executeWithRetry(async () => {
|
|
2503
|
+
const req = getHttpModule(this.#baseUrl).request(url, {
|
|
2504
|
+
method: "GET",
|
|
2505
|
+
...this.#reqOptions
|
|
2506
|
+
}).end();
|
|
2507
|
+
const response = await getResponse(req);
|
|
2508
|
+
if (!isResponseOk(response)) {
|
|
2509
|
+
throw new ResponseError(response, "", url);
|
|
2510
|
+
}
|
|
2511
|
+
return response;
|
|
2512
|
+
});
|
|
2405
2513
|
const writeStream = (0, import_node_fs3.createWriteStream)(outputPath);
|
|
2406
2514
|
let bytesWritten = 0;
|
|
2407
2515
|
res.on("data", (chunk) => {
|
|
@@ -2637,26 +2745,16 @@ var SocketSdk = class {
|
|
|
2637
2745
|
};
|
|
2638
2746
|
const url = `${this.#baseUrl}${urlPath}`;
|
|
2639
2747
|
try {
|
|
2640
|
-
const response = await
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
if (
|
|
2646
|
-
throw new ResponseError(
|
|
2748
|
+
const response = await this.#executeWithRetry(async () => {
|
|
2749
|
+
const res = await createGetRequest(this.#baseUrl, urlPath, {
|
|
2750
|
+
...this.#reqOptions,
|
|
2751
|
+
hooks: this.#hooks
|
|
2752
|
+
});
|
|
2753
|
+
if (!isResponseOk(res)) {
|
|
2754
|
+
throw new ResponseError(res, "", url);
|
|
2647
2755
|
}
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
);
|
|
2651
|
-
return {
|
|
2652
|
-
cause: errorResult.cause,
|
|
2653
|
-
data: void 0,
|
|
2654
|
-
error: errorResult.error,
|
|
2655
|
-
status: errorResult.status,
|
|
2656
|
-
success: false,
|
|
2657
|
-
url: errorResult.url
|
|
2658
|
-
};
|
|
2659
|
-
}
|
|
2756
|
+
return res;
|
|
2757
|
+
});
|
|
2660
2758
|
const data = await this.#handleQueryResponseData(
|
|
2661
2759
|
response,
|
|
2662
2760
|
responseType
|
|
@@ -2683,7 +2781,8 @@ var SocketSdk = class {
|
|
|
2683
2781
|
data: void 0,
|
|
2684
2782
|
error: errorResult.error,
|
|
2685
2783
|
status: errorResult.status,
|
|
2686
|
-
success: false
|
|
2784
|
+
success: false,
|
|
2785
|
+
url: errorResult.url
|
|
2687
2786
|
};
|
|
2688
2787
|
}
|
|
2689
2788
|
return this.#createQueryErrorResult(e);
|
|
@@ -2800,7 +2899,7 @@ var SocketSdk = class {
|
|
|
2800
2899
|
/**
|
|
2801
2900
|
* Retrieve the enabled entitlements for an organization.
|
|
2802
2901
|
*
|
|
2803
|
-
* This method fetches the organization's entitlements and filters for only
|
|
2902
|
+
* This method fetches the organization's entitlements and filters for only the enabled ones, returning their keys. Entitlements represent Socket
|
|
2804
2903
|
* Products that the organization has access to use.
|
|
2805
2904
|
*/
|
|
2806
2905
|
async getEnabledEntitlements(orgSlug) {
|
|
@@ -3086,7 +3185,8 @@ var SocketSdk = class {
|
|
|
3086
3185
|
}
|
|
3087
3186
|
}
|
|
3088
3187
|
/**
|
|
3089
|
-
* Get organization's license policy configuration
|
|
3188
|
+
* Get organization's license policy configuration.
|
|
3189
|
+
* Returns allowed, restricted, and monitored license types.
|
|
3090
3190
|
*
|
|
3091
3191
|
* @throws {Error} When server returns 5xx status codes
|
|
3092
3192
|
*/
|
|
@@ -3107,7 +3207,8 @@ var SocketSdk = class {
|
|
|
3107
3207
|
}
|
|
3108
3208
|
}
|
|
3109
3209
|
/**
|
|
3110
|
-
* Get organization's security policy configuration
|
|
3210
|
+
* Get organization's security policy configuration.
|
|
3211
|
+
* Returns alert rules, severity thresholds, and enforcement settings.
|
|
3111
3212
|
*
|
|
3112
3213
|
* @throws {Error} When server returns 5xx status codes
|
|
3113
3214
|
*/
|
|
@@ -3272,36 +3373,32 @@ var SocketSdk = class {
|
|
|
3272
3373
|
}
|
|
3273
3374
|
}
|
|
3274
3375
|
/**
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
* @quota 0 units
|
|
3302
|
-
* @scopes repo:read
|
|
3303
|
-
* @throws {Error} When server returns 5xx status codes
|
|
3304
|
-
*/
|
|
3376
|
+
* Get details for a specific repository.
|
|
3377
|
+
*
|
|
3378
|
+
* Returns repository configuration, monitoring status, and metadata.
|
|
3379
|
+
*
|
|
3380
|
+
* @param orgSlug - Organization identifier
|
|
3381
|
+
* @param repoSlug - Repository slug/name
|
|
3382
|
+
* @param options - Optional parameters including workspace
|
|
3383
|
+
* @returns Repository details with configuration
|
|
3384
|
+
*
|
|
3385
|
+
* @example
|
|
3386
|
+
* ```typescript
|
|
3387
|
+
* const result = await sdk.getRepository('my-org', 'my-repo')
|
|
3388
|
+
*
|
|
3389
|
+
* if (result.success) {
|
|
3390
|
+
* console.log('Repository:', result.data.name)
|
|
3391
|
+
* console.log('Visibility:', result.data.visibility)
|
|
3392
|
+
* console.log('Default branch:', result.data.default_branch)
|
|
3393
|
+
* }
|
|
3394
|
+
* ```
|
|
3395
|
+
*
|
|
3396
|
+
* @see https://docs.socket.dev/reference/getorgrepo
|
|
3397
|
+
* @apiEndpoint GET /orgs/{org_slug}/repos/{repo_slug}
|
|
3398
|
+
* @quota 0 units
|
|
3399
|
+
* @scopes repo:read
|
|
3400
|
+
* @throws {Error} When server returns 5xx status codes
|
|
3401
|
+
*/
|
|
3305
3402
|
async getRepository(orgSlug, repoSlug, options) {
|
|
3306
3403
|
const orgSlugParam = encodeURIComponent(orgSlug);
|
|
3307
3404
|
const repoSlugParam = encodeURIComponent(repoSlug);
|
|
@@ -3860,7 +3957,7 @@ var SocketSdk = class {
|
|
|
3860
3957
|
success: true
|
|
3861
3958
|
};
|
|
3862
3959
|
} catch (e) {
|
|
3863
|
-
return this.#
|
|
3960
|
+
return await this.#handleApiError(e);
|
|
3864
3961
|
}
|
|
3865
3962
|
}
|
|
3866
3963
|
/**
|
|
@@ -3977,14 +4074,21 @@ var SocketSdk = class {
|
|
|
3977
4074
|
method = "POST",
|
|
3978
4075
|
throws = true
|
|
3979
4076
|
} = { __proto__: null, ...options };
|
|
4077
|
+
const url = `${this.#baseUrl}${urlPath}`;
|
|
3980
4078
|
try {
|
|
3981
|
-
const response = await
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
4079
|
+
const response = await this.#executeWithRetry(async () => {
|
|
4080
|
+
const res = await createRequestWithJson(
|
|
4081
|
+
method,
|
|
4082
|
+
this.#baseUrl,
|
|
4083
|
+
urlPath,
|
|
4084
|
+
body,
|
|
4085
|
+
{ ...this.#reqOptions, hooks: this.#hooks }
|
|
4086
|
+
);
|
|
4087
|
+
if (!isResponseOk(res)) {
|
|
4088
|
+
throw new ResponseError(res, "", url);
|
|
4089
|
+
}
|
|
4090
|
+
return res;
|
|
4091
|
+
});
|
|
3988
4092
|
const data = await getResponseJson(response);
|
|
3989
4093
|
if (throws) {
|
|
3990
4094
|
return data;
|
|
@@ -4008,17 +4112,11 @@ var SocketSdk = class {
|
|
|
4008
4112
|
data: void 0,
|
|
4009
4113
|
error: errorResult.error,
|
|
4010
4114
|
status: errorResult.status,
|
|
4011
|
-
success: false
|
|
4115
|
+
success: false,
|
|
4116
|
+
url: errorResult.url
|
|
4012
4117
|
};
|
|
4013
4118
|
}
|
|
4014
|
-
|
|
4015
|
-
return {
|
|
4016
|
-
cause: errStr || import_core.UNKNOWN_ERROR,
|
|
4017
|
-
data: void 0,
|
|
4018
|
-
error: "API request failed",
|
|
4019
|
-
status: 0,
|
|
4020
|
-
success: false
|
|
4021
|
-
};
|
|
4119
|
+
return this.#createQueryErrorResult(e);
|
|
4022
4120
|
}
|
|
4023
4121
|
}
|
|
4024
4122
|
/**
|
|
@@ -4061,14 +4159,17 @@ var SocketSdk = class {
|
|
|
4061
4159
|
};
|
|
4062
4160
|
const url = `${this.#baseUrl}orgs/${encodeURIComponent(orgSlug)}/full-scans/${encodeURIComponent(scanId)}`;
|
|
4063
4161
|
try {
|
|
4064
|
-
const
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4162
|
+
const res = await this.#executeWithRetry(async () => {
|
|
4163
|
+
const req = getHttpModule(this.#baseUrl).request(url, {
|
|
4164
|
+
method: "GET",
|
|
4165
|
+
...this.#reqOptions
|
|
4166
|
+
}).end();
|
|
4167
|
+
const response = await getResponse(req);
|
|
4168
|
+
if (!isResponseOk(response)) {
|
|
4169
|
+
throw new ResponseError(response, "", url);
|
|
4170
|
+
}
|
|
4171
|
+
return response;
|
|
4172
|
+
});
|
|
4072
4173
|
if (typeof output === "string") {
|
|
4073
4174
|
const writeStream = (0, import_node_fs3.createWriteStream)(output);
|
|
4074
4175
|
let bytesWritten = 0;
|
|
@@ -4103,15 +4204,15 @@ var SocketSdk = class {
|
|
|
4103
4204
|
});
|
|
4104
4205
|
const stdoutErrorHandler = (_error) => {
|
|
4105
4206
|
res.destroy();
|
|
4106
|
-
|
|
4207
|
+
import_node_process2.default.stdout.removeListener("error", stdoutErrorHandler);
|
|
4107
4208
|
};
|
|
4108
|
-
|
|
4109
|
-
res.pipe(
|
|
4209
|
+
import_node_process2.default.stdout.on("error", stdoutErrorHandler);
|
|
4210
|
+
res.pipe(import_node_process2.default.stdout);
|
|
4110
4211
|
res.on("end", () => {
|
|
4111
|
-
|
|
4212
|
+
import_node_process2.default.stdout.removeListener("error", stdoutErrorHandler);
|
|
4112
4213
|
});
|
|
4113
4214
|
res.on("error", () => {
|
|
4114
|
-
|
|
4215
|
+
import_node_process2.default.stdout.removeListener("error", stdoutErrorHandler);
|
|
4115
4216
|
});
|
|
4116
4217
|
}
|
|
4117
4218
|
return this.#handleApiSuccess(res);
|
|
@@ -4196,7 +4297,8 @@ var SocketSdk = class {
|
|
|
4196
4297
|
}
|
|
4197
4298
|
}
|
|
4198
4299
|
/**
|
|
4199
|
-
* Update organization's license policy configuration
|
|
4300
|
+
* Update organization's license policy configuration.
|
|
4301
|
+
* Modifies allowed, restricted, and monitored license types.
|
|
4200
4302
|
*
|
|
4201
4303
|
* @throws {Error} When server returns 5xx status codes
|
|
4202
4304
|
*/
|
|
@@ -4219,7 +4321,8 @@ var SocketSdk = class {
|
|
|
4219
4321
|
}
|
|
4220
4322
|
}
|
|
4221
4323
|
/**
|
|
4222
|
-
* Update organization's security policy configuration
|
|
4324
|
+
* Update organization's security policy configuration.
|
|
4325
|
+
* Modifies alert rules, severity thresholds, and enforcement settings.
|
|
4223
4326
|
*
|
|
4224
4327
|
* @throws {Error} When server returns 5xx status codes
|
|
4225
4328
|
*/
|
|
@@ -4514,18 +4617,25 @@ var SocketSdk = class {
|
|
|
4514
4617
|
* vulnerabilities, description, license, and tier information.
|
|
4515
4618
|
*/
|
|
4516
4619
|
async viewPatch(orgSlug, uuid) {
|
|
4517
|
-
|
|
4518
|
-
await
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4620
|
+
try {
|
|
4621
|
+
const data = await this.#executeWithRetry(
|
|
4622
|
+
async () => await getResponseJson(
|
|
4623
|
+
await createGetRequest(
|
|
4624
|
+
this.#baseUrl,
|
|
4625
|
+
`orgs/${encodeURIComponent(orgSlug)}/patches/view/${encodeURIComponent(uuid)}`,
|
|
4626
|
+
{ ...this.#reqOptions, hooks: this.#hooks }
|
|
4627
|
+
)
|
|
4628
|
+
)
|
|
4629
|
+
);
|
|
4630
|
+
return data;
|
|
4631
|
+
} catch (e) {
|
|
4632
|
+
const result = await this.#handleApiError(e);
|
|
4633
|
+
throw new Error(result.error, { cause: result.cause });
|
|
4634
|
+
}
|
|
4525
4635
|
}
|
|
4526
4636
|
};
|
|
4527
4637
|
if ((0, import_debug2.isDebugNs)("heap")) {
|
|
4528
|
-
const used =
|
|
4638
|
+
const used = import_node_process2.default.memoryUsage();
|
|
4529
4639
|
(0, import_debug2.debugLog)("heap", `heap used: ${Math.round(used.heapUsed / 1024 / 1024)}MB`);
|
|
4530
4640
|
}
|
|
4531
4641
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ArtifactPatches, BatchPackageFetchResultType, BatchPackageStreamOptions, CreateDependenciesSnapshotOptions, Entitlement, GetOptions, PatchViewResponse, PostOrgTelemetryPayload, PostOrgTelemetryResponse, QueryParams, SendOptions, SocketSdkGenericResult, SocketSdkOptions, SocketSdkResult, StreamOrgFullScanOptions, UploadManifestFilesError, UploadManifestFilesOptions, UploadManifestFilesReturnType } from './types';
|
|
1
|
+
import type { ArtifactPatches, BatchPackageFetchResultType, BatchPackageStreamOptions, CreateDependenciesSnapshotOptions, Entitlement, GetOptions, MalwareCheckResult, PatchViewResponse, PostOrgTelemetryPayload, PostOrgTelemetryResponse, QueryParams, SendOptions, SocketSdkGenericResult, SocketSdkOptions, SocketSdkResult, StreamOrgFullScanOptions, UploadManifestFilesError, UploadManifestFilesOptions, UploadManifestFilesReturnType } from './types';
|
|
2
2
|
import type { CreateFullScanOptions, DeleteRepositoryLabelResult, DeleteResult, FullScanListResult, FullScanResult, GetRepositoryOptions, ListFullScansOptions, ListRepositoriesOptions, OrganizationsResult, RepositoriesListResult, RepositoryLabelResult, RepositoryLabelsListResult, RepositoryResult, StrictErrorResult } from './types-strict';
|
|
3
3
|
import type { IncomingMessage } from 'node:http';
|
|
4
4
|
/**
|
|
@@ -73,6 +73,23 @@ export declare class SocketSdk {
|
|
|
73
73
|
purl: string;
|
|
74
74
|
}>;
|
|
75
75
|
}, options?: BatchPackageStreamOptions | undefined): AsyncGenerator<BatchPackageFetchResultType>;
|
|
76
|
+
/**
|
|
77
|
+
* Check packages for malware and security alerts.
|
|
78
|
+
*
|
|
79
|
+
* For small sets (≤ MAX_FIREWALL_COMPONENTS), uses parallel firewall API
|
|
80
|
+
* requests which return full artifact data including score and alert details.
|
|
81
|
+
*
|
|
82
|
+
* For larger sets, uses the batch PURL API for efficiency.
|
|
83
|
+
*
|
|
84
|
+
* Both paths normalize alerts through publicPolicy and only return
|
|
85
|
+
* malware-relevant results.
|
|
86
|
+
*
|
|
87
|
+
* @param components - Array of package URLs to check
|
|
88
|
+
* @returns Normalized results with policy-filtered alerts per package
|
|
89
|
+
*/
|
|
90
|
+
checkMalware(components: Array<{
|
|
91
|
+
purl: string;
|
|
92
|
+
}>): Promise<SocketSdkGenericResult<MalwareCheckResult>>;
|
|
76
93
|
/**
|
|
77
94
|
* Create a snapshot of project dependencies by uploading manifest files.
|
|
78
95
|
* Analyzes dependency files to generate a comprehensive security report.
|
|
@@ -368,29 +385,16 @@ export declare class SocketSdk {
|
|
|
368
385
|
*/
|
|
369
386
|
deleteRepositoryLabel(orgSlug: string, labelId: string): Promise<DeleteRepositoryLabelResult | StrictErrorResult>;
|
|
370
387
|
/**
|
|
371
|
-
*
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* Download patch file content by hash.
|
|
388
|
+
* Download full scan files as a tar archive.
|
|
375
389
|
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
* No authentication is required as patch blobs are publicly accessible.
|
|
379
|
-
*
|
|
380
|
-
* @param hash - The blob hash in SSRI (sha256-base64) or hex format
|
|
381
|
-
* @param options - Optional configuration
|
|
382
|
-
* @param options.baseUrl - Override blob store URL (for testing)
|
|
383
|
-
* @returns Promise<string> - The patch file content as UTF-8 string
|
|
384
|
-
* @throws Error if blob not found (404) or download fails
|
|
390
|
+
* Streams the full scan file contents to the specified output path as a tar file.
|
|
391
|
+
* Includes size limit enforcement to prevent excessive disk usage.
|
|
385
392
|
*
|
|
386
|
-
* @
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
* // Then download the actual patched file
|
|
392
|
-
* const fileContent = await sdk.downloadPatch(patch.files['index.js'].socketBlob)
|
|
393
|
-
* ```
|
|
393
|
+
* @param orgSlug - Organization identifier
|
|
394
|
+
* @param fullScanId - Full scan identifier
|
|
395
|
+
* @param outputPath - Local file path to write the tar archive
|
|
396
|
+
* @returns Download result with success/error status
|
|
397
|
+
* @throws {Error} When server returns 5xx status codes
|
|
394
398
|
*/
|
|
395
399
|
downloadOrgFullScanFilesAsTar(orgSlug: string, fullScanId: string, outputPath: string): Promise<SocketSdkResult<'downloadOrgFullScanFilesAsTar'>>;
|
|
396
400
|
/**
|
|
@@ -526,7 +530,7 @@ export declare class SocketSdk {
|
|
|
526
530
|
/**
|
|
527
531
|
* Retrieve the enabled entitlements for an organization.
|
|
528
532
|
*
|
|
529
|
-
* This method fetches the organization's entitlements and filters for only
|
|
533
|
+
* This method fetches the organization's entitlements and filters for only the enabled ones, returning their keys. Entitlements represent Socket
|
|
530
534
|
* Products that the organization has access to use.
|
|
531
535
|
*/
|
|
532
536
|
getEnabledEntitlements(orgSlug: string): Promise<string[]>;
|
|
@@ -713,13 +717,15 @@ export declare class SocketSdk {
|
|
|
713
717
|
vulnerability_ids: string;
|
|
714
718
|
}): Promise<SocketSdkResult<'fetch-fixes'>>;
|
|
715
719
|
/**
|
|
716
|
-
* Get organization's license policy configuration
|
|
720
|
+
* Get organization's license policy configuration.
|
|
721
|
+
* Returns allowed, restricted, and monitored license types.
|
|
717
722
|
*
|
|
718
723
|
* @throws {Error} When server returns 5xx status codes
|
|
719
724
|
*/
|
|
720
725
|
getOrgLicensePolicy(orgSlug: string): Promise<SocketSdkResult<'getOrgLicensePolicy'>>;
|
|
721
726
|
/**
|
|
722
|
-
* Get organization's security policy configuration
|
|
727
|
+
* Get organization's security policy configuration.
|
|
728
|
+
* Returns alert rules, severity thresholds, and enforcement settings.
|
|
723
729
|
*
|
|
724
730
|
* @throws {Error} When server returns 5xx status codes
|
|
725
731
|
*/
|
|
@@ -782,10 +788,6 @@ export declare class SocketSdk {
|
|
|
782
788
|
* @throws {Error} When server returns 5xx status codes
|
|
783
789
|
*/
|
|
784
790
|
getRepoAnalytics(repo: string, time: string): Promise<SocketSdkResult<'getRepoAnalytics'>>;
|
|
785
|
-
/**
|
|
786
|
-
* Get detailed results for a legacy scan report.
|
|
787
|
-
/**
|
|
788
|
-
|
|
789
791
|
/**
|
|
790
792
|
* Get details for a specific repository.
|
|
791
793
|
*
|
|
@@ -1156,13 +1158,15 @@ export declare class SocketSdk {
|
|
|
1156
1158
|
*/
|
|
1157
1159
|
updateOrgAlertTriage(orgSlug: string, alertId: string, triageData: QueryParams): Promise<SocketSdkResult<'updateOrgAlertTriage'>>;
|
|
1158
1160
|
/**
|
|
1159
|
-
* Update organization's license policy configuration
|
|
1161
|
+
* Update organization's license policy configuration.
|
|
1162
|
+
* Modifies allowed, restricted, and monitored license types.
|
|
1160
1163
|
*
|
|
1161
1164
|
* @throws {Error} When server returns 5xx status codes
|
|
1162
1165
|
*/
|
|
1163
1166
|
updateOrgLicensePolicy(orgSlug: string, policyData: QueryParams, queryParams?: QueryParams | undefined): Promise<SocketSdkResult<'updateOrgLicensePolicy'>>;
|
|
1164
1167
|
/**
|
|
1165
|
-
* Update organization's security policy configuration
|
|
1168
|
+
* Update organization's security policy configuration.
|
|
1169
|
+
* Modifies alert rules, severity thresholds, and enforcement settings.
|
|
1166
1170
|
*
|
|
1167
1171
|
* @throws {Error} When server returns 5xx status codes
|
|
1168
1172
|
*/
|
package/dist/types.d.ts
CHANGED
|
@@ -171,6 +171,34 @@ export type SocketSdkGenericResult<T> = {
|
|
|
171
171
|
success: false;
|
|
172
172
|
url?: string | undefined;
|
|
173
173
|
};
|
|
174
|
+
export type MalwareCheckAlert = {
|
|
175
|
+
category?: string | undefined;
|
|
176
|
+
fix?: {
|
|
177
|
+
description: string;
|
|
178
|
+
type: string;
|
|
179
|
+
} | undefined;
|
|
180
|
+
key: string;
|
|
181
|
+
props?: Record<string, unknown> | undefined;
|
|
182
|
+
severity?: string | undefined;
|
|
183
|
+
type: ALERT_TYPE;
|
|
184
|
+
};
|
|
185
|
+
export type MalwareCheckPackage = {
|
|
186
|
+
alerts: MalwareCheckAlert[];
|
|
187
|
+
name?: string | undefined;
|
|
188
|
+
namespace?: string | undefined;
|
|
189
|
+
score?: MalwareCheckScore | undefined;
|
|
190
|
+
type: string;
|
|
191
|
+
version?: string | undefined;
|
|
192
|
+
};
|
|
193
|
+
export type MalwareCheckResult = MalwareCheckPackage[];
|
|
194
|
+
export type MalwareCheckScore = {
|
|
195
|
+
license: number;
|
|
196
|
+
maintenance: number;
|
|
197
|
+
overall: number;
|
|
198
|
+
quality: number;
|
|
199
|
+
supplyChain: number;
|
|
200
|
+
vulnerability: number;
|
|
201
|
+
};
|
|
174
202
|
/**
|
|
175
203
|
* Result from file validation callback.
|
|
176
204
|
* Allows consumers to customize error handling and logging.
|
|
@@ -312,14 +340,6 @@ export type CreateDependenciesSnapshotOptions = {
|
|
|
312
340
|
pathsRelativeTo?: string | undefined;
|
|
313
341
|
queryParams?: QueryParams | undefined;
|
|
314
342
|
};
|
|
315
|
-
export type CreateOrgFullScanOptions = {
|
|
316
|
-
pathsRelativeTo?: string | undefined;
|
|
317
|
-
queryParams?: QueryParams | undefined;
|
|
318
|
-
};
|
|
319
|
-
export type CreateScanFromFilepathsOptions = {
|
|
320
|
-
issueRules?: Record<string, boolean> | undefined;
|
|
321
|
-
pathsRelativeTo?: string | undefined;
|
|
322
|
-
};
|
|
323
343
|
export type StreamOrgFullScanOptions = {
|
|
324
344
|
output?: boolean | string | undefined;
|
|
325
345
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "SDK for the Socket API client",
|
|
5
5
|
"homepage": "https://github.com/SocketDev/socket-sdk-js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,16 +59,18 @@
|
|
|
59
59
|
"publish": "node scripts/publish.mjs",
|
|
60
60
|
"publish:ci": "node scripts/publish.mjs --tag ${DIST_TAG:-latest}",
|
|
61
61
|
"claude": "node scripts/claude.mjs",
|
|
62
|
+
"security": "agentshield scan && { command -v zizmor >/dev/null && zizmor .github/ || echo 'zizmor not installed — run pnpm run setup to install'; }",
|
|
62
63
|
"test": "node scripts/test.mjs",
|
|
63
64
|
"type": "tsgo --noEmit -p .config/tsconfig.check.json",
|
|
64
65
|
"update": "node scripts/update.mjs"
|
|
65
66
|
},
|
|
66
67
|
"dependencies": {
|
|
67
|
-
"@socketregistry/packageurl-js": "1.
|
|
68
|
-
"@socketsecurity/lib": "5.
|
|
68
|
+
"@socketregistry/packageurl-js": "1.4.1",
|
|
69
|
+
"@socketsecurity/lib": "5.11.4",
|
|
69
70
|
"form-data": "4.0.5"
|
|
70
71
|
},
|
|
71
72
|
"devDependencies": {
|
|
73
|
+
"@anthropic-ai/claude-code": "2.1.89",
|
|
72
74
|
"@babel/generator": "7.28.5",
|
|
73
75
|
"@babel/parser": "7.26.3",
|
|
74
76
|
"@babel/traverse": "7.26.4",
|
|
@@ -83,6 +85,7 @@
|
|
|
83
85
|
"acorn": "8.15.0",
|
|
84
86
|
"del": "8.0.1",
|
|
85
87
|
"dev-null-cli": "2.0.0",
|
|
88
|
+
"ecc-agentshield": "1.4.0",
|
|
86
89
|
"esbuild": "0.25.11",
|
|
87
90
|
"fast-glob": "3.3.3",
|
|
88
91
|
"http2-wrapper": "2.2.1",
|
|
@@ -109,10 +112,10 @@
|
|
|
109
112
|
"strict": true
|
|
110
113
|
},
|
|
111
114
|
"engines": {
|
|
112
|
-
"node": ">=18",
|
|
113
|
-
"pnpm": ">=10.
|
|
115
|
+
"node": ">=18.20.8",
|
|
116
|
+
"pnpm": ">=10.33.0"
|
|
114
117
|
},
|
|
115
|
-
"packageManager": "pnpm@10.
|
|
118
|
+
"packageManager": "pnpm@10.33.0",
|
|
116
119
|
"pnpm": {
|
|
117
120
|
"ignoredBuiltDependencies": [
|
|
118
121
|
"esbuild",
|
package/types/api.d.ts
CHANGED
|
@@ -896,7 +896,7 @@ export interface paths {
|
|
|
896
896
|
/**
|
|
897
897
|
* Start historical data snapshot job (Beta)
|
|
898
898
|
* @description This API endpoint is used to start a historical snapshot job.
|
|
899
|
-
* While snapshots are typically taken
|
|
899
|
+
* While snapshots are typically taken multiple times a day for paid plans and once a day for free plans, this endpoint can be used to start an "on demand" snapshot job to ensure the latest data is collected and stored for historical purposes.
|
|
900
900
|
*
|
|
901
901
|
* An historical snapshot will contain details and raw data for the following resources:
|
|
902
902
|
*
|
|
@@ -1940,6 +1940,27 @@ export interface components {
|
|
|
1940
1940
|
licenseDetails?: components['schemas']['LicenseDetails']
|
|
1941
1941
|
licenseAttrib?: components['schemas']['SAttrib1_N']
|
|
1942
1942
|
}
|
|
1943
|
+
/** @description Mapping of supply chain risk alert types to their computed score contributions and formulas used for calculation. This allows for detailed breakdowns of how each alert type impacts the overall supply chain security score, with the ability to include custom formulas and components for each alert type. */
|
|
1944
|
+
SocketSBOMScore: {
|
|
1945
|
+
[key: string]: {
|
|
1946
|
+
value: {
|
|
1947
|
+
/**
|
|
1948
|
+
* @description Score from 0.0 to 1.0 for the scanned repository, computed from supply chain risk alerts using weighted exponential decay per direct dependency
|
|
1949
|
+
* @default 0
|
|
1950
|
+
*/
|
|
1951
|
+
result: number
|
|
1952
|
+
/** @description Components used to compute result of the formula */
|
|
1953
|
+
components?: {
|
|
1954
|
+
[key: string]: number
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* @description Formula used to compute the supply chain security score
|
|
1958
|
+
* @default
|
|
1959
|
+
*/
|
|
1960
|
+
formula?: string
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1943
1964
|
SocketDiffArtifact: components['schemas']['SocketPURL'] & {
|
|
1944
1965
|
diffType: components['schemas']['SocketDiffArtifactType']
|
|
1945
1966
|
id?: components['schemas']['SocketId']
|
|
@@ -4331,6 +4352,23 @@ export interface components {
|
|
|
4331
4352
|
usage?: components['schemas']['SocketUsageRef']
|
|
4332
4353
|
}
|
|
4333
4354
|
}
|
|
4355
|
+
| {
|
|
4356
|
+
/** @enum {string} */
|
|
4357
|
+
type?: 'skillPreExecution'
|
|
4358
|
+
value?: components['schemas']['SocketIssueBasics'] & {
|
|
4359
|
+
/** @default */
|
|
4360
|
+
description: string
|
|
4361
|
+
props: {
|
|
4362
|
+
/** @default */
|
|
4363
|
+
notes: string
|
|
4364
|
+
/** @default 0 */
|
|
4365
|
+
confidence: number
|
|
4366
|
+
/** @default 0 */
|
|
4367
|
+
severity: number
|
|
4368
|
+
}
|
|
4369
|
+
usage?: components['schemas']['SocketUsageRef']
|
|
4370
|
+
}
|
|
4371
|
+
}
|
|
4334
4372
|
| {
|
|
4335
4373
|
/** @enum {string} */
|
|
4336
4374
|
type?: 'skillPromptInjection'
|
|
@@ -5522,6 +5560,8 @@ export interface operations {
|
|
|
5522
5560
|
cachedResultsOnly?: boolean
|
|
5523
5561
|
/** @description Include a summary object at the end of the stream with counts of malformed, resolved, and not found PURLs. */
|
|
5524
5562
|
summary?: boolean
|
|
5563
|
+
/** @description Maximum time in seconds to wait for scan results. PURLs that have not completed processing when the timeout is reached will be returned as errors (when purlErrors is enabled). Omit for no timeout. */
|
|
5564
|
+
timeoutSec?: number
|
|
5525
5565
|
}
|
|
5526
5566
|
}
|
|
5527
5567
|
requestBody?: {
|
|
@@ -5598,6 +5638,8 @@ export interface operations {
|
|
|
5598
5638
|
version?: string
|
|
5599
5639
|
/** @default */
|
|
5600
5640
|
release?: string
|
|
5641
|
+
/** @default */
|
|
5642
|
+
workspace?: string
|
|
5601
5643
|
}>
|
|
5602
5644
|
}
|
|
5603
5645
|
}
|
|
@@ -5924,6 +5966,10 @@ export interface operations {
|
|
|
5924
5966
|
include_alert_priority_details?:
|
|
5925
5967
|
| boolean
|
|
5926
5968
|
| Array<'component' | 'formula'>
|
|
5969
|
+
/** @description Include scores event in the response. include_scores_details implies this flag */
|
|
5970
|
+
include_scores: boolean
|
|
5971
|
+
/** @description Control which score detail fields to include in the scores event. Set to "true" to include all fields, "false" to exclude all fields, or specify individual fields like "components,formula" to include only those fields. */
|
|
5972
|
+
include_scores_details?: boolean | Array<'components' | 'formula'>
|
|
5927
5973
|
/** @description Include license details in the response. This can increase the response size significantly. */
|
|
5928
5974
|
include_license_details: boolean
|
|
5929
5975
|
/** @description Return cached immutable scan results. When enabled and results are cached, returns the pre-computed scan. When results are not yet cached, returns 202 Accepted and enqueues a background job. */
|
|
@@ -5937,10 +5983,16 @@ export interface operations {
|
|
|
5937
5983
|
}
|
|
5938
5984
|
}
|
|
5939
5985
|
responses: {
|
|
5940
|
-
/** @description Socket issue lists and scores for all packages */
|
|
5986
|
+
/** @description Socket issue lists and scores for all packages, followed by a final scores event */
|
|
5941
5987
|
200: {
|
|
5942
5988
|
content: {
|
|
5943
|
-
'application/x-ndjson':
|
|
5989
|
+
'application/x-ndjson':
|
|
5990
|
+
| components['schemas']['SocketArtifact']
|
|
5991
|
+
| {
|
|
5992
|
+
/** @enum {string} */
|
|
5993
|
+
_type: 'scores'
|
|
5994
|
+
value: components['schemas']['SocketSBOMScore']
|
|
5995
|
+
}
|
|
5944
5996
|
}
|
|
5945
5997
|
}
|
|
5946
5998
|
/** @description Scan is being processed. Poll again later to retrieve results. */
|
|
@@ -9411,6 +9463,13 @@ export interface operations {
|
|
|
9411
9463
|
*/
|
|
9412
9464
|
action: 'defer' | 'error' | 'warn' | 'monitor' | 'ignore'
|
|
9413
9465
|
}
|
|
9466
|
+
skillPreExecution?: {
|
|
9467
|
+
/**
|
|
9468
|
+
* @description The action to take for skillPreExecution issues.
|
|
9469
|
+
* @enum {string}
|
|
9470
|
+
*/
|
|
9471
|
+
action: 'defer' | 'error' | 'warn' | 'monitor' | 'ignore'
|
|
9472
|
+
}
|
|
9414
9473
|
skillPromptInjection?: {
|
|
9415
9474
|
/**
|
|
9416
9475
|
* @description The action to take for skillPromptInjection issues.
|
|
@@ -10388,6 +10447,13 @@ export interface operations {
|
|
|
10388
10447
|
*/
|
|
10389
10448
|
action: 'defer' | 'error' | 'warn' | 'monitor' | 'ignore'
|
|
10390
10449
|
}
|
|
10450
|
+
skillPreExecution?: {
|
|
10451
|
+
/**
|
|
10452
|
+
* @description The action to take for skillPreExecution issues.
|
|
10453
|
+
* @enum {string}
|
|
10454
|
+
*/
|
|
10455
|
+
action: 'defer' | 'error' | 'warn' | 'monitor' | 'ignore'
|
|
10456
|
+
}
|
|
10391
10457
|
skillPromptInjection?: {
|
|
10392
10458
|
/**
|
|
10393
10459
|
* @description The action to take for skillPromptInjection issues.
|
|
@@ -11519,6 +11585,13 @@ export interface operations {
|
|
|
11519
11585
|
*/
|
|
11520
11586
|
action: 'defer' | 'error' | 'warn' | 'monitor' | 'ignore'
|
|
11521
11587
|
}
|
|
11588
|
+
skillPreExecution?: {
|
|
11589
|
+
/**
|
|
11590
|
+
* @description The action to take for skillPreExecution issues.
|
|
11591
|
+
* @enum {string}
|
|
11592
|
+
*/
|
|
11593
|
+
action: 'defer' | 'error' | 'warn' | 'monitor' | 'ignore'
|
|
11594
|
+
}
|
|
11522
11595
|
skillPromptInjection?: {
|
|
11523
11596
|
/**
|
|
11524
11597
|
* @description The action to take for skillPromptInjection issues.
|
|
@@ -12489,6 +12562,13 @@ export interface operations {
|
|
|
12489
12562
|
*/
|
|
12490
12563
|
action: 'defer' | 'error' | 'warn' | 'monitor' | 'ignore'
|
|
12491
12564
|
}
|
|
12565
|
+
skillPreExecution?: {
|
|
12566
|
+
/**
|
|
12567
|
+
* @description The action to take for skillPreExecution issues.
|
|
12568
|
+
* @enum {string}
|
|
12569
|
+
*/
|
|
12570
|
+
action: 'defer' | 'error' | 'warn' | 'monitor' | 'ignore'
|
|
12571
|
+
}
|
|
12492
12572
|
skillPromptInjection?: {
|
|
12493
12573
|
/**
|
|
12494
12574
|
* @description The action to take for skillPromptInjection issues.
|
|
@@ -13428,6 +13508,13 @@ export interface operations {
|
|
|
13428
13508
|
*/
|
|
13429
13509
|
action: 'defer' | 'error' | 'warn' | 'monitor' | 'ignore'
|
|
13430
13510
|
}
|
|
13511
|
+
skillPreExecution?: {
|
|
13512
|
+
/**
|
|
13513
|
+
* @description The action to take for skillPreExecution issues.
|
|
13514
|
+
* @enum {string}
|
|
13515
|
+
*/
|
|
13516
|
+
action: 'defer' | 'error' | 'warn' | 'monitor' | 'ignore'
|
|
13517
|
+
}
|
|
13431
13518
|
skillPromptInjection?: {
|
|
13432
13519
|
/**
|
|
13433
13520
|
* @description The action to take for skillPromptInjection issues.
|
|
@@ -15243,7 +15330,7 @@ export interface operations {
|
|
|
15243
15330
|
/**
|
|
15244
15331
|
* Start historical data snapshot job (Beta)
|
|
15245
15332
|
* @description This API endpoint is used to start a historical snapshot job.
|
|
15246
|
-
* While snapshots are typically taken
|
|
15333
|
+
* While snapshots are typically taken multiple times a day for paid plans and once a day for free plans, this endpoint can be used to start an "on demand" snapshot job to ensure the latest data is collected and stored for historical purposes.
|
|
15247
15334
|
*
|
|
15248
15335
|
* An historical snapshot will contain details and raw data for the following resources:
|
|
15249
15336
|
*
|
|
@@ -15313,6 +15400,7 @@ export interface operations {
|
|
|
15313
15400
|
| 'CreateOauthRefreshToken'
|
|
15314
15401
|
| 'CreateRepoAccessRule'
|
|
15315
15402
|
| 'CreateWebhook'
|
|
15403
|
+
| 'CreateTicket'
|
|
15316
15404
|
| 'DeleteAlertTriage'
|
|
15317
15405
|
| 'DeleteApiToken'
|
|
15318
15406
|
| 'DeleteFullScan'
|
|
@@ -15323,8 +15411,10 @@ export interface operations {
|
|
|
15323
15411
|
| 'DeleteRepository'
|
|
15324
15412
|
| 'DeleteWebhook'
|
|
15325
15413
|
| 'DisassociateLabel'
|
|
15414
|
+
| 'DisconnectJiraIntegration'
|
|
15326
15415
|
| 'DowngradeOrganizationPlan'
|
|
15327
15416
|
| 'JoinOrganization'
|
|
15417
|
+
| 'JiraIntegrationConnected'
|
|
15328
15418
|
| 'MemberAdded'
|
|
15329
15419
|
| 'MemberRemoved'
|
|
15330
15420
|
| 'MemberRoleChanged'
|
|
@@ -15519,6 +15609,11 @@ export interface operations {
|
|
|
15519
15609
|
| 'alerts'
|
|
15520
15610
|
| 'alerts:list'
|
|
15521
15611
|
| 'alerts:trend'
|
|
15612
|
+
| 'alert-resolution'
|
|
15613
|
+
| 'alert-resolution:list'
|
|
15614
|
+
| 'alert-resolution:create'
|
|
15615
|
+
| 'alert-resolution:read'
|
|
15616
|
+
| 'alert-resolution:delete'
|
|
15522
15617
|
| 'api-tokens'
|
|
15523
15618
|
| 'api-tokens:create'
|
|
15524
15619
|
| 'api-tokens:update'
|
|
@@ -15649,6 +15744,11 @@ export interface operations {
|
|
|
15649
15744
|
| 'alerts'
|
|
15650
15745
|
| 'alerts:list'
|
|
15651
15746
|
| 'alerts:trend'
|
|
15747
|
+
| 'alert-resolution'
|
|
15748
|
+
| 'alert-resolution:list'
|
|
15749
|
+
| 'alert-resolution:create'
|
|
15750
|
+
| 'alert-resolution:read'
|
|
15751
|
+
| 'alert-resolution:delete'
|
|
15652
15752
|
| 'api-tokens'
|
|
15653
15753
|
| 'api-tokens:create'
|
|
15654
15754
|
| 'api-tokens:update'
|
|
@@ -15842,6 +15942,11 @@ export interface operations {
|
|
|
15842
15942
|
| 'alerts'
|
|
15843
15943
|
| 'alerts:list'
|
|
15844
15944
|
| 'alerts:trend'
|
|
15945
|
+
| 'alert-resolution'
|
|
15946
|
+
| 'alert-resolution:list'
|
|
15947
|
+
| 'alert-resolution:create'
|
|
15948
|
+
| 'alert-resolution:read'
|
|
15949
|
+
| 'alert-resolution:delete'
|
|
15845
15950
|
| 'api-tokens'
|
|
15846
15951
|
| 'api-tokens:create'
|
|
15847
15952
|
| 'api-tokens:update'
|
|
@@ -16577,6 +16682,8 @@ export interface operations {
|
|
|
16577
16682
|
cachedResultsOnly?: boolean
|
|
16578
16683
|
/** @description Include a summary object at the end of the stream with counts of malformed, resolved, and not found PURLs. */
|
|
16579
16684
|
summary?: boolean
|
|
16685
|
+
/** @description Maximum time in seconds to wait for scan results. PURLs that have not completed processing when the timeout is reached will be returned as errors (when purlErrors is enabled). Omit for no timeout, unless a default timeout is configured for the organization. */
|
|
16686
|
+
timeoutSec?: number
|
|
16580
16687
|
}
|
|
16581
16688
|
path: {
|
|
16582
16689
|
/** @description The slug of the organization */
|
|
@@ -16667,7 +16774,7 @@ export interface operations {
|
|
|
16667
16774
|
'fetch-fixes': {
|
|
16668
16775
|
parameters: {
|
|
16669
16776
|
query: {
|
|
16670
|
-
/** @description The slug of the repository to fetch fixes for. Computes fixes based on the latest scan on the default branch */
|
|
16777
|
+
/** @description The slug of the repository to fetch fixes for (e.g. "my-repo" or "my-org/my-repo"). Use the full org/repo path to disambiguate when multiple GitHub orgs share the same repo name. Computes fixes based on the latest scan on the default branch */
|
|
16671
16778
|
repo_slug?: string
|
|
16672
16779
|
/** @description The ID of the scan to fetch fixes for */
|
|
16673
16780
|
full_scan_id?: string
|