mobbdev 0.0.141 → 0.0.143
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/index.mjs +49 -27
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -146,15 +146,17 @@ var MeDocument = `
|
|
|
146
146
|
}
|
|
147
147
|
`;
|
|
148
148
|
var GetOrgAndProjectIdDocument = `
|
|
149
|
-
query getOrgAndProjectId {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
query getOrgAndProjectId($filters: organization_to_organization_role_bool_exp, $limit: Int) {
|
|
150
|
+
organization_to_organization_role(
|
|
151
|
+
where: $filters
|
|
152
|
+
order_by: {organization: {createdOn: desc}}
|
|
153
|
+
limit: $limit
|
|
154
|
+
) {
|
|
155
|
+
organization {
|
|
156
|
+
id
|
|
157
|
+
projects(order_by: {updatedAt: desc}) {
|
|
153
158
|
id
|
|
154
|
-
|
|
155
|
-
id
|
|
156
|
-
name
|
|
157
|
-
}
|
|
159
|
+
name
|
|
158
160
|
}
|
|
159
161
|
}
|
|
160
162
|
}
|
|
@@ -4302,12 +4304,17 @@ var GQLClient = class {
|
|
|
4302
4304
|
}
|
|
4303
4305
|
return true;
|
|
4304
4306
|
}
|
|
4305
|
-
async getOrgAndProjectId(
|
|
4306
|
-
const
|
|
4307
|
-
const
|
|
4308
|
-
|
|
4307
|
+
async getOrgAndProjectId(params = {}) {
|
|
4308
|
+
const { projectName, userDefinedOrganizationId } = params;
|
|
4309
|
+
const getOrgAndProjectIdResult = await this._clientSdk.getOrgAndProjectId({
|
|
4310
|
+
filters: userDefinedOrganizationId ? { organizationId: { _eq: userDefinedOrganizationId } } : {},
|
|
4311
|
+
limit: 1
|
|
4312
|
+
});
|
|
4313
|
+
const [organizationToOrganizationRole] = getOrgAndProjectIdResult.organization_to_organization_role;
|
|
4314
|
+
if (!organizationToOrganizationRole) {
|
|
4309
4315
|
throw new Error("Organization not found");
|
|
4310
4316
|
}
|
|
4317
|
+
const { organization: org } = organizationToOrganizationRole;
|
|
4311
4318
|
const project = projectName ? org?.projects.find((project2) => project2.name === projectName) ?? null : org?.projects[0];
|
|
4312
4319
|
if (!project?.id) {
|
|
4313
4320
|
throw new Error("Project not found");
|
|
@@ -4648,14 +4655,14 @@ var { stdout: stdout2 } = supportsColor;
|
|
|
4648
4655
|
function createFork({ args, processPath, name }, options) {
|
|
4649
4656
|
const child = cp.fork(processPath, args, {
|
|
4650
4657
|
stdio: ["inherit", "pipe", "pipe", "ipc"],
|
|
4651
|
-
env: { FORCE_COLOR: stdout2 ? "1" : "0" }
|
|
4658
|
+
env: { ...process2.env, FORCE_COLOR: stdout2 ? "1" : "0" }
|
|
4652
4659
|
});
|
|
4653
4660
|
return createChildProcess({ childProcess: child, name }, options);
|
|
4654
4661
|
}
|
|
4655
4662
|
function createSpwan({ args, processPath, name }, options) {
|
|
4656
4663
|
const child = cp.spawn(processPath, args, {
|
|
4657
4664
|
stdio: ["inherit", "pipe", "pipe", "ipc"],
|
|
4658
|
-
env: { FORCE_COLOR: stdout2 ? "1" : "0" }
|
|
4665
|
+
env: { ...process2.env, FORCE_COLOR: stdout2 ? "1" : "0" }
|
|
4659
4666
|
});
|
|
4660
4667
|
return createChildProcess({ childProcess: child, name }, options);
|
|
4661
4668
|
}
|
|
@@ -4818,14 +4825,11 @@ import open from "open";
|
|
|
4818
4825
|
var debug9 = Debug10("mobbdev:snyk");
|
|
4819
4826
|
var require3 = createRequire2(import.meta.url);
|
|
4820
4827
|
var SNYK_PATH = require3.resolve("snyk/bin/snyk");
|
|
4821
|
-
var SNYK_ARTICLE_URL = "https://docs.snyk.io/scan-
|
|
4828
|
+
var SNYK_ARTICLE_URL = "https://docs.snyk.io/scan-using-snyk/snyk-code/configure-snyk-code#enable-snyk-code";
|
|
4822
4829
|
debug9("snyk executable path %s", SNYK_PATH);
|
|
4823
4830
|
async function forkSnyk(args, { display }) {
|
|
4824
4831
|
debug9("fork snyk with args %o %s", args, display);
|
|
4825
|
-
return createFork(
|
|
4826
|
-
{ args, processPath: SNYK_PATH, name: "checkmarx" },
|
|
4827
|
-
{ display }
|
|
4828
|
-
);
|
|
4832
|
+
return createFork({ args, processPath: SNYK_PATH, name: "snyk" }, { display });
|
|
4829
4833
|
}
|
|
4830
4834
|
async function getSnykReport(reportPath, repoRoot, { skipPrompts = false }) {
|
|
4831
4835
|
debug9("get snyk report start %s %s", reportPath, repoRoot);
|
|
@@ -4851,9 +4855,7 @@ async function getSnykReport(reportPath, repoRoot, { skipPrompts = false }) {
|
|
|
4851
4855
|
["code", "test", `--sarif-file-output=${reportPath}`, repoRoot],
|
|
4852
4856
|
{ display: true }
|
|
4853
4857
|
);
|
|
4854
|
-
if (scanOutput.includes(
|
|
4855
|
-
"Snyk Code is not supported for org: enable in Settings > Snyk Code"
|
|
4856
|
-
)) {
|
|
4858
|
+
if (scanOutput.includes("Snyk Code is not supported for org")) {
|
|
4857
4859
|
debug9("snyk code is not enabled %s", scanOutput);
|
|
4858
4860
|
snykSpinner.error({ text: "\u{1F50D} Snyk configuration needed" });
|
|
4859
4861
|
const answer = await snykArticlePrompt();
|
|
@@ -5033,7 +5035,8 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
5033
5035
|
cxProjectName,
|
|
5034
5036
|
mobbProjectName,
|
|
5035
5037
|
githubToken: githubActionToken,
|
|
5036
|
-
command
|
|
5038
|
+
command,
|
|
5039
|
+
organizationId: userOrganizationId
|
|
5037
5040
|
} = params;
|
|
5038
5041
|
debug11("start %s %s", dirname, repo);
|
|
5039
5042
|
const { createSpinner: createSpinner4 } = Spinner2({ ci });
|
|
@@ -5043,7 +5046,10 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
5043
5046
|
type: "apiKey"
|
|
5044
5047
|
});
|
|
5045
5048
|
await handleMobbLogin();
|
|
5046
|
-
const { projectId, organizationId } = await gqlClient.getOrgAndProjectId(
|
|
5049
|
+
const { projectId, organizationId } = await gqlClient.getOrgAndProjectId({
|
|
5050
|
+
projectName: mobbProjectName,
|
|
5051
|
+
userDefinedOrganizationId: userOrganizationId
|
|
5052
|
+
});
|
|
5047
5053
|
const {
|
|
5048
5054
|
uploadS3BucketInfo: { repoUploadInfo, reportUploadInfo }
|
|
5049
5055
|
} = await gqlClient.uploadS3BucketInfo();
|
|
@@ -5474,7 +5480,8 @@ async function analyze({
|
|
|
5474
5480
|
ci,
|
|
5475
5481
|
commitHash,
|
|
5476
5482
|
srcPath,
|
|
5477
|
-
mobbProjectName
|
|
5483
|
+
mobbProjectName,
|
|
5484
|
+
organizationId
|
|
5478
5485
|
}, { skipPrompts = false } = {}) {
|
|
5479
5486
|
!ci && await showWelcomeMessage(skipPrompts);
|
|
5480
5487
|
await runAnalysis(
|
|
@@ -5487,6 +5494,7 @@ async function analyze({
|
|
|
5487
5494
|
commitHash,
|
|
5488
5495
|
mobbProjectName,
|
|
5489
5496
|
srcPath,
|
|
5497
|
+
organizationId,
|
|
5490
5498
|
command: "analyze"
|
|
5491
5499
|
},
|
|
5492
5500
|
{ skipPrompts }
|
|
@@ -5563,6 +5571,12 @@ var refOption = {
|
|
|
5563
5571
|
type: "string",
|
|
5564
5572
|
demandOption: false
|
|
5565
5573
|
};
|
|
5574
|
+
var organizationIdOptions = {
|
|
5575
|
+
describe: chalk5.bold("Organization id"),
|
|
5576
|
+
alias: "organization-id",
|
|
5577
|
+
type: "string",
|
|
5578
|
+
demandOption: false
|
|
5579
|
+
};
|
|
5566
5580
|
var scannerOptions = {
|
|
5567
5581
|
alias: "s",
|
|
5568
5582
|
choices: Object.values(SCANNERS),
|
|
@@ -5640,6 +5654,12 @@ var UrlZ = z12.string({
|
|
|
5640
5654
|
}).refine((data) => !!sanityRepoURL(data), {
|
|
5641
5655
|
message: "is not a valid GitHub / GitLab / ADO URL"
|
|
5642
5656
|
});
|
|
5657
|
+
function validateOrganizationId(organizationId) {
|
|
5658
|
+
const orgIdValidation = z12.string().uuid().nullish().safeParse(organizationId);
|
|
5659
|
+
if (!orgIdValidation.success) {
|
|
5660
|
+
throw new CliError(`organizationId: ${organizationId} is not a valid UUID`);
|
|
5661
|
+
}
|
|
5662
|
+
}
|
|
5643
5663
|
function validateRepoUrl(args) {
|
|
5644
5664
|
const repoSafeParseResult = UrlZ.safeParse(args.repo);
|
|
5645
5665
|
const { success } = repoSafeParseResult;
|
|
@@ -5689,7 +5709,7 @@ function analyzeBuilder(yargs2) {
|
|
|
5689
5709
|
alias: "commit-hash",
|
|
5690
5710
|
describe: chalk7.bold("Hash of the commit"),
|
|
5691
5711
|
type: "string"
|
|
5692
|
-
}).option("mobb-project-name", mobbProjectNameOption).option("y", yesOption).option("ci", ciOption).option("api-key", apiKeyOption).option("commit-hash", commitHashOption).example(
|
|
5712
|
+
}).option("mobb-project-name", mobbProjectNameOption).option("y", yesOption).option("ci", ciOption).option("org", organizationIdOptions).option("api-key", apiKeyOption).option("commit-hash", commitHashOption).example(
|
|
5693
5713
|
"$0 analyze -r https://github.com/WebGoat/WebGoat -f <your_vulirabitliy_report_path>",
|
|
5694
5714
|
"analyze an existing repository"
|
|
5695
5715
|
).help();
|
|
@@ -5699,6 +5719,7 @@ function validateAnalyzeOptions(argv) {
|
|
|
5699
5719
|
throw new CliError(`
|
|
5700
5720
|
Can't access ${chalk7.bold(argv.f)}`);
|
|
5701
5721
|
}
|
|
5722
|
+
validateOrganizationId(argv.organizationId);
|
|
5702
5723
|
if (!argv.srcPath && !argv.repo) {
|
|
5703
5724
|
throw new CliError("You must supply either --src-path or --repo");
|
|
5704
5725
|
}
|
|
@@ -5767,13 +5788,14 @@ async function reviewHandler(args) {
|
|
|
5767
5788
|
|
|
5768
5789
|
// src/args/commands/scan.ts
|
|
5769
5790
|
function scanBuilder(args) {
|
|
5770
|
-
return args.coerce("scanner", (arg) => arg.toLowerCase()).option("repo", repoOption).option("ref", refOption).option("scanner", scannerOptions).option("mobb-project-name", mobbProjectNameOption).option("y", yesOption).option("ci", ciOption).option("api-key", apiKeyOption).option("cx-project-name", projectNameOption).example(
|
|
5791
|
+
return args.coerce("scanner", (arg) => arg.toLowerCase()).option("repo", repoOption).option("ref", refOption).option("scanner", scannerOptions).option("org", organizationIdOptions).option("mobb-project-name", mobbProjectNameOption).option("y", yesOption).option("ci", ciOption).option("api-key", apiKeyOption).option("cx-project-name", projectNameOption).example(
|
|
5771
5792
|
"$0 scan -r https://github.com/WebGoat/WebGoat",
|
|
5772
5793
|
"Scan an existing repository"
|
|
5773
5794
|
).help();
|
|
5774
5795
|
}
|
|
5775
5796
|
function validateScanOptions(argv) {
|
|
5776
5797
|
validateRepoUrl(argv);
|
|
5798
|
+
validateOrganizationId(argv.organizationId);
|
|
5777
5799
|
argv.scanner === SCANNERS.Checkmarx && validateCheckmarxInstallation();
|
|
5778
5800
|
if (argv.scanner === SCANNERS.Checkmarx && !argv.cxProjectName) {
|
|
5779
5801
|
throw new CliError(errorMessages.missingCxProjectName);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobbdev",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.143",
|
|
4
4
|
"description": "Automated secure code remediation tool",
|
|
5
5
|
"repository": "https://github.com/mobb-dev/bugsy",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"@octokit/plugin-rest-endpoint-methods": "7.2.3",
|
|
33
33
|
"@octokit/request-error": "3.0.3",
|
|
34
34
|
"@types/libsodium-wrappers": "0.7.13",
|
|
35
|
-
"adm-zip": "0.5.
|
|
36
|
-
"axios": "1.7.
|
|
35
|
+
"adm-zip": "0.5.15",
|
|
36
|
+
"axios": "1.7.3",
|
|
37
37
|
"azure-devops-node-api": "12.1.0",
|
|
38
38
|
"bitbucket": "2.11.0",
|
|
39
39
|
"chalk": "5.3.0",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"parse-diff": "0.11.1",
|
|
59
59
|
"semver": "7.6.3",
|
|
60
60
|
"simple-git": "3.25.0",
|
|
61
|
-
"snyk": "1.
|
|
61
|
+
"snyk": "1.1292.4",
|
|
62
62
|
"supports-color": "9.4.0",
|
|
63
63
|
"tar": "6.2.1",
|
|
64
64
|
"tmp": "0.2.3",
|
|
65
|
-
"undici": "6.19.
|
|
65
|
+
"undici": "6.19.5",
|
|
66
66
|
"uuid": "10.0.0",
|
|
67
67
|
"ws": "8.18.0",
|
|
68
68
|
"yargs": "17.7.2",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"@types/tar": "6.1.13",
|
|
85
85
|
"@types/tmp": "0.2.6",
|
|
86
86
|
"@types/uuid": "10.0.0",
|
|
87
|
-
"@types/ws": "8.5.
|
|
87
|
+
"@types/ws": "8.5.12",
|
|
88
88
|
"@types/yargs": "17.0.32",
|
|
89
89
|
"@typescript-eslint/eslint-plugin": "7.17.0",
|
|
90
90
|
"@typescript-eslint/parser": "7.17.0",
|