@socketsecurity/cli 1.1.151 → 1.1.153
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 +10 -0
- package/DISCLOSURE +45 -0
- package/dist/cli.js +2348 -629
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +4 -4
- package/dist/constants.js.map +1 -1
- package/dist/manifest-scripts/maven-extension/coana-maven-extension.jar +0 -0
- package/dist/manifest-scripts/socket-facts.init.gradle +14 -45
- package/dist/manifest-scripts/socket-facts.plugin.scala +15 -46
- package/dist/manifest-scripts/socket-workspaces.init.gradle +99 -0
- package/dist/manifest-scripts/socket-workspaces.plugin.scala +112 -0
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/manifest/cmd-manifest-dynamic-sbom-inference.d.mts +9 -0
- package/dist/types/commands/manifest/cmd-manifest-dynamic-sbom-inference.d.mts.map +1 -0
- package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-maven.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-scala.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-setup.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest.d.mts.map +1 -1
- package/dist/types/commands/manifest/convert-gradle-to-facts.d.mts +2 -1
- package/dist/types/commands/manifest/convert-gradle-to-facts.d.mts.map +1 -1
- package/dist/types/commands/manifest/convert-maven-to-facts.d.mts +2 -1
- package/dist/types/commands/manifest/convert-maven-to-facts.d.mts.map +1 -1
- package/dist/types/commands/manifest/convert-sbt-to-facts.d.mts +2 -1
- package/dist/types/commands/manifest/convert-sbt-to-facts.d.mts.map +1 -1
- package/dist/types/commands/manifest/discover-manifest-roots.d.mts +18 -0
- package/dist/types/commands/manifest/discover-manifest-roots.d.mts.map +1 -0
- package/dist/types/commands/manifest/enumerate-workspaces.d.mts +19 -0
- package/dist/types/commands/manifest/enumerate-workspaces.d.mts.map +1 -0
- package/dist/types/commands/manifest/expand-env-var-refs.d.mts +10 -0
- package/dist/types/commands/manifest/expand-env-var-refs.d.mts.map +1 -0
- package/dist/types/commands/manifest/generate-recursive-manifests.d.mts +37 -0
- package/dist/types/commands/manifest/generate-recursive-manifests.d.mts.map +1 -0
- package/dist/types/commands/manifest/generate_auto_manifest.d.mts.map +1 -1
- package/dist/types/commands/manifest/handle-manifest-dynamic-sbom-inference.d.mts +8 -0
- package/dist/types/commands/manifest/handle-manifest-dynamic-sbom-inference.d.mts.map +1 -0
- package/dist/types/commands/manifest/handle-manifest-setup.d.mts +1 -1
- package/dist/types/commands/manifest/handle-manifest-setup.d.mts.map +1 -1
- package/dist/types/commands/manifest/manifest-flags.d.mts +6 -0
- package/dist/types/commands/manifest/manifest-flags.d.mts.map +1 -0
- package/dist/types/commands/manifest/output-manifest-dynamic-sbom-inference.d.mts +4 -0
- package/dist/types/commands/manifest/output-manifest-dynamic-sbom-inference.d.mts.map +1 -0
- package/dist/types/commands/manifest/run-manifest-facts.d.mts +13 -2
- package/dist/types/commands/manifest/run-manifest-facts.d.mts.map +1 -1
- package/dist/types/commands/manifest/scripts/exclude-paths-glob.d.mts +8 -0
- package/dist/types/commands/manifest/scripts/exclude-paths-glob.d.mts.map +1 -0
- package/dist/types/commands/manifest/scripts/run.d.mts +10 -1
- package/dist/types/commands/manifest/scripts/run.d.mts.map +1 -1
- package/dist/types/commands/manifest/setup-manifest-config.d.mts +19 -0
- package/dist/types/commands/manifest/setup-manifest-config.d.mts.map +1 -1
- package/dist/types/commands/manifest/setup-recursive-manifest-config.d.mts +120 -0
- package/dist/types/commands/manifest/setup-recursive-manifest-config.d.mts.map +1 -0
- package/dist/types/commands/scan/create-scan-from-github.d.mts +17 -0
- package/dist/types/commands/scan/create-scan-from-github.d.mts.map +1 -1
- package/dist/types/utils/github-errors.d.mts +51 -0
- package/dist/types/utils/github-errors.d.mts.map +1 -0
- package/dist/types/utils/socket-json.d.mts +38 -14
- package/dist/types/utils/socket-json.d.mts.map +1 -1
- package/dist/utils.js +307 -3
- package/dist/utils.js.map +1 -1
- package/package.json +6 -2
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ApiFetchInit } from './api.mts';
|
|
2
|
+
import type { CResult } from '../types.mts';
|
|
3
|
+
// Canonical `message` values returned for blocking conditions. Exported so
|
|
4
|
+
// the scan loop can short-circuit on them without matching free-form strings.
|
|
5
|
+
export declare const GITHUB_ERR_ABUSE_DETECTION = "GitHub abuse detection triggered";
|
|
6
|
+
export declare const GITHUB_ERR_AUTH_FAILED = "GitHub authentication failed";
|
|
7
|
+
export declare const GITHUB_ERR_RATE_LIMIT = "GitHub rate limit exceeded";
|
|
8
|
+
/**
|
|
9
|
+
* Whether a CResult `message` is one of the blocking GitHub conditions
|
|
10
|
+
* (rate limit / abuse detection / auth) that should stop a multi-repo scan.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isGitHubBlockingError(message: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Seconds to wait before a rate-limited request could succeed, derived from
|
|
15
|
+
* the `Retry-After` header (seconds) or the `x-ratelimit-reset` header (an
|
|
16
|
+
* epoch-seconds timestamp). Returns undefined when neither is usable.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getRateLimitWaitSeconds(headers: Headers): number | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Classify a GitHub API response as a blocking error (rate limit / abuse
|
|
21
|
+
* detection / auth). Returns undefined when the response is not one of those
|
|
22
|
+
* conditions, so the caller can continue its normal parsing (including its
|
|
23
|
+
* own handling of 404s, empty repos, etc.).
|
|
24
|
+
*/
|
|
25
|
+
export declare function classifyGitHubResponse(status: number, headers: Headers, bodyText: string, context: string): CResult<never> | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Perform a GitHub REST request through `apiFetch`, detecting rate-limit /
|
|
28
|
+
* auth / abuse-detection responses up front and applying bounded retries.
|
|
29
|
+
*
|
|
30
|
+
* On success returns the response together with its already-read body text
|
|
31
|
+
* (the body stream can only be consumed once). On a blocking or exhausted
|
|
32
|
+
* transient failure returns a typed CResult error. Non-blocking non-2xx
|
|
33
|
+
* responses (e.g. 404, or GitHub's "empty repository" 200) are returned as
|
|
34
|
+
* successes so the caller keeps its existing body-parsing logic.
|
|
35
|
+
*
|
|
36
|
+
* Retry policy:
|
|
37
|
+
* - Rate limit / abuse: wait once for the reset window, but only when it is
|
|
38
|
+
* short (<= CHEAP_RATE_LIMIT_WAIT_MAX_SECONDS); otherwise surface the error
|
|
39
|
+
* immediately. Long primary-limit resets are not worth blocking on.
|
|
40
|
+
* - Auth: never retried.
|
|
41
|
+
* - 5xx / network: capped exponential backoff, MAX_TRANSIENT_ATTEMPTS total.
|
|
42
|
+
*/
|
|
43
|
+
export declare function githubApiRequest(url: string, init: ApiFetchInit, context: string,
|
|
44
|
+
// Injectable request implementation. Defaults to the real `apiFetch`;
|
|
45
|
+
// tests pass a fake so the retry/backoff logic can be exercised without
|
|
46
|
+
// touching the network.
|
|
47
|
+
fetchImpl?: (url: string, init: ApiFetchInit) => Promise<Response>): Promise<CResult<{
|
|
48
|
+
response: Response;
|
|
49
|
+
bodyText: string;
|
|
50
|
+
}>>;
|
|
51
|
+
//# sourceMappingURL=github-errors.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-errors.d.mts","sourceRoot":"","sources":["../../../src/utils/github-errors.mts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAkB3C,2EAA2E;AAC3E,8EAA8E;AAC9E,eAAO,MAAM,0BAA0B,qCAAqC,CAAA;AAC5E,eAAO,MAAM,sBAAsB,iCAAiC,CAAA;AACpE,eAAO,MAAM,qBAAqB,+BAA+B,CAAA;AAWjE;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAgB5E;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,KAAK,CAAC,GAAG,SAAS,CA6D5B;AAYD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,MAAM;AACf,sEAAsE;AACtE,wEAAwE;AACxE,wBAAwB;AACxB,SAAS,GAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,QAAQ,CAAY,GAC3E,OAAO,CAAC,OAAO,CAAC;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAoF5D"}
|
|
@@ -28,35 +28,55 @@ export interface SocketJson {
|
|
|
28
28
|
verbose?: boolean | undefined;
|
|
29
29
|
};
|
|
30
30
|
gradle?: {
|
|
31
|
+
// Root-only: gates auto-detection for socket manifest auto/gradle.
|
|
32
|
+
// Cascaded (any level): also skips that build root in
|
|
33
|
+
// dynamic-sbom-inference specifically.
|
|
31
34
|
disabled?: boolean | undefined;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
// A field set to null explicitly clears an inherited cascade value
|
|
36
|
+
// (widens back to the tool default) instead of restating it.
|
|
37
|
+
bin?: string | undefined | null;
|
|
38
|
+
excludeConfigs?: string | undefined | null;
|
|
39
|
+
includeConfigs?: string | undefined | null;
|
|
35
40
|
facts?: boolean | undefined;
|
|
36
|
-
gradleOpts?: string | undefined;
|
|
41
|
+
gradleOpts?: string | undefined | null;
|
|
37
42
|
ignoreUnresolved?: boolean | undefined;
|
|
43
|
+
// JDK path; sets JAVA_HOME for this ecosystem's build tool. Supports
|
|
44
|
+
// $VAR/${VAR} expansion against the CLI's own environment.
|
|
45
|
+
javaHome?: string | undefined | null;
|
|
38
46
|
verbose?: boolean | undefined;
|
|
39
47
|
};
|
|
40
48
|
maven?: {
|
|
49
|
+
// Root-only: gates auto-detection for socket manifest auto/maven.
|
|
50
|
+
// Cascaded (any level): also skips that build root in
|
|
51
|
+
// dynamic-sbom-inference specifically.
|
|
41
52
|
disabled?: boolean | undefined;
|
|
42
|
-
bin?: string | undefined;
|
|
43
|
-
excludeConfigs?: string | undefined;
|
|
44
|
-
includeConfigs?: string | undefined;
|
|
53
|
+
bin?: string | undefined | null;
|
|
54
|
+
excludeConfigs?: string | undefined | null;
|
|
55
|
+
includeConfigs?: string | undefined | null;
|
|
45
56
|
ignoreUnresolved?: boolean | undefined;
|
|
46
|
-
|
|
57
|
+
// JDK path; sets JAVA_HOME for this ecosystem's build tool. Supports
|
|
58
|
+
// $VAR/${VAR} expansion against the CLI's own environment.
|
|
59
|
+
javaHome?: string | undefined | null;
|
|
60
|
+
mavenOpts?: string | undefined | null;
|
|
47
61
|
verbose?: boolean | undefined;
|
|
48
62
|
};
|
|
49
63
|
sbt?: {
|
|
64
|
+
// Root-only: gates auto-detection for socket manifest auto/scala.
|
|
65
|
+
// Cascaded (any level): also skips that build root in
|
|
66
|
+
// dynamic-sbom-inference specifically.
|
|
50
67
|
disabled?: boolean | undefined;
|
|
51
|
-
infile?: string | undefined;
|
|
68
|
+
infile?: string | undefined | null;
|
|
52
69
|
stdin?: boolean | undefined;
|
|
53
|
-
bin?: string | undefined;
|
|
54
|
-
excludeConfigs?: string | undefined;
|
|
55
|
-
includeConfigs?: string | undefined;
|
|
70
|
+
bin?: string | undefined | null;
|
|
71
|
+
excludeConfigs?: string | undefined | null;
|
|
72
|
+
includeConfigs?: string | undefined | null;
|
|
56
73
|
facts?: boolean | undefined;
|
|
57
74
|
ignoreUnresolved?: boolean | undefined;
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
// JDK path; sets JAVA_HOME for this ecosystem's build tool. Supports
|
|
76
|
+
// $VAR/${VAR} expansion against the CLI's own environment.
|
|
77
|
+
javaHome?: string | undefined | null;
|
|
78
|
+
outfile?: string | undefined | null;
|
|
79
|
+
sbtOpts?: string | undefined | null;
|
|
60
80
|
stdout?: boolean | undefined;
|
|
61
81
|
verbose?: boolean | undefined;
|
|
62
82
|
};
|
|
@@ -81,6 +101,10 @@ export interface SocketJson {
|
|
|
81
101
|
export declare function readOrDefaultSocketJson(cwd: string): SocketJson;
|
|
82
102
|
export declare function findSocketJsonUp(cwd: string): Promise<string | undefined>;
|
|
83
103
|
export declare function readOrDefaultSocketJsonUp(cwd: string): Promise<SocketJson>;
|
|
104
|
+
// Cascades `defaults.manifest.*` from `rootSockJson` down to `dir`: each
|
|
105
|
+
// ancestor's own socket.json, between `dir` and `boundaryDir` (exclusive),
|
|
106
|
+
// merges in, nearest-to-`dir` winning field by field.
|
|
107
|
+
export declare function readSocketJsonCascade(dir: string, boundaryDir: string, rootSockJson: SocketJson): SocketJson;
|
|
84
108
|
export declare function getDefaultSocketJson(): SocketJson;
|
|
85
109
|
export declare function readSocketJson(cwd: string, defaultOnError?: boolean): Promise<CResult<SocketJson>>;
|
|
86
110
|
export declare function readSocketJsonSync(cwd: string, defaultOnError?: boolean): CResult<SocketJson>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket-json.d.mts","sourceRoot":"","sources":["../../../src/utils/socket-json.mts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C,MAAM,WAAW,UAAU;IACzB,+BAA+B,EAAE,MAAM,CAAA;IACvC,+BAA+B,EAAE,MAAM,CAAA;IACvC,+BAA+B,EAAE,MAAM,CAAA;IACvC,+BAA+B,EA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9B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;aAC3B,CAAA;SACF,CAAA;KACF,CAAA;CACF;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAM/D;AAED,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAE7B;AAED,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,UAAU,CAAC,CAQrB;AAyCD,yEAAyE;AACzE,2EAA2E;AAC3E,sDAAsD;AACtD,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,UAAU,GACvB,UAAU,CAoBZ;AAED,wBAAgB,oBAAoB,IAAI,UAAU,CAUjD;AAED,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,cAAc,UAAQ,GACrB,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAwD9B;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,cAAc,UAAQ,GACrB,OAAO,CAAC,UAAU,CAAC,CAuDrB;AAED,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,UAAU,GACnB,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAmB7B"}
|
package/dist/utils.js
CHANGED
|
@@ -23,12 +23,12 @@ var require$$11 = require('node:zlib');
|
|
|
23
23
|
var fs$1 = require('../external/@socketsecurity/registry/lib/fs');
|
|
24
24
|
var require$$1 = require('node:module');
|
|
25
25
|
var os = require('node:os');
|
|
26
|
-
var require$$13 = require('node:https');
|
|
27
|
-
var web = require('node:stream/web');
|
|
28
26
|
var url = require('../external/@socketsecurity/registry/lib/url');
|
|
29
27
|
var agent = require('../external/@socketsecurity/registry/lib/agent');
|
|
30
28
|
var bin = require('../external/@socketsecurity/registry/lib/bin');
|
|
31
29
|
var packages = require('../external/@socketsecurity/registry/lib/packages');
|
|
30
|
+
var require$$13 = require('node:https');
|
|
31
|
+
var web = require('node:stream/web');
|
|
32
32
|
var require$$0$1 = require('node:url');
|
|
33
33
|
var globs = require('../external/@socketsecurity/registry/lib/globs');
|
|
34
34
|
var streams = require('../external/@socketsecurity/registry/lib/streams');
|
|
@@ -5897,6 +5897,82 @@ async function readOrDefaultSocketJsonUp(cwd) {
|
|
|
5897
5897
|
}
|
|
5898
5898
|
return getDefaultSocketJson();
|
|
5899
5899
|
}
|
|
5900
|
+
|
|
5901
|
+
// Shallow-merges `defaults.manifest.<ecosystem>` per ecosystem: fields set in
|
|
5902
|
+
// `override` win, others fall through to `base`. Only this section cascades;
|
|
5903
|
+
// everything else in `defaults` comes from `base` only.
|
|
5904
|
+
function mergeManifestDefaults(base, override) {
|
|
5905
|
+
const overrideManifest = override.defaults?.manifest;
|
|
5906
|
+
if (!overrideManifest) {
|
|
5907
|
+
return base;
|
|
5908
|
+
}
|
|
5909
|
+
const baseManifest = base.defaults?.manifest;
|
|
5910
|
+
const mergedManifest = {
|
|
5911
|
+
...baseManifest
|
|
5912
|
+
};
|
|
5913
|
+
if (overrideManifest.bazel) {
|
|
5914
|
+
mergedManifest.bazel = {
|
|
5915
|
+
...baseManifest?.bazel,
|
|
5916
|
+
...overrideManifest.bazel
|
|
5917
|
+
};
|
|
5918
|
+
}
|
|
5919
|
+
if (overrideManifest.conda) {
|
|
5920
|
+
mergedManifest.conda = {
|
|
5921
|
+
...baseManifest?.conda,
|
|
5922
|
+
...overrideManifest.conda
|
|
5923
|
+
};
|
|
5924
|
+
}
|
|
5925
|
+
if (overrideManifest.gradle) {
|
|
5926
|
+
mergedManifest.gradle = {
|
|
5927
|
+
...baseManifest?.gradle,
|
|
5928
|
+
...overrideManifest.gradle
|
|
5929
|
+
};
|
|
5930
|
+
}
|
|
5931
|
+
if (overrideManifest.maven) {
|
|
5932
|
+
mergedManifest.maven = {
|
|
5933
|
+
...baseManifest?.maven,
|
|
5934
|
+
...overrideManifest.maven
|
|
5935
|
+
};
|
|
5936
|
+
}
|
|
5937
|
+
if (overrideManifest.sbt) {
|
|
5938
|
+
mergedManifest.sbt = {
|
|
5939
|
+
...baseManifest?.sbt,
|
|
5940
|
+
...overrideManifest.sbt
|
|
5941
|
+
};
|
|
5942
|
+
}
|
|
5943
|
+
return {
|
|
5944
|
+
...base,
|
|
5945
|
+
defaults: {
|
|
5946
|
+
...base.defaults,
|
|
5947
|
+
manifest: mergedManifest
|
|
5948
|
+
}
|
|
5949
|
+
};
|
|
5950
|
+
}
|
|
5951
|
+
|
|
5952
|
+
// Cascades `defaults.manifest.*` from `rootSockJson` down to `dir`: each
|
|
5953
|
+
// ancestor's own socket.json, between `dir` and `boundaryDir` (exclusive),
|
|
5954
|
+
// merges in, nearest-to-`dir` winning field by field.
|
|
5955
|
+
function readSocketJsonCascade(dir, boundaryDir, rootSockJson) {
|
|
5956
|
+
const boundary = path.resolve(boundaryDir);
|
|
5957
|
+
let current = path.resolve(dir);
|
|
5958
|
+
// Farthest-from-dir first, so the merge loop below applies overrides in
|
|
5959
|
+
// increasing precedence and the nearest-to-dir file wins last.
|
|
5960
|
+
const ancestorsFarToNear = [];
|
|
5961
|
+
while (current !== boundary) {
|
|
5962
|
+
if (fs.existsSync(path.join(current, constants.SOCKET_JSON))) {
|
|
5963
|
+
const jsonCResult = readSocketJsonSync(current, true);
|
|
5964
|
+
if (jsonCResult.ok) {
|
|
5965
|
+
ancestorsFarToNear.unshift(jsonCResult.data);
|
|
5966
|
+
}
|
|
5967
|
+
}
|
|
5968
|
+
const parent = path.dirname(current);
|
|
5969
|
+
if (parent === current) {
|
|
5970
|
+
break;
|
|
5971
|
+
}
|
|
5972
|
+
current = parent;
|
|
5973
|
+
}
|
|
5974
|
+
return ancestorsFarToNear.reduce(mergeManifestDefaults, rootSockJson);
|
|
5975
|
+
}
|
|
5900
5976
|
function getDefaultSocketJson() {
|
|
5901
5977
|
return {
|
|
5902
5978
|
' _____ _ _ ': `Local config file for Socket CLI tool ( ${constants.SOCKET_WEBSITE_URL}/npm/package/${constants.SOCKET_JSON.replace('.json', '')} ), to work with ${constants.SOCKET_WEBSITE_URL}`,
|
|
@@ -7330,6 +7406,228 @@ async function detectAndValidatePackageEnvironment(cwd, options) {
|
|
|
7330
7406
|
};
|
|
7331
7407
|
}
|
|
7332
7408
|
|
|
7409
|
+
/**
|
|
7410
|
+
* GitHub API error detection for the raw-fetch `socket scan github` flow.
|
|
7411
|
+
*
|
|
7412
|
+
* The `socket scan github` command talks to the GitHub REST API directly
|
|
7413
|
+
* through `apiFetch` (see utils/api.mts) rather than Octokit. That path used
|
|
7414
|
+
* to read every response body and JSON-parse it without ever inspecting the
|
|
7415
|
+
* HTTP status, so a rate-limit response (`403` with `x-ratelimit-remaining: 0`,
|
|
7416
|
+
* `429`, or a secondary-limit body) was misread as "repo has no default
|
|
7417
|
+
* branch / no manifests" and the run reported a silent success.
|
|
7418
|
+
*
|
|
7419
|
+
* This module centralizes:
|
|
7420
|
+
* - Classifying a GitHub response as a blocking error (rate limit / abuse
|
|
7421
|
+
* detection / auth) with a clear, actionable message.
|
|
7422
|
+
* - A bounded-retry request wrapper that respects `Retry-After` /
|
|
7423
|
+
* `x-ratelimit-reset` for short reset windows and retries transient 5xx /
|
|
7424
|
+
* network failures with capped exponential backoff.
|
|
7425
|
+
*/
|
|
7426
|
+
|
|
7427
|
+
// GitHub returns 429 for some secondary rate limits; there is no shared
|
|
7428
|
+
// constant for it in constants.mts, so define it locally.
|
|
7429
|
+
const HTTP_STATUS_TOO_MANY_REQUESTS = 429;
|
|
7430
|
+
|
|
7431
|
+
// Retry at most this many times for transient (5xx / network) failures,
|
|
7432
|
+
// counting the initial attempt.
|
|
7433
|
+
const MAX_TRANSIENT_ATTEMPTS = 3;
|
|
7434
|
+
|
|
7435
|
+
// Cap for exponential backoff between transient retries.
|
|
7436
|
+
const MAX_BACKOFF_MS = 10_000;
|
|
7437
|
+
|
|
7438
|
+
// Only wait-and-retry a rate-limited response when the reset window is at
|
|
7439
|
+
// most this many seconds. The usual primary-limit reset is up to an hour
|
|
7440
|
+
// away, which is not worth blocking a CLI run on — those surface immediately.
|
|
7441
|
+
const CHEAP_RATE_LIMIT_WAIT_MAX_SECONDS = 30;
|
|
7442
|
+
|
|
7443
|
+
// Canonical `message` values returned for blocking conditions. Exported so
|
|
7444
|
+
// the scan loop can short-circuit on them without matching free-form strings.
|
|
7445
|
+
const GITHUB_ERR_ABUSE_DETECTION = 'GitHub abuse detection triggered';
|
|
7446
|
+
const GITHUB_ERR_AUTH_FAILED = 'GitHub authentication failed';
|
|
7447
|
+
const GITHUB_ERR_RATE_LIMIT = 'GitHub rate limit exceeded';
|
|
7448
|
+
|
|
7449
|
+
// A blocking error means every subsequent repo will fail for the same
|
|
7450
|
+
// reason, so the scan loop should stop and surface it rather than silently
|
|
7451
|
+
// reporting "0 manifests".
|
|
7452
|
+
const BLOCKING_ERROR_MESSAGES = new Set([GITHUB_ERR_ABUSE_DETECTION, GITHUB_ERR_AUTH_FAILED, GITHUB_ERR_RATE_LIMIT]);
|
|
7453
|
+
|
|
7454
|
+
/**
|
|
7455
|
+
* Whether a CResult `message` is one of the blocking GitHub conditions
|
|
7456
|
+
* (rate limit / abuse detection / auth) that should stop a multi-repo scan.
|
|
7457
|
+
*/
|
|
7458
|
+
function isGitHubBlockingError(message) {
|
|
7459
|
+
return BLOCKING_ERROR_MESSAGES.has(message);
|
|
7460
|
+
}
|
|
7461
|
+
|
|
7462
|
+
/**
|
|
7463
|
+
* Seconds to wait before a rate-limited request could succeed, derived from
|
|
7464
|
+
* the `Retry-After` header (seconds) or the `x-ratelimit-reset` header (an
|
|
7465
|
+
* epoch-seconds timestamp). Returns undefined when neither is usable.
|
|
7466
|
+
*/
|
|
7467
|
+
function getRateLimitWaitSeconds(headers) {
|
|
7468
|
+
const retryAfter = headers.get('retry-after');
|
|
7469
|
+
if (retryAfter) {
|
|
7470
|
+
const seconds = Number.parseInt(retryAfter, 10);
|
|
7471
|
+
if (Number.isFinite(seconds) && seconds >= 0) {
|
|
7472
|
+
return seconds;
|
|
7473
|
+
}
|
|
7474
|
+
}
|
|
7475
|
+
const reset = headers.get('x-ratelimit-reset');
|
|
7476
|
+
if (reset) {
|
|
7477
|
+
const resetEpochSeconds = Number.parseInt(reset, 10);
|
|
7478
|
+
if (Number.isFinite(resetEpochSeconds)) {
|
|
7479
|
+
return Math.max(0, resetEpochSeconds - Math.floor(Date.now() / 1000));
|
|
7480
|
+
}
|
|
7481
|
+
}
|
|
7482
|
+
return undefined;
|
|
7483
|
+
}
|
|
7484
|
+
|
|
7485
|
+
/**
|
|
7486
|
+
* Classify a GitHub API response as a blocking error (rate limit / abuse
|
|
7487
|
+
* detection / auth). Returns undefined when the response is not one of those
|
|
7488
|
+
* conditions, so the caller can continue its normal parsing (including its
|
|
7489
|
+
* own handling of 404s, empty repos, etc.).
|
|
7490
|
+
*/
|
|
7491
|
+
function classifyGitHubResponse(status, headers, bodyText, context) {
|
|
7492
|
+
const lowerBody = bodyText.toLowerCase();
|
|
7493
|
+
|
|
7494
|
+
// Secondary / abuse rate limit. Check first since it is more specific than
|
|
7495
|
+
// the standard rate limit and shares the 403 status.
|
|
7496
|
+
if (status === constants.HTTP_STATUS_FORBIDDEN && (lowerBody.includes('secondary rate limit') || lowerBody.includes('abuse detection'))) {
|
|
7497
|
+
return {
|
|
7498
|
+
ok: false,
|
|
7499
|
+
message: GITHUB_ERR_ABUSE_DETECTION,
|
|
7500
|
+
cause: `GitHub abuse detection triggered while ${context}. ` + 'This happens when too many requests are made in a short period. ' + 'Wait a minute before retrying, and reduce the number of repos ' + 'scanned at once.'
|
|
7501
|
+
};
|
|
7502
|
+
}
|
|
7503
|
+
|
|
7504
|
+
// Standard rate limit: 429, or 403 with the quota exhausted
|
|
7505
|
+
// (x-ratelimit-remaining: 0) or a rate-limit message in the body.
|
|
7506
|
+
const remaining = headers.get('x-ratelimit-remaining');
|
|
7507
|
+
if (status === HTTP_STATUS_TOO_MANY_REQUESTS || status === constants.HTTP_STATUS_FORBIDDEN && (remaining === '0' || lowerBody.includes('rate limit'))) {
|
|
7508
|
+
const waitSeconds = getRateLimitWaitSeconds(headers);
|
|
7509
|
+
const resetHint = waitSeconds === undefined ? 'Try again in a few minutes.' : `Try again in ${waitSeconds} second${waitSeconds === 1 ? '' : 's'}.`;
|
|
7510
|
+
return {
|
|
7511
|
+
ok: false,
|
|
7512
|
+
message: GITHUB_ERR_RATE_LIMIT,
|
|
7513
|
+
cause: `GitHub API rate limit exceeded on the supplied token while ${context}. ` + `${resetHint} ` + 'Authenticated requests get a far higher rate limit than ' + 'unauthenticated ones — set a valid GITHUB_TOKEN (or pass ' + '--github-token) if you have not already.'
|
|
7514
|
+
};
|
|
7515
|
+
}
|
|
7516
|
+
|
|
7517
|
+
// Authentication failure. The token is invalid/expired or lacks scopes;
|
|
7518
|
+
// retrying with the same token will not help.
|
|
7519
|
+
if (status === constants.HTTP_STATUS_UNAUTHORIZED) {
|
|
7520
|
+
return {
|
|
7521
|
+
ok: false,
|
|
7522
|
+
message: GITHUB_ERR_AUTH_FAILED,
|
|
7523
|
+
cause: `GitHub authentication failed while ${context}. ` + 'The token may be invalid, expired, or missing required scopes ' + '(read access to repository contents). Provide a valid GITHUB_TOKEN ' + '(or pass --github-token) and retry.'
|
|
7524
|
+
};
|
|
7525
|
+
}
|
|
7526
|
+
return undefined;
|
|
7527
|
+
}
|
|
7528
|
+
function backoffMs(attempt) {
|
|
7529
|
+
return Math.min(1000 * 2 ** (attempt - 1), MAX_BACKOFF_MS);
|
|
7530
|
+
}
|
|
7531
|
+
function sleep(ms) {
|
|
7532
|
+
return new Promise(resolve => {
|
|
7533
|
+
setTimeout(resolve, ms);
|
|
7534
|
+
});
|
|
7535
|
+
}
|
|
7536
|
+
|
|
7537
|
+
/**
|
|
7538
|
+
* Perform a GitHub REST request through `apiFetch`, detecting rate-limit /
|
|
7539
|
+
* auth / abuse-detection responses up front and applying bounded retries.
|
|
7540
|
+
*
|
|
7541
|
+
* On success returns the response together with its already-read body text
|
|
7542
|
+
* (the body stream can only be consumed once). On a blocking or exhausted
|
|
7543
|
+
* transient failure returns a typed CResult error. Non-blocking non-2xx
|
|
7544
|
+
* responses (e.g. 404, or GitHub's "empty repository" 200) are returned as
|
|
7545
|
+
* successes so the caller keeps its existing body-parsing logic.
|
|
7546
|
+
*
|
|
7547
|
+
* Retry policy:
|
|
7548
|
+
* - Rate limit / abuse: wait once for the reset window, but only when it is
|
|
7549
|
+
* short (<= CHEAP_RATE_LIMIT_WAIT_MAX_SECONDS); otherwise surface the error
|
|
7550
|
+
* immediately. Long primary-limit resets are not worth blocking on.
|
|
7551
|
+
* - Auth: never retried.
|
|
7552
|
+
* - 5xx / network: capped exponential backoff, MAX_TRANSIENT_ATTEMPTS total.
|
|
7553
|
+
*/
|
|
7554
|
+
async function githubApiRequest(url, init, context,
|
|
7555
|
+
// Injectable request implementation. Defaults to the real `apiFetch`;
|
|
7556
|
+
// tests pass a fake so the retry/backoff logic can be exercised without
|
|
7557
|
+
// touching the network.
|
|
7558
|
+
fetchImpl = apiFetch) {
|
|
7559
|
+
const method = init.method || 'GET';
|
|
7560
|
+
let rateLimitWaitUsed = false;
|
|
7561
|
+
for (let attempt = 1;; attempt += 1) {
|
|
7562
|
+
debugApiRequest(method, url);
|
|
7563
|
+
let response;
|
|
7564
|
+
try {
|
|
7565
|
+
// eslint-disable-next-line no-await-in-loop
|
|
7566
|
+
response = await fetchImpl(url, init);
|
|
7567
|
+
debugApiResponse(method, url, response.status);
|
|
7568
|
+
} catch (e) {
|
|
7569
|
+
debugApiResponse(method, url, undefined, e);
|
|
7570
|
+
// Network-level failure (DNS, connection reset, timeout). Retry a few
|
|
7571
|
+
// times with bounded backoff before giving up.
|
|
7572
|
+
if (attempt < MAX_TRANSIENT_ATTEMPTS) {
|
|
7573
|
+
debug$2.debugFn('notice', `retry: network error while ${context}`, attempt);
|
|
7574
|
+
// eslint-disable-next-line no-await-in-loop
|
|
7575
|
+
await sleep(backoffMs(attempt));
|
|
7576
|
+
continue;
|
|
7577
|
+
}
|
|
7578
|
+
return {
|
|
7579
|
+
ok: false,
|
|
7580
|
+
message: 'Network error connecting to GitHub',
|
|
7581
|
+
cause: formatErrorWithDetail(`Network error while ${context}`, e)
|
|
7582
|
+
};
|
|
7583
|
+
}
|
|
7584
|
+
|
|
7585
|
+
// eslint-disable-next-line no-await-in-loop
|
|
7586
|
+
const bodyText = await response.text();
|
|
7587
|
+
const blocking = classifyGitHubResponse(response.status, response.headers, bodyText, context);
|
|
7588
|
+
if (blocking) {
|
|
7589
|
+
// Auth failures never succeed on retry.
|
|
7590
|
+
if (blocking.message === GITHUB_ERR_AUTH_FAILED) {
|
|
7591
|
+
return blocking;
|
|
7592
|
+
}
|
|
7593
|
+
// Rate limit / abuse: retry once, but only when the reset window is
|
|
7594
|
+
// short enough to be worth waiting on.
|
|
7595
|
+
const waitSeconds = getRateLimitWaitSeconds(response.headers);
|
|
7596
|
+
if (!rateLimitWaitUsed && waitSeconds !== undefined && waitSeconds <= CHEAP_RATE_LIMIT_WAIT_MAX_SECONDS) {
|
|
7597
|
+
rateLimitWaitUsed = true;
|
|
7598
|
+
logger.logger.info(`GitHub rate limit hit while ${context}; waiting ${waitSeconds}s before one retry...`);
|
|
7599
|
+
// Add a second of slack so we retry just past the reset boundary.
|
|
7600
|
+
// eslint-disable-next-line no-await-in-loop
|
|
7601
|
+
await sleep((waitSeconds + 1) * 1000);
|
|
7602
|
+
continue;
|
|
7603
|
+
}
|
|
7604
|
+
return blocking;
|
|
7605
|
+
}
|
|
7606
|
+
|
|
7607
|
+
// Transient server errors: retry with bounded backoff, then surface.
|
|
7608
|
+
if (response.status >= constants.HTTP_STATUS_INTERNAL_SERVER_ERROR) {
|
|
7609
|
+
if (attempt < MAX_TRANSIENT_ATTEMPTS) {
|
|
7610
|
+
debug$2.debugFn('notice', `retry: GitHub ${response.status} while ${context}`, attempt);
|
|
7611
|
+
// eslint-disable-next-line no-await-in-loop
|
|
7612
|
+
await sleep(backoffMs(attempt));
|
|
7613
|
+
continue;
|
|
7614
|
+
}
|
|
7615
|
+
return {
|
|
7616
|
+
ok: false,
|
|
7617
|
+
message: 'GitHub server error',
|
|
7618
|
+
cause: `GitHub server error (${response.status}) while ${context}. ` + 'GitHub may be experiencing issues; try again shortly.'
|
|
7619
|
+
};
|
|
7620
|
+
}
|
|
7621
|
+
return {
|
|
7622
|
+
ok: true,
|
|
7623
|
+
data: {
|
|
7624
|
+
response,
|
|
7625
|
+
bodyText
|
|
7626
|
+
}
|
|
7627
|
+
};
|
|
7628
|
+
}
|
|
7629
|
+
}
|
|
7630
|
+
|
|
7333
7631
|
// Check the public npm registry for a newer socket release.
|
|
7334
7632
|
async function runSelfUpdateCheck() {
|
|
7335
7633
|
await vendor.updater({
|
|
@@ -8424,6 +8722,7 @@ exports.apiFetch = apiFetch;
|
|
|
8424
8722
|
exports.cacheFetch = cacheFetch;
|
|
8425
8723
|
exports.captureException = captureException;
|
|
8426
8724
|
exports.checkCommandInput = checkCommandInput;
|
|
8725
|
+
exports.classifyGitHubResponse = classifyGitHubResponse;
|
|
8427
8726
|
exports.cmdFlagValueToArray = cmdFlagValueToArray;
|
|
8428
8727
|
exports.cmdFlagsToString = cmdFlagsToString;
|
|
8429
8728
|
exports.cmdPrefixMessage = cmdPrefixMessage;
|
|
@@ -8460,6 +8759,7 @@ exports.getDefaultOrgSlug = getDefaultOrgSlug;
|
|
|
8460
8759
|
exports.getEcosystemChoicesForMeow = getEcosystemChoicesForMeow;
|
|
8461
8760
|
exports.getEnterpriseOrgs = getEnterpriseOrgs;
|
|
8462
8761
|
exports.getErrorCause = getErrorCause;
|
|
8762
|
+
exports.getErrorMessageOr = getErrorMessageOr;
|
|
8463
8763
|
exports.getFlagApiRequirementsOutput = getFlagApiRequirementsOutput;
|
|
8464
8764
|
exports.getFlagListOutput = getFlagListOutput;
|
|
8465
8765
|
exports.getMajor = getMajor;
|
|
@@ -8490,6 +8790,8 @@ exports.gitPushBranch = gitPushBranch;
|
|
|
8490
8790
|
exports.gitRemoteBranchExists = gitRemoteBranchExists;
|
|
8491
8791
|
exports.gitResetAndClean = gitResetAndClean;
|
|
8492
8792
|
exports.gitUnstagedModifiedFiles = gitUnstagedModifiedFiles;
|
|
8793
|
+
exports.githubApiRequest = githubApiRequest;
|
|
8794
|
+
exports.globWithGitIgnore = globWithGitIgnore;
|
|
8493
8795
|
exports.globWorkspace = globWorkspace;
|
|
8494
8796
|
exports.handleApiCall = handleApiCall;
|
|
8495
8797
|
exports.handleApiCallNoSpinner = handleApiCallNoSpinner;
|
|
@@ -8502,6 +8804,7 @@ exports.installPnpmLinks = installPnpmLinks;
|
|
|
8502
8804
|
exports.installYarnLinks = installYarnLinks;
|
|
8503
8805
|
exports.isAddCommand = isAddCommand;
|
|
8504
8806
|
exports.isConfigFromFlag = isConfigFromFlag;
|
|
8807
|
+
exports.isGitHubBlockingError = isGitHubBlockingError;
|
|
8505
8808
|
exports.isHelpFlag = isHelpFlag;
|
|
8506
8809
|
exports.isPnpmLockfileScanCommand = isPnpmLockfileScanCommand;
|
|
8507
8810
|
exports.isReportSupportedFile = isReportSupportedFile;
|
|
@@ -8526,6 +8829,7 @@ exports.queryApiSafeTextWithStatus = queryApiSafeTextWithStatus;
|
|
|
8526
8829
|
exports.readOrDefaultSocketJson = readOrDefaultSocketJson;
|
|
8527
8830
|
exports.readOrDefaultSocketJsonUp = readOrDefaultSocketJsonUp;
|
|
8528
8831
|
exports.readPnpmLockfile = readPnpmLockfile;
|
|
8832
|
+
exports.readSocketJsonCascade = readSocketJsonCascade;
|
|
8529
8833
|
exports.readSocketJsonSync = readSocketJsonSync;
|
|
8530
8834
|
exports.runAgentInstall = runAgentInstall;
|
|
8531
8835
|
exports.runSelfUpdateCheck = runSelfUpdateCheck;
|
|
@@ -8556,5 +8860,5 @@ exports.walkNestedMap = walkNestedMap;
|
|
|
8556
8860
|
exports.webLink = webLink;
|
|
8557
8861
|
exports.withTmpDir = withTmpDir;
|
|
8558
8862
|
exports.writeSocketJson = writeSocketJson;
|
|
8559
|
-
//# debugId=
|
|
8863
|
+
//# debugId=588541a6-eef9-410e-a3c6-6f594e50db6b
|
|
8560
8864
|
//# sourceMappingURL=utils.js.map
|