mobbdev 0.0.141 → 0.0.142
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 +44 -17
- 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");
|
|
@@ -5033,7 +5040,8 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
5033
5040
|
cxProjectName,
|
|
5034
5041
|
mobbProjectName,
|
|
5035
5042
|
githubToken: githubActionToken,
|
|
5036
|
-
command
|
|
5043
|
+
command,
|
|
5044
|
+
organizationId: userOrganizationId
|
|
5037
5045
|
} = params;
|
|
5038
5046
|
debug11("start %s %s", dirname, repo);
|
|
5039
5047
|
const { createSpinner: createSpinner4 } = Spinner2({ ci });
|
|
@@ -5043,7 +5051,10 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
5043
5051
|
type: "apiKey"
|
|
5044
5052
|
});
|
|
5045
5053
|
await handleMobbLogin();
|
|
5046
|
-
const { projectId, organizationId } = await gqlClient.getOrgAndProjectId(
|
|
5054
|
+
const { projectId, organizationId } = await gqlClient.getOrgAndProjectId({
|
|
5055
|
+
projectName: mobbProjectName,
|
|
5056
|
+
userDefinedOrganizationId: userOrganizationId
|
|
5057
|
+
});
|
|
5047
5058
|
const {
|
|
5048
5059
|
uploadS3BucketInfo: { repoUploadInfo, reportUploadInfo }
|
|
5049
5060
|
} = await gqlClient.uploadS3BucketInfo();
|
|
@@ -5474,7 +5485,8 @@ async function analyze({
|
|
|
5474
5485
|
ci,
|
|
5475
5486
|
commitHash,
|
|
5476
5487
|
srcPath,
|
|
5477
|
-
mobbProjectName
|
|
5488
|
+
mobbProjectName,
|
|
5489
|
+
organizationId
|
|
5478
5490
|
}, { skipPrompts = false } = {}) {
|
|
5479
5491
|
!ci && await showWelcomeMessage(skipPrompts);
|
|
5480
5492
|
await runAnalysis(
|
|
@@ -5487,6 +5499,7 @@ async function analyze({
|
|
|
5487
5499
|
commitHash,
|
|
5488
5500
|
mobbProjectName,
|
|
5489
5501
|
srcPath,
|
|
5502
|
+
organizationId,
|
|
5490
5503
|
command: "analyze"
|
|
5491
5504
|
},
|
|
5492
5505
|
{ skipPrompts }
|
|
@@ -5563,6 +5576,12 @@ var refOption = {
|
|
|
5563
5576
|
type: "string",
|
|
5564
5577
|
demandOption: false
|
|
5565
5578
|
};
|
|
5579
|
+
var organizationIdOptions = {
|
|
5580
|
+
describe: chalk5.bold("Organization id"),
|
|
5581
|
+
alias: "organization-id",
|
|
5582
|
+
type: "string",
|
|
5583
|
+
demandOption: false
|
|
5584
|
+
};
|
|
5566
5585
|
var scannerOptions = {
|
|
5567
5586
|
alias: "s",
|
|
5568
5587
|
choices: Object.values(SCANNERS),
|
|
@@ -5640,6 +5659,12 @@ var UrlZ = z12.string({
|
|
|
5640
5659
|
}).refine((data) => !!sanityRepoURL(data), {
|
|
5641
5660
|
message: "is not a valid GitHub / GitLab / ADO URL"
|
|
5642
5661
|
});
|
|
5662
|
+
function validateOrganizationId(organizationId) {
|
|
5663
|
+
const orgIdValidation = z12.string().uuid().nullish().safeParse(organizationId);
|
|
5664
|
+
if (!orgIdValidation.success) {
|
|
5665
|
+
throw new CliError(`organizationId: ${organizationId} is not a valid UUID`);
|
|
5666
|
+
}
|
|
5667
|
+
}
|
|
5643
5668
|
function validateRepoUrl(args) {
|
|
5644
5669
|
const repoSafeParseResult = UrlZ.safeParse(args.repo);
|
|
5645
5670
|
const { success } = repoSafeParseResult;
|
|
@@ -5689,7 +5714,7 @@ function analyzeBuilder(yargs2) {
|
|
|
5689
5714
|
alias: "commit-hash",
|
|
5690
5715
|
describe: chalk7.bold("Hash of the commit"),
|
|
5691
5716
|
type: "string"
|
|
5692
|
-
}).option("mobb-project-name", mobbProjectNameOption).option("y", yesOption).option("ci", ciOption).option("api-key", apiKeyOption).option("commit-hash", commitHashOption).example(
|
|
5717
|
+
}).option("mobb-project-name", mobbProjectNameOption).option("y", yesOption).option("ci", ciOption).option("org", organizationIdOptions).option("api-key", apiKeyOption).option("commit-hash", commitHashOption).example(
|
|
5693
5718
|
"$0 analyze -r https://github.com/WebGoat/WebGoat -f <your_vulirabitliy_report_path>",
|
|
5694
5719
|
"analyze an existing repository"
|
|
5695
5720
|
).help();
|
|
@@ -5699,6 +5724,7 @@ function validateAnalyzeOptions(argv) {
|
|
|
5699
5724
|
throw new CliError(`
|
|
5700
5725
|
Can't access ${chalk7.bold(argv.f)}`);
|
|
5701
5726
|
}
|
|
5727
|
+
validateOrganizationId(argv.organizationId);
|
|
5702
5728
|
if (!argv.srcPath && !argv.repo) {
|
|
5703
5729
|
throw new CliError("You must supply either --src-path or --repo");
|
|
5704
5730
|
}
|
|
@@ -5767,13 +5793,14 @@ async function reviewHandler(args) {
|
|
|
5767
5793
|
|
|
5768
5794
|
// src/args/commands/scan.ts
|
|
5769
5795
|
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(
|
|
5796
|
+
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
5797
|
"$0 scan -r https://github.com/WebGoat/WebGoat",
|
|
5772
5798
|
"Scan an existing repository"
|
|
5773
5799
|
).help();
|
|
5774
5800
|
}
|
|
5775
5801
|
function validateScanOptions(argv) {
|
|
5776
5802
|
validateRepoUrl(argv);
|
|
5803
|
+
validateOrganizationId(argv.organizationId);
|
|
5777
5804
|
argv.scanner === SCANNERS.Checkmarx && validateCheckmarxInstallation();
|
|
5778
5805
|
if (argv.scanner === SCANNERS.Checkmarx && !argv.cxProjectName) {
|
|
5779
5806
|
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.142",
|
|
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.0",
|
|
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",
|