@socketsecurity/cli-with-sentry 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +123 -324
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +3 -3
- package/dist/constants.js.map +1 -1
- package/dist/shadow-npm-bin.js +4 -4
- package/dist/shadow-npm-bin.js.map +1 -1
- package/dist/shadow-npm-inject.js +4 -4
- package/dist/shadow-npm-inject.js.map +1 -1
- package/dist/socket-completion.bash +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/fix/cmd-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/coana-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/{fix-env-helpers.d.mts → env-helpers.d.mts} +1 -1
- package/dist/types/commands/fix/env-helpers.d.mts.map +1 -0
- package/dist/types/commands/fix/git.d.mts +13 -0
- package/dist/types/commands/fix/git.d.mts.map +1 -0
- package/dist/types/commands/fix/pull-request.d.mts +10 -53
- package/dist/types/commands/fix/pull-request.d.mts.map +1 -1
- package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts +2 -0
- package/dist/types/commands/scan/fetch-supported-scan-file-names.d.mts.map +1 -1
- package/dist/types/shadow/npm/paths.d.mts +0 -1
- package/dist/types/shadow/npm/paths.d.mts.map +1 -1
- package/dist/types/utils/fs.d.mts +0 -1
- package/dist/types/utils/fs.d.mts.map +1 -1
- package/dist/types/utils/github.d.mts +38 -0
- package/dist/types/utils/github.d.mts.map +1 -0
- package/dist/types/utils/glob.d.mts +0 -1
- package/dist/types/utils/glob.d.mts.map +1 -1
- package/dist/utils.js +205 -18
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +55 -49
- package/external/@socketsecurity/registry/external/libnpmpack.js +96569 -41361
- package/external/@socketsecurity/registry/external/pacote.js +77357 -68133
- package/external/@socketsecurity/registry/lib/fs.js +13 -27
- package/external/@socketsecurity/registry/lib/json.js +42 -0
- package/external/@socketsecurity/registry/manifest.json +4 -4
- package/package.json +7 -7
- package/dist/types/commands/fix/fix-branch-helpers.d.mts +0 -4
- package/dist/types/commands/fix/fix-branch-helpers.d.mts.map +0 -1
- package/dist/types/commands/fix/fix-env-helpers.d.mts.map +0 -1
- package/dist/types/commands/fix/socket-git.d.mts +0 -32
- package/dist/types/commands/fix/socket-git.d.mts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmd-fix.d.mts","sourceRoot":"","sources":["../../../../src/commands/fix/cmd-fix.mts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,QAAQ,QAAQ,CAAA;AAQ7B,eAAO,MAAM,MAAM;;;;CAIlB,CAAA;AAED,iBAAe,GAAG,CAChB,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EAClC,UAAU,EAAE,UAAU,EACtB,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GACrC,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"cmd-fix.d.mts","sourceRoot":"","sources":["../../../../src/commands/fix/cmd-fix.mts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,QAAQ,QAAQ,CAAA;AAQ7B,eAAO,MAAM,MAAM;;;;CAIlB,CAAA;AAED,iBAAe,GAAG,CAChB,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EAClC,UAAU,EAAE,UAAU,EACtB,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GACrC,OAAO,CAAC,IAAI,CAAC,CA8Nf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coana-fix.d.mts","sourceRoot":"","sources":["../../../../src/commands/fix/coana-fix.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coana-fix.d.mts","sourceRoot":"","sources":["../../../../src/commands/fix/coana-fix.mts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAE9C,wBAAsB,QAAQ,CAC5B,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC,CA+StC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-helpers.d.mts","sourceRoot":"","sources":["../../../../src/commands/fix/env-helpers.mts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAkBnD,MAAM,WAAW,MAAM;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,OAAO,CAAA;IACb,GAAG,EAAE,OAAO,EAAE,CAAA;IACd,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;CAC1B;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAuDjD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GhsaDetails } from '../../utils/github.mts';
|
|
2
|
+
export type SocketFixBranchParser = (branch: string) => SocketFixBranchParseResult | null;
|
|
3
|
+
export type SocketFixBranchParseResult = {
|
|
4
|
+
ghsaId: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function createSocketFixBranchParser(ghsaId?: string | undefined): SocketFixBranchParser;
|
|
7
|
+
export declare const genericSocketFixBranchParser: SocketFixBranchParser;
|
|
8
|
+
export declare function getSocketFixBranchName(ghsaId: string): string;
|
|
9
|
+
export declare function getSocketFixBranchPattern(ghsaId?: string | undefined): RegExp;
|
|
10
|
+
export declare function getSocketFixCommitMessage(ghsaId: string, details?: GhsaDetails | undefined): string;
|
|
11
|
+
export declare function getSocketFixPullRequestBody(ghsaIds: string[], ghsaDetails?: Map<string, GhsaDetails>): string;
|
|
12
|
+
export declare function getSocketFixPullRequestTitle(ghsaIds: string[]): string;
|
|
13
|
+
//# sourceMappingURL=git.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.mts","sourceRoot":"","sources":["../../../../src/commands/fix/git.mts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAIzD,MAAM,MAAM,qBAAqB,GAAG,CAClC,MAAM,EAAE,MAAM,KACX,0BAA0B,GAAG,IAAI,CAAA;AAEtC,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,wBAAgB,2BAA2B,CACzC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAC1B,qBAAqB,CAUvB;AAED,eAAO,MAAM,4BAA4B,uBAAgC,CAAA;AAEzE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,yBAAyB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAE7E;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,GAChC,MAAM,CAGR;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,EAAE,EACjB,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GACrC,MAAM,CAuCR;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAKtE"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PackageURL } from '@socketregistry/packageurl-js';
|
|
3
|
-
import type { SocketArtifact } from '../../utils/alert/artifact.mts';
|
|
4
|
-
import type { components } from '@octokit/openapi-types';
|
|
1
|
+
import { type GhsaDetails, type Pr } from '../../utils/github.mts';
|
|
5
2
|
import type { OctokitResponse } from '@octokit/types';
|
|
6
|
-
export
|
|
7
|
-
|
|
3
|
+
export type OpenSocketFixPrOptions = {
|
|
4
|
+
baseBranch?: string | undefined;
|
|
5
|
+
cwd?: string | undefined;
|
|
6
|
+
ghsaDetails?: Map<string, GhsaDetails> | undefined;
|
|
7
|
+
};
|
|
8
|
+
export declare function openSocketFixPr(owner: string, repo: string, branch: string, ghsaIds: string[], options?: OpenSocketFixPrOptions | undefined): Promise<OctokitResponse<Pr> | null>;
|
|
8
9
|
export type GQL_MERGE_STATE_STATUS = 'BEHIND' | 'BLOCKED' | 'CLEAN' | 'DIRTY' | 'DRAFT' | 'HAS_HOOKS' | 'UNKNOWN' | 'UNSTABLE';
|
|
9
10
|
export type GQL_PR_STATE = 'OPEN' | 'CLOSED' | 'MERGED';
|
|
10
11
|
export type PrMatch = {
|
|
@@ -16,59 +17,15 @@ export type PrMatch = {
|
|
|
16
17
|
state: GQL_PR_STATE;
|
|
17
18
|
title: string;
|
|
18
19
|
};
|
|
19
|
-
export declare function
|
|
20
|
-
export type GhsaDetails = {
|
|
21
|
-
ghsaId: string;
|
|
22
|
-
cveId?: string;
|
|
23
|
-
summary: string;
|
|
24
|
-
severity: string;
|
|
25
|
-
publishedAt: string;
|
|
26
|
-
withdrawnAt?: string;
|
|
27
|
-
references: Array<{
|
|
28
|
-
url: string;
|
|
29
|
-
}>;
|
|
30
|
-
vulnerabilities: {
|
|
31
|
-
nodes: Array<{
|
|
32
|
-
package: {
|
|
33
|
-
ecosystem: string;
|
|
34
|
-
name: string;
|
|
35
|
-
};
|
|
36
|
-
vulnerableVersionRange: string;
|
|
37
|
-
}>;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export declare function fetchGhsaDetails(ids: string[]): Promise<Map<string, GhsaDetails>>;
|
|
41
|
-
export type CleanupPrsOptions = {
|
|
42
|
-
newVersion?: string | undefined;
|
|
43
|
-
purl?: string | undefined;
|
|
44
|
-
workspace?: string | undefined;
|
|
45
|
-
};
|
|
46
|
-
export declare function cleanupPrs(owner: string, repo: string, options?: CleanupPrsOptions | undefined): Promise<PrMatch[]>;
|
|
20
|
+
export declare function cleanupPrs(owner: string, repo: string, ghsaId: string): Promise<PrMatch[]>;
|
|
47
21
|
export type PrAutoMergeState = {
|
|
48
22
|
enabled: boolean;
|
|
49
23
|
details?: string[];
|
|
50
24
|
};
|
|
51
|
-
export declare function enablePrAutoMerge({ node_id: prId }: Pr): Promise<PrAutoMergeState>;
|
|
52
25
|
export type SocketPrsOptions = {
|
|
53
26
|
author?: string | undefined;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
states?: string[] | string | undefined;
|
|
57
|
-
workspace?: string | undefined;
|
|
27
|
+
ghsaId?: string | undefined;
|
|
28
|
+
states?: 'all' | GQL_PR_STATE | GQL_PR_STATE[];
|
|
58
29
|
};
|
|
59
30
|
export declare function getSocketPrs(owner: string, repo: string, options?: SocketPrsOptions | undefined): Promise<PrMatch[]>;
|
|
60
|
-
export type OpenPrOptions = {
|
|
61
|
-
baseBranch?: string | undefined;
|
|
62
|
-
cwd?: string | undefined;
|
|
63
|
-
workspace?: string | undefined;
|
|
64
|
-
};
|
|
65
|
-
export declare function openPr(owner: string, repo: string, branch: string, purl: string | PackageURL | SocketArtifact, newVersion: string, options?: OpenPrOptions | undefined): Promise<OctokitResponse<Pr> | null>;
|
|
66
|
-
export type OpenCoanaPrOptions = {
|
|
67
|
-
baseBranch?: string | undefined;
|
|
68
|
-
cwd?: string | undefined;
|
|
69
|
-
ghsaDetails?: Map<string, GhsaDetails> | undefined;
|
|
70
|
-
};
|
|
71
|
-
export declare function openCoanaPr(owner: string, repo: string, branch: string, ghsaIds: string[], options?: OpenCoanaPrOptions | undefined): Promise<OctokitResponse<Pr> | null>;
|
|
72
|
-
export declare function prExistForBranch(owner: string, repo: string, branch: string): Promise<boolean>;
|
|
73
|
-
export declare function setGitRemoteGithubRepoUrl(owner: string, repo: string, token: string, cwd?: string): Promise<boolean>;
|
|
74
31
|
//# sourceMappingURL=pull-request.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull-request.d.mts","sourceRoot":"","sources":["../../../../src/commands/fix/pull-request.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pull-request.d.mts","sourceRoot":"","sources":["../../../../src/commands/fix/pull-request.mts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,EAAE,EAKR,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGrD,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,SAAS,CAAA;CACnD,CAAA;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,CAAC,EAAE,sBAAsB,GAAG,SAAS,GAC3C,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAqCrC;AAED,MAAM,MAAM,sBAAsB,GAC9B,QAAQ,GACR,SAAS,GACT,OAAO,GACP,OAAO,GACP,OAAO,GACP,WAAW,GACX,SAAS,GACT,UAAU,CAAA;AAEd,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEvD,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,sBAAsB,CAAA;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,YAAY,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,wBAAsB,UAAU,CAC9B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,EAAE,CAAC,CAyDpB;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,MAAM,CAAC,EAAE,KAAK,GAAG,YAAY,GAAG,YAAY,EAAE,CAAA;CAC/C,CAAA;AAED,wBAAsB,YAAY,CAChC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,GACrC,OAAO,CAAC,OAAO,EAAE,CAAC,CAEpB"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { CResult } from '../../types.mts';
|
|
2
2
|
import type { SetupSdkOptions } from '../../utils/sdk.mts';
|
|
3
|
+
import type { Spinner } from '@socketsecurity/registry/lib/spinner';
|
|
3
4
|
import type { SocketSdkSuccessResult } from '@socketsecurity/sdk';
|
|
4
5
|
export type FetchSupportedScanFileNamesOptions = {
|
|
5
6
|
sdkOpts?: SetupSdkOptions | undefined;
|
|
7
|
+
spinner?: Spinner | undefined;
|
|
6
8
|
};
|
|
7
9
|
export declare function fetchSupportedScanFileNames(options?: FetchSupportedScanFileNamesOptions | undefined): Promise<CResult<SocketSdkSuccessResult<'getReportSupportedFiles'>['data']>>;
|
|
8
10
|
//# sourceMappingURL=fetch-supported-scan-file-names.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-supported-scan-file-names.d.mts","sourceRoot":"","sources":["../../../../src/commands/scan/fetch-supported-scan-file-names.mts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAEjE,MAAM,MAAM,kCAAkC,GAAG;IAC/C,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"fetch-supported-scan-file-names.d.mts","sourceRoot":"","sources":["../../../../src/commands/scan/fetch-supported-scan-file-names.mts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAEjE,MAAM,MAAM,kCAAkC,GAAG;IAC/C,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAA;IACrC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B,CAAA;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,CAAC,EAAE,kCAAkC,GAAG,SAAS,GACvD,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAgB7E"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare function getArboristPackagePath(): string;
|
|
2
2
|
export declare function getArboristClassPath(): string;
|
|
3
|
-
export declare function getArboristDepValidPath(): string;
|
|
4
3
|
export declare function getArboristEdgeClassPath(): string;
|
|
5
4
|
export declare function getArboristNodeClassPath(): string;
|
|
6
5
|
export declare function getArboristOverrideSetClassPath(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.mts","sourceRoot":"","sources":["../../../../src/shadow/npm/paths.mts"],"names":[],"mappings":"AAQA,wBAAgB,sBAAsB,WAerC;AAGD,wBAAgB,oBAAoB,WAQnC;AAGD,wBAAgB,
|
|
1
|
+
{"version":3,"file":"paths.d.mts","sourceRoot":"","sources":["../../../../src/shadow/npm/paths.mts"],"names":[],"mappings":"AAQA,wBAAgB,sBAAsB,WAerC;AAGD,wBAAgB,oBAAoB,WAQnC;AAGD,wBAAgB,wBAAwB,WAKvC;AAGD,wBAAgB,wBAAwB,WAKvC;AAGD,wBAAgB,+BAA+B,WAQ9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.mts","sourceRoot":"","sources":["../../../src/utils/fs.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fs.d.mts","sourceRoot":"","sources":["../../../src/utils/fs.mts"],"names":[],"mappings":"AAKA,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACrC,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;CACjC,CAAA;AAED,wBAAsB,MAAM,CAC1B,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,GAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAiC7B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { graphql as OctokitGraphql } from '@octokit/graphql';
|
|
2
|
+
import { Octokit } from '@octokit/rest';
|
|
3
|
+
import type { components } from '@octokit/openapi-types';
|
|
4
|
+
import type { JsonContent } from '@socketsecurity/registry/lib/fs';
|
|
5
|
+
export type Pr = components['schemas']['pull-request'];
|
|
6
|
+
export declare function writeCache(key: string, data: JsonContent): Promise<void>;
|
|
7
|
+
export declare function cacheFetch<T>(key: string, fetcher: () => Promise<T>, ttlMs?: number | undefined): Promise<T>;
|
|
8
|
+
export type GhsaDetails = {
|
|
9
|
+
ghsaId: string;
|
|
10
|
+
cveId?: string;
|
|
11
|
+
summary: string;
|
|
12
|
+
severity: string;
|
|
13
|
+
publishedAt: string;
|
|
14
|
+
withdrawnAt?: string;
|
|
15
|
+
references: Array<{
|
|
16
|
+
url: string;
|
|
17
|
+
}>;
|
|
18
|
+
vulnerabilities: {
|
|
19
|
+
nodes: Array<{
|
|
20
|
+
package: {
|
|
21
|
+
ecosystem: string;
|
|
22
|
+
name: string;
|
|
23
|
+
};
|
|
24
|
+
vulnerableVersionRange: string;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare function fetchGhsaDetails(ids: string[]): Promise<Map<string, GhsaDetails>>;
|
|
29
|
+
export declare function getOctokit(): Octokit;
|
|
30
|
+
export declare function getOctokitGraphql(): typeof OctokitGraphql;
|
|
31
|
+
export type PrAutoMergeState = {
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
details?: string[];
|
|
34
|
+
};
|
|
35
|
+
export declare function enablePrAutoMerge({ node_id: prId }: Pr): Promise<PrAutoMergeState>;
|
|
36
|
+
export declare function prExistForBranch(owner: string, repo: string, branch: string): Promise<boolean>;
|
|
37
|
+
export declare function setGitRemoteGithubRepoUrl(owner: string, repo: string, token: string, cwd?: string): Promise<boolean>;
|
|
38
|
+
//# sourceMappingURL=github.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.d.mts","sourceRoot":"","sources":["../../../src/utils/github.mts"],"names":[],"mappings":"AAGA,OAAO,EAEL,OAAO,IAAI,cAAc,EAC1B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAYvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAGlE,MAAM,MAAM,EAAE,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAA;AAkBtD,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAsB,UAAU,CAAC,CAAC,EAChC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACzB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GACzB,OAAO,CAAC,CAAC,CAAC,CAWZ;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,KAAK,CAAC;QAChB,GAAG,EAAE,MAAM,CAAA;KACZ,CAAC,CAAA;IACF,eAAe,EAAE;QACf,KAAK,EAAE,KAAK,CAAC;YACX,OAAO,EAAE;gBACP,SAAS,EAAE,MAAM,CAAA;gBACjB,IAAI,EAAE,MAAM,CAAA;aACb,CAAA;YACD,sBAAsB,EAAE,MAAM,CAAA;SAC/B,CAAC,CAAA;KACH,CAAA;CACF,CAAA;AAED,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EAAE,GACZ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CA0DnC;AAGD,wBAAgB,UAAU,IAAI,OAAO,CAcpC;AAGD,wBAAgB,iBAAiB,IAAI,OAAO,cAAc,CAazD;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AAED,wBAAsB,iBAAiB,CAAC,EACtC,OAAO,EAAE,IAAI,EACd,EAAE,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAiChC;AAED,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,OAAO,CAAC,CAalB;AAED,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,SAAgB,GAClB,OAAO,CAAC,OAAO,CAAC,CAiBlB"}
|
|
@@ -8,7 +8,6 @@ type GlobWithGitIgnoreOptions = GlobOptions & {
|
|
|
8
8
|
socketConfig?: SocketYml | undefined;
|
|
9
9
|
};
|
|
10
10
|
export declare function globWithGitIgnore(patterns: string[] | readonly string[], options: GlobWithGitIgnoreOptions): Promise<string[]>;
|
|
11
|
-
export declare function globStreamNodeModules(cwd?: string): Promise<NodeJS.ReadableStream>;
|
|
12
11
|
export declare function globWorkspace(agent: Agent, cwd?: string): Promise<string[]>;
|
|
13
12
|
export declare function isReportSupportedFile(filepath: string, supportedFiles: SocketSdkSuccessResult<'getReportSupportedFiles'>['data']): boolean;
|
|
14
13
|
export declare function pathsToGlobPatterns(paths: string[] | readonly string[]): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glob.d.mts","sourceRoot":"","sources":["../../../src/utils/glob.mts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAA;AAoJvD,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EACvC,cAAc,EAAE,sBAAsB,CAAC,yBAAyB,CAAC,CAAC,MAAM,CAAC,GACxE,MAAM,EAAE,CAGV;AAED,wBAAgB,wBAAwB,CACtC,cAAc,EAAE,sBAAsB,CAAC,yBAAyB,CAAC,CAAC,MAAM,CAAC,GACxE,MAAM,EAAE,CASV;AAED,KAAK,wBAAwB,GAAG,WAAW,GAAG;IAC5C,YAAY,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CACrC,CAAA;AAED,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EACtC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,MAAM,EAAE,CAAC,CA+EnB;AAED,wBAAsB,
|
|
1
|
+
{"version":3,"file":"glob.d.mts","sourceRoot":"","sources":["../../../src/utils/glob.mts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAA;AAoJvD,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EACvC,cAAc,EAAE,sBAAsB,CAAC,yBAAyB,CAAC,CAAC,MAAM,CAAC,GACxE,MAAM,EAAE,CAGV;AAED,wBAAgB,wBAAwB,CACtC,cAAc,EAAE,sBAAsB,CAAC,yBAAyB,CAAC,CAAC,MAAM,CAAC,GACxE,MAAM,EAAE,CASV;AAED,KAAK,wBAAwB,GAAG,WAAW,GAAG;IAC5C,YAAY,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CACrC,CAAA;AAED,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EACtC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,MAAM,EAAE,CAAC,CA+EnB;AAED,wBAAsB,aAAa,CACjC,KAAK,EAAE,KAAK,EACZ,GAAG,SAAgB,GAClB,OAAO,CAAC,MAAM,EAAE,CAAC,CASnB;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,sBAAsB,CAAC,yBAAyB,CAAC,CAAC,MAAM,CAAC,WAI1E;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,GAClC,MAAM,EAAE,CAGV"}
|
package/dist/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ var vendor = require('./vendor.js');
|
|
|
4
4
|
var logger = require('../external/@socketsecurity/registry/lib/logger');
|
|
5
5
|
var strings = require('../external/@socketsecurity/registry/lib/strings');
|
|
6
6
|
var require$$9 = require('../external/@socketsecurity/registry/lib/debug');
|
|
7
|
-
var require$$
|
|
7
|
+
var require$$11 = require('../external/@socketsecurity/registry/lib/objects');
|
|
8
8
|
var arrays = require('../external/@socketsecurity/registry/lib/arrays');
|
|
9
9
|
var path$1 = require('../external/@socketsecurity/registry/lib/path');
|
|
10
10
|
var sorts = require('../external/@socketsecurity/registry/lib/sorts');
|
|
@@ -21,9 +21,9 @@ var shadowNpmBin = require('./shadow-npm-bin.js');
|
|
|
21
21
|
var fs$1 = require('node:fs');
|
|
22
22
|
var promises = require('node:timers/promises');
|
|
23
23
|
var npm = require('../external/@socketsecurity/registry/lib/npm');
|
|
24
|
+
var globs = require('../external/@socketsecurity/registry/lib/globs');
|
|
24
25
|
var packages = require('../external/@socketsecurity/registry/lib/packages');
|
|
25
26
|
var streams = require('../external/@socketsecurity/registry/lib/streams');
|
|
26
|
-
var globs = require('../external/@socketsecurity/registry/lib/globs');
|
|
27
27
|
|
|
28
28
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
29
29
|
const sensitiveConfigKeyLookup = new Set(['apiToken']);
|
|
@@ -760,7 +760,7 @@ cols) {
|
|
|
760
760
|
// Serialize the final result object before printing it
|
|
761
761
|
// All commands that support the --json flag should call this before printing
|
|
762
762
|
function serializeResultJson(data) {
|
|
763
|
-
if (!require$$
|
|
763
|
+
if (!require$$11.isObject(data)) {
|
|
764
764
|
process.exitCode = 1;
|
|
765
765
|
require$$9.debugFn('inspect', {
|
|
766
766
|
data
|
|
@@ -916,7 +916,7 @@ function getHelpListOutput(list, options) {
|
|
|
916
916
|
const names = Object.keys(list).sort(sorts.naturalCompare);
|
|
917
917
|
for (const name of names) {
|
|
918
918
|
const entry = list[name];
|
|
919
|
-
const entryIsObj = require$$
|
|
919
|
+
const entryIsObj = require$$11.isObject(entry);
|
|
920
920
|
if (entryIsObj && 'hidden' in entry && entry?.hidden) {
|
|
921
921
|
continue;
|
|
922
922
|
}
|
|
@@ -1183,10 +1183,10 @@ async function meowWithSubcommands(subcommands, options) {
|
|
|
1183
1183
|
} else {
|
|
1184
1184
|
lines.push('Commands');
|
|
1185
1185
|
lines.push(` ${getHelpListOutput({
|
|
1186
|
-
...require$$
|
|
1186
|
+
...require$$11.toSortedObject(Object.fromEntries(Object.entries(subcommands).filter(({
|
|
1187
1187
|
1: subcommand
|
|
1188
1188
|
}) => !subcommand.hidden))),
|
|
1189
|
-
...require$$
|
|
1189
|
+
...require$$11.toSortedObject(Object.fromEntries(Object.entries(aliases).filter(({
|
|
1190
1190
|
1: alias
|
|
1191
1191
|
}) => {
|
|
1192
1192
|
const {
|
|
@@ -1305,7 +1305,7 @@ function meowOrExit({
|
|
|
1305
1305
|
}
|
|
1306
1306
|
|
|
1307
1307
|
// meow doesn't detect 'version' as an unknown flag, so we do the leg work here.
|
|
1308
|
-
if (!require$$
|
|
1308
|
+
if (!require$$11.hasOwn(config.flags, 'version') && cli.flags['version']) {
|
|
1309
1309
|
// Use `console.error` here instead of `logger.error` to match meow behavior.
|
|
1310
1310
|
console.error('Unknown flag\n--version');
|
|
1311
1311
|
// eslint-disable-next-line n/no-process-exit
|
|
@@ -2521,7 +2521,7 @@ async function findUp(name, options) {
|
|
|
2521
2521
|
try {
|
|
2522
2522
|
// eslint-disable-next-line no-await-in-loop
|
|
2523
2523
|
const stats = await fs$1.promises.stat(thePath);
|
|
2524
|
-
if (!onlyDirectories &&
|
|
2524
|
+
if (!onlyDirectories && stats.isFile()) {
|
|
2525
2525
|
return thePath;
|
|
2526
2526
|
}
|
|
2527
2527
|
if (!onlyFiles && stats.isDirectory()) {
|
|
@@ -2716,6 +2716,188 @@ async function writeSocketJson(cwd, sockJson) {
|
|
|
2716
2716
|
};
|
|
2717
2717
|
}
|
|
2718
2718
|
|
|
2719
|
+
async function readCache(key,
|
|
2720
|
+
// 5 minute in milliseconds time to live (TTL).
|
|
2721
|
+
ttlMs = 5 * 60 * 1000) {
|
|
2722
|
+
const cacheJsonPath = path.join(constants.githubCachePath, `${key}.json`);
|
|
2723
|
+
const stat = fs.safeStatsSync(cacheJsonPath);
|
|
2724
|
+
if (stat) {
|
|
2725
|
+
const isExpired = Date.now() - stat.mtimeMs > ttlMs;
|
|
2726
|
+
if (!isExpired) {
|
|
2727
|
+
return await fs.readJson(cacheJsonPath);
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
return null;
|
|
2731
|
+
}
|
|
2732
|
+
async function writeCache(key, data) {
|
|
2733
|
+
const {
|
|
2734
|
+
githubCachePath
|
|
2735
|
+
} = constants;
|
|
2736
|
+
const cacheJsonPath = path.join(githubCachePath, `${key}.json`);
|
|
2737
|
+
if (!fs$1.existsSync(githubCachePath)) {
|
|
2738
|
+
await fs$1.promises.mkdir(githubCachePath, {
|
|
2739
|
+
recursive: true
|
|
2740
|
+
});
|
|
2741
|
+
}
|
|
2742
|
+
await fs.writeJson(cacheJsonPath, data);
|
|
2743
|
+
}
|
|
2744
|
+
async function cacheFetch(key, fetcher, ttlMs) {
|
|
2745
|
+
// Optionally disable cache.
|
|
2746
|
+
if (constants.ENV.DISABLE_GITHUB_CACHE) {
|
|
2747
|
+
return await fetcher();
|
|
2748
|
+
}
|
|
2749
|
+
let data = await readCache(key, ttlMs);
|
|
2750
|
+
if (!data) {
|
|
2751
|
+
data = await fetcher();
|
|
2752
|
+
await writeCache(key, data);
|
|
2753
|
+
}
|
|
2754
|
+
return data;
|
|
2755
|
+
}
|
|
2756
|
+
async function fetchGhsaDetails(ids) {
|
|
2757
|
+
const results = new Map();
|
|
2758
|
+
if (!ids.length) {
|
|
2759
|
+
return results;
|
|
2760
|
+
}
|
|
2761
|
+
const octokitGraphql = getOctokitGraphql();
|
|
2762
|
+
try {
|
|
2763
|
+
const gqlCacheKey = `${ids.join('-')}-graphql-snapshot`;
|
|
2764
|
+
const aliases = ids.map((id, index) => `advisory${index}: securityAdvisory(ghsaId: "${id}") {
|
|
2765
|
+
ghsaId
|
|
2766
|
+
summary
|
|
2767
|
+
severity
|
|
2768
|
+
publishedAt
|
|
2769
|
+
withdrawnAt
|
|
2770
|
+
vulnerabilities(first: 10) {
|
|
2771
|
+
nodes {
|
|
2772
|
+
package {
|
|
2773
|
+
ecosystem
|
|
2774
|
+
name
|
|
2775
|
+
}
|
|
2776
|
+
vulnerableVersionRange
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
}`).join('\n');
|
|
2780
|
+
const gqlResp = await cacheFetch(gqlCacheKey, () => octokitGraphql(`
|
|
2781
|
+
query {
|
|
2782
|
+
${aliases}
|
|
2783
|
+
}
|
|
2784
|
+
`));
|
|
2785
|
+
for (let i = 0, {
|
|
2786
|
+
length
|
|
2787
|
+
} = ids; i < length; i += 1) {
|
|
2788
|
+
const id = ids[i];
|
|
2789
|
+
const advisoryKey = `advisory${i}`;
|
|
2790
|
+
const advisory = gqlResp?.[advisoryKey];
|
|
2791
|
+
if (advisory && advisory.ghsaId) {
|
|
2792
|
+
results.set(id, advisory);
|
|
2793
|
+
} else {
|
|
2794
|
+
require$$9.debugFn('notice', `miss: no advisory found for ${id}`);
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
} catch (e) {
|
|
2798
|
+
require$$9.debugFn('error', `Failed to fetch GHSA details: ${e?.message || 'Unknown error'}`);
|
|
2799
|
+
}
|
|
2800
|
+
return results;
|
|
2801
|
+
}
|
|
2802
|
+
let _octokit;
|
|
2803
|
+
function getOctokit() {
|
|
2804
|
+
if (_octokit === undefined) {
|
|
2805
|
+
const {
|
|
2806
|
+
SOCKET_CLI_GITHUB_TOKEN
|
|
2807
|
+
} = constants.ENV;
|
|
2808
|
+
if (!SOCKET_CLI_GITHUB_TOKEN) {
|
|
2809
|
+
require$$9.debugFn('notice', 'miss: SOCKET_CLI_GITHUB_TOKEN env var');
|
|
2810
|
+
}
|
|
2811
|
+
const octokitOptions = {
|
|
2812
|
+
auth: SOCKET_CLI_GITHUB_TOKEN,
|
|
2813
|
+
baseUrl: constants.ENV.GITHUB_API_URL
|
|
2814
|
+
};
|
|
2815
|
+
require$$9.debugDir('inspect', {
|
|
2816
|
+
octokitOptions
|
|
2817
|
+
});
|
|
2818
|
+
_octokit = new vendor.Octokit(octokitOptions);
|
|
2819
|
+
}
|
|
2820
|
+
return _octokit;
|
|
2821
|
+
}
|
|
2822
|
+
let _octokitGraphql;
|
|
2823
|
+
function getOctokitGraphql() {
|
|
2824
|
+
if (!_octokitGraphql) {
|
|
2825
|
+
const {
|
|
2826
|
+
SOCKET_CLI_GITHUB_TOKEN
|
|
2827
|
+
} = constants.ENV;
|
|
2828
|
+
if (!SOCKET_CLI_GITHUB_TOKEN) {
|
|
2829
|
+
require$$9.debugFn('notice', 'miss: SOCKET_CLI_GITHUB_TOKEN env var');
|
|
2830
|
+
}
|
|
2831
|
+
_octokitGraphql = vendor.graphql2.defaults({
|
|
2832
|
+
headers: {
|
|
2833
|
+
authorization: `token ${SOCKET_CLI_GITHUB_TOKEN}`
|
|
2834
|
+
}
|
|
2835
|
+
});
|
|
2836
|
+
}
|
|
2837
|
+
return _octokitGraphql;
|
|
2838
|
+
}
|
|
2839
|
+
async function enablePrAutoMerge({
|
|
2840
|
+
node_id: prId
|
|
2841
|
+
}) {
|
|
2842
|
+
const octokitGraphql = getOctokitGraphql();
|
|
2843
|
+
try {
|
|
2844
|
+
const gqlResp = await octokitGraphql(`
|
|
2845
|
+
mutation EnableAutoMerge($pullRequestId: ID!) {
|
|
2846
|
+
enablePullRequestAutoMerge(input: {
|
|
2847
|
+
pullRequestId: $pullRequestId,
|
|
2848
|
+
mergeMethod: SQUASH
|
|
2849
|
+
}) {
|
|
2850
|
+
pullRequest {
|
|
2851
|
+
number
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
}`, {
|
|
2855
|
+
pullRequestId: prId
|
|
2856
|
+
});
|
|
2857
|
+
const respPrNumber = gqlResp?.enablePullRequestAutoMerge?.pullRequest?.number;
|
|
2858
|
+
if (respPrNumber) {
|
|
2859
|
+
return {
|
|
2860
|
+
enabled: true
|
|
2861
|
+
};
|
|
2862
|
+
}
|
|
2863
|
+
} catch (e) {
|
|
2864
|
+
if (e instanceof vendor.GraphqlResponseError && Array.isArray(e.errors) && e.errors.length) {
|
|
2865
|
+
const details = e.errors.map(({
|
|
2866
|
+
message: m
|
|
2867
|
+
}) => m.trim());
|
|
2868
|
+
return {
|
|
2869
|
+
enabled: false,
|
|
2870
|
+
details
|
|
2871
|
+
};
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
return {
|
|
2875
|
+
enabled: false
|
|
2876
|
+
};
|
|
2877
|
+
}
|
|
2878
|
+
async function setGitRemoteGithubRepoUrl(owner, repo, token, cwd = process.cwd()) {
|
|
2879
|
+
const {
|
|
2880
|
+
host
|
|
2881
|
+
} = new URL(constants.ENV.GITHUB_SERVER_URL);
|
|
2882
|
+
const url = `https://x-access-token:${token}@${host}/${owner}/${repo}`;
|
|
2883
|
+
const stdioIgnoreOptions = {
|
|
2884
|
+
cwd,
|
|
2885
|
+
stdio: require$$9.isDebug('stdio') ? 'inherit' : 'ignore'
|
|
2886
|
+
};
|
|
2887
|
+
const quotedCmd = `\`git remote set-url origin ${url}\``;
|
|
2888
|
+
require$$9.debugFn('stdio', `spawn: ${quotedCmd}`);
|
|
2889
|
+
try {
|
|
2890
|
+
await spawn.spawn('git', ['remote', 'set-url', 'origin', url], stdioIgnoreOptions);
|
|
2891
|
+
return true;
|
|
2892
|
+
} catch (e) {
|
|
2893
|
+
require$$9.debugFn('error', `caught: ${quotedCmd} failed`);
|
|
2894
|
+
require$$9.debugDir('inspect', {
|
|
2895
|
+
error: e
|
|
2896
|
+
});
|
|
2897
|
+
}
|
|
2898
|
+
return false;
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2719
2901
|
const RangeStyles = ['caret', 'gt', 'gte', 'lt', 'lte', 'pin', 'preserve', 'tilde'];
|
|
2720
2902
|
function getMajor(version) {
|
|
2721
2903
|
try {
|
|
@@ -2836,12 +3018,12 @@ function shadowNpmInstall(options) {
|
|
|
2836
3018
|
const progressArg = rawBinArgs.findLast(npm.isNpmProgressFlag) !== '--no-progress';
|
|
2837
3019
|
const isSilent = !useDebug && !binArgs.some(npm.isNpmLoglevelFlag);
|
|
2838
3020
|
const logLevelArgs = isSilent ? ['--loglevel', 'silent'] : [];
|
|
2839
|
-
const useIpc = require$$
|
|
3021
|
+
const useIpc = require$$11.isObject(ipc);
|
|
2840
3022
|
|
|
2841
3023
|
// Include 'ipc' in the spawnOpts.stdio when an options.ipc object is provided.
|
|
2842
3024
|
// See https://github.com/nodejs/node/blob/v23.6.0/lib/child_process.js#L161-L166
|
|
2843
3025
|
// and https://github.com/nodejs/node/blob/v23.6.0/lib/internal/child_process.js#L238.
|
|
2844
|
-
let stdio = require$$
|
|
3026
|
+
let stdio = require$$11.getOwn(spawnOpts, 'stdio');
|
|
2845
3027
|
if (typeof stdio === 'string') {
|
|
2846
3028
|
stdio = useIpc ? [stdio, stdio, stdio, 'ipc'] : [stdio, stdio, stdio];
|
|
2847
3029
|
} else if (Array.isArray(stdio)) {
|
|
@@ -2863,7 +3045,7 @@ function shadowNpmInstall(options) {
|
|
|
2863
3045
|
env: {
|
|
2864
3046
|
...process.env,
|
|
2865
3047
|
...constants.processEnv,
|
|
2866
|
-
...require$$
|
|
3048
|
+
...require$$11.getOwn(spawnOpts, 'env')
|
|
2867
3049
|
},
|
|
2868
3050
|
spinner,
|
|
2869
3051
|
stdio
|
|
@@ -2912,7 +3094,7 @@ function runAgentInstall(pkgEnvDetails, options) {
|
|
|
2912
3094
|
...process.env,
|
|
2913
3095
|
...constants.processEnv,
|
|
2914
3096
|
NODE_OPTIONS: cmdFlagsToString([...(skipNodeHardenFlags ? [] : constants.nodeHardenFlags), ...constants.nodeNoWarningsFlags]),
|
|
2915
|
-
...require$$
|
|
3097
|
+
...require$$11.getOwn(spawnOpts, 'env')
|
|
2916
3098
|
}
|
|
2917
3099
|
});
|
|
2918
3100
|
}
|
|
@@ -3319,7 +3501,7 @@ function toFilterConfig(obj) {
|
|
|
3319
3501
|
const normalized = {
|
|
3320
3502
|
__proto__: null
|
|
3321
3503
|
};
|
|
3322
|
-
const keys = require$$
|
|
3504
|
+
const keys = require$$11.isObject(obj) ? Object.keys(obj) : [];
|
|
3323
3505
|
for (const key of keys) {
|
|
3324
3506
|
const value = obj[key];
|
|
3325
3507
|
if (typeof value === 'boolean' || Array.isArray(value)) {
|
|
@@ -3417,7 +3599,7 @@ async function addArtifactToAlertsMap(artifact, alertsByPurl, options) {
|
|
|
3417
3599
|
blocked: true,
|
|
3418
3600
|
critical: true,
|
|
3419
3601
|
cve: true,
|
|
3420
|
-
...require$$
|
|
3602
|
+
...require$$11.getOwn(options, 'filter')
|
|
3421
3603
|
});
|
|
3422
3604
|
const enabledState = {
|
|
3423
3605
|
__proto__: null,
|
|
@@ -3437,7 +3619,7 @@ async function addArtifactToAlertsMap(artifact, alertsByPurl, options) {
|
|
|
3437
3619
|
const fixableCve = fixType === ALERT_FIX_TYPE.cve;
|
|
3438
3620
|
const fixableUpgrade = fixType === ALERT_FIX_TYPE.upgrade;
|
|
3439
3621
|
const fixable = fixableCve || fixableUpgrade;
|
|
3440
|
-
const upgradable = fixableUpgrade && !require$$
|
|
3622
|
+
const upgradable = fixableUpgrade && !require$$11.hasOwn(overrides, name);
|
|
3441
3623
|
if (filterConfig.blocked && blocked || filterConfig.critical && critical || filterConfig.cve && cve || filterConfig.fixable && fixable || filterConfig.upgradable && upgradable) {
|
|
3442
3624
|
sockPkgAlerts.push({
|
|
3443
3625
|
name,
|
|
@@ -3703,7 +3885,7 @@ async function getAlertsMapFromPurls(purls, options) {
|
|
|
3703
3885
|
consolidate: false,
|
|
3704
3886
|
nothrow: false,
|
|
3705
3887
|
...options,
|
|
3706
|
-
filter: toFilterConfig(require$$
|
|
3888
|
+
filter: toFilterConfig(require$$11.getOwn(options, 'filter'))
|
|
3707
3889
|
};
|
|
3708
3890
|
if (opts.onlyFixable) {
|
|
3709
3891
|
opts.filter.fixable = true;
|
|
@@ -3782,6 +3964,7 @@ exports.AuthError = AuthError;
|
|
|
3782
3964
|
exports.COMPLETION_CMD_PREFIX = COMPLETION_CMD_PREFIX;
|
|
3783
3965
|
exports.InputError = InputError;
|
|
3784
3966
|
exports.RangeStyles = RangeStyles;
|
|
3967
|
+
exports.cacheFetch = cacheFetch;
|
|
3785
3968
|
exports.captureException = captureException;
|
|
3786
3969
|
exports.checkCommandInput = checkCommandInput;
|
|
3787
3970
|
exports.cmdFlagValueToArray = cmdFlagValueToArray;
|
|
@@ -3791,8 +3974,10 @@ exports.createEnum = createEnum;
|
|
|
3791
3974
|
exports.detectAndValidatePackageEnvironment = detectAndValidatePackageEnvironment;
|
|
3792
3975
|
exports.detectDefaultBranch = detectDefaultBranch;
|
|
3793
3976
|
exports.determineOrgSlug = determineOrgSlug;
|
|
3977
|
+
exports.enablePrAutoMerge = enablePrAutoMerge;
|
|
3794
3978
|
exports.extractTier1ReachabilityScanId = extractTier1ReachabilityScanId;
|
|
3795
3979
|
exports.failMsgWithBadge = failMsgWithBadge;
|
|
3980
|
+
exports.fetchGhsaDetails = fetchGhsaDetails;
|
|
3796
3981
|
exports.fetchOrganization = fetchOrganization;
|
|
3797
3982
|
exports.findUp = findUp;
|
|
3798
3983
|
exports.getAlertsMapFromPurls = getAlertsMapFromPurls;
|
|
@@ -3809,11 +3994,12 @@ exports.getMajor = getMajor;
|
|
|
3809
3994
|
exports.getNpmBinPath = getNpmBinPath;
|
|
3810
3995
|
exports.getNpmRequire = getNpmRequire;
|
|
3811
3996
|
exports.getNpxBinPath = getNpxBinPath;
|
|
3997
|
+
exports.getOctokit = getOctokit;
|
|
3998
|
+
exports.getOctokitGraphql = getOctokitGraphql;
|
|
3812
3999
|
exports.getOrgSlugs = getOrgSlugs;
|
|
3813
4000
|
exports.getOutputKind = getOutputKind;
|
|
3814
4001
|
exports.getPackageFilesForScan = getPackageFilesForScan;
|
|
3815
4002
|
exports.getPublicApiToken = getPublicApiToken;
|
|
3816
|
-
exports.getPurlObject = getPurlObject;
|
|
3817
4003
|
exports.getRepoInfo = getRepoInfo;
|
|
3818
4004
|
exports.getRepoName = getRepoName;
|
|
3819
4005
|
exports.getSocketDevPackageOverviewUrlFromPurl = getSocketDevPackageOverviewUrlFromPurl;
|
|
@@ -3858,6 +4044,7 @@ exports.readSocketJsonSync = readSocketJsonSync;
|
|
|
3858
4044
|
exports.runAgentInstall = runAgentInstall;
|
|
3859
4045
|
exports.sendApiRequest = sendApiRequest;
|
|
3860
4046
|
exports.serializeResultJson = serializeResultJson;
|
|
4047
|
+
exports.setGitRemoteGithubRepoUrl = setGitRemoteGithubRepoUrl;
|
|
3861
4048
|
exports.setupSdk = setupSdk;
|
|
3862
4049
|
exports.spawnCoana = spawnCoana;
|
|
3863
4050
|
exports.suggestOrgSlug = suggestOrgSlug;
|
|
@@ -3866,5 +4053,5 @@ exports.toFilterConfig = toFilterConfig;
|
|
|
3866
4053
|
exports.updateConfigValue = updateConfigValue;
|
|
3867
4054
|
exports.walkNestedMap = walkNestedMap;
|
|
3868
4055
|
exports.writeSocketJson = writeSocketJson;
|
|
3869
|
-
//# debugId=
|
|
4056
|
+
//# debugId=c9a337ab-9c3d-4d21-a5a6-ef5d89be0e38
|
|
3870
4057
|
//# sourceMappingURL=utils.js.map
|