mobbdev 1.0.101 → 1.0.102

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.
Files changed (2) hide show
  1. package/dist/index.mjs +1003 -994
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -280,7 +280,10 @@ var RepoNoTokenAccessError = class extends Error {
280
280
  }
281
281
  };
282
282
 
283
- // src/features/analysis/scm/shared/src/types/fix.ts
283
+ // src/features/analysis/scm/utils/index.ts
284
+ import { z as z14 } from "zod";
285
+
286
+ // src/features/analysis/scm/shared/src/commitDescriptionMarkup.ts
284
287
  import { z as z2 } from "zod";
285
288
 
286
289
  // src/features/analysis/scm/generates/client_generates.ts
@@ -1130,934 +1133,6 @@ function getSdk(client, withWrapper = defaultWrapper) {
1130
1133
  };
1131
1134
  }
1132
1135
 
1133
- // src/features/analysis/scm/shared/src/types/shared.ts
1134
- import { z } from "zod";
1135
- var ParsedSeverityZ = z.nativeEnum(Vulnerability_Severity_Enum).nullish().transform((i) => i ?? "low" /* Low */);
1136
- var ScmSubmitFixRequestsZ = z.array(
1137
- z.object({
1138
- scmSubmitFixRequest: z.object({
1139
- submitFixRequest: z.object({
1140
- createdByUser: z.object({
1141
- email: z.string()
1142
- }),
1143
- targetBranchName: z.string().default("")
1144
- }),
1145
- prUrl: z.string().nullable(),
1146
- prStatus: z.nativeEnum(Pr_Status_Enum).nullable(),
1147
- commitUrl: z.string().nullable(),
1148
- scmId: z.string()
1149
- })
1150
- })
1151
- );
1152
-
1153
- // src/features/analysis/scm/shared/src/types/fix.ts
1154
- var PackageInfoZ = z2.object({
1155
- name: z2.string(),
1156
- version: z2.string(),
1157
- envName: z2.string().nullable()
1158
- });
1159
- var ManifestActionRequiredZ = z2.object({
1160
- action: z2.nativeEnum(ManifestAction),
1161
- language: z2.nativeEnum(Language),
1162
- lib: PackageInfoZ,
1163
- typesLib: PackageInfoZ.nullable()
1164
- });
1165
- var ExtraContextInternalZ = z2.object({
1166
- key: z2.string(),
1167
- value: z2.string().or(z2.boolean()).or(
1168
- z2.object({
1169
- int: z2.boolean(),
1170
- integer: z2.boolean(),
1171
- string: z2.boolean(),
1172
- date: z2.boolean()
1173
- })
1174
- )
1175
- });
1176
- var FixExtraContextZ = z2.object({
1177
- fixDescription: z2.string(),
1178
- manifestActionsRequired: z2.array(ManifestActionRequiredZ),
1179
- extraContext: z2.array(ExtraContextInternalZ)
1180
- });
1181
- var PatchAndQuestionsZ = z2.object({
1182
- __typename: z2.literal("FixData"),
1183
- patch: z2.string(),
1184
- patchOriginalEncodingBase64: z2.string(),
1185
- questions: z2.array(
1186
- z2.object({
1187
- name: z2.string(),
1188
- key: z2.string(),
1189
- index: z2.number(),
1190
- defaultValue: z2.string(),
1191
- value: z2.string().nullable(),
1192
- extraContext: z2.array(ExtraContextInternalZ),
1193
- inputType: z2.nativeEnum(FixQuestionInputType),
1194
- options: z2.array(z2.string())
1195
- })
1196
- ),
1197
- extraContext: FixExtraContextZ
1198
- });
1199
- var FixRatingZ = z2.object({
1200
- voteScore: z2.number(),
1201
- fixRatingTag: z2.nativeEnum(Fix_Rating_Tag_Enum).nullable().default(null),
1202
- comment: z2.string().nullable().default(null),
1203
- updatedDate: z2.string().nullable(),
1204
- user: z2.object({
1205
- email: z2.string(),
1206
- name: z2.string()
1207
- })
1208
- });
1209
- var FixSharedStateZ = z2.object({
1210
- state: z2.nativeEnum(Fix_State_Enum),
1211
- isArchived: z2.boolean(),
1212
- scmSubmitFixRequests: ScmSubmitFixRequestsZ,
1213
- fixRatings: z2.array(FixRatingZ).default([])
1214
- }).nullish().transform(
1215
- (data) => data ? data : {
1216
- state: "Ready" /* Ready */,
1217
- isArchived: false,
1218
- scmSubmitFixRequests: [],
1219
- fixRatings: []
1220
- }
1221
- );
1222
- var FixQueryZ = z2.object({
1223
- __typename: z2.literal("fix").optional(),
1224
- id: z2.string().uuid(),
1225
- sharedState: FixSharedStateZ,
1226
- modifiedBy: z2.string().nullable(),
1227
- gitBlameLogin: z2.string().nullable(),
1228
- safeIssueLanguage: z2.string(),
1229
- safeIssueType: z2.string(),
1230
- confidence: z2.number(),
1231
- fixReportId: z2.string().uuid(),
1232
- isExpired: z2.boolean().default(false),
1233
- fixFiles: z2.array(
1234
- z2.object({
1235
- fileRepoRelativePath: z2.string()
1236
- })
1237
- ),
1238
- numberOfVulnerabilityIssues: z2.number(),
1239
- severityText: z2.nativeEnum(Vulnerability_Severity_Enum),
1240
- vulnerabilityReportIssues: z2.array(
1241
- z2.object({
1242
- vendorIssueId: z2.string(),
1243
- issueLanguage: z2.string(),
1244
- parsedSeverity: ParsedSeverityZ
1245
- })
1246
- ),
1247
- patchAndQuestions: PatchAndQuestionsZ,
1248
- effortToApplyFix: z2.nativeEnum(Effort_To_Apply_Fix_Enum).nullable()
1249
- });
1250
- var FixPartsForFixScreenZ = FixQueryZ.merge(
1251
- z2.object({
1252
- vulnerabilityReportIssues: z2.array(
1253
- z2.object({
1254
- vendorIssueId: z2.string(),
1255
- issueType: z2.string(),
1256
- issueLanguage: z2.string()
1257
- })
1258
- )
1259
- })
1260
- );
1261
-
1262
- // src/features/analysis/scm/shared/src/types/issue.ts
1263
- import { z as z4 } from "zod";
1264
-
1265
- // src/features/analysis/scm/shared/src/types/analysis.ts
1266
- import { z as z3 } from "zod";
1267
- var FixPageFixReportZ = z3.object({
1268
- id: z3.string().uuid(),
1269
- analysisUrl: z3.string(),
1270
- expirationOn: z3.string(),
1271
- createdOn: z3.string(),
1272
- state: z3.nativeEnum(Fix_Report_State_Enum),
1273
- repo: z3.object({
1274
- name: z3.string().nullable(),
1275
- originalUrl: z3.string(),
1276
- reference: z3.string(),
1277
- commitSha: z3.string(),
1278
- isKnownBranch: z3.boolean().nullable()
1279
- }),
1280
- vulnerabilityReport: z3.object({
1281
- vendor: z3.nativeEnum(Vulnerability_Report_Vendor_Enum),
1282
- vendorReportId: z3.string().uuid().nullable(),
1283
- projectId: z3.string().uuid(),
1284
- project: z3.object({
1285
- organizationId: z3.string().uuid()
1286
- }),
1287
- file: z3.object({
1288
- id: z3.string().uuid(),
1289
- path: z3.string()
1290
- }),
1291
- pending: z3.object({
1292
- aggregate: z3.object({
1293
- count: z3.number()
1294
- })
1295
- }),
1296
- supported: z3.object({
1297
- aggregate: z3.object({
1298
- count: z3.number()
1299
- })
1300
- }),
1301
- all: z3.object({
1302
- aggregate: z3.object({
1303
- count: z3.number()
1304
- })
1305
- }),
1306
- fixable: z3.object({
1307
- aggregate: z3.object({
1308
- count: z3.number()
1309
- })
1310
- }),
1311
- errors: z3.object({
1312
- aggregate: z3.object({
1313
- count: z3.number()
1314
- })
1315
- }),
1316
- vulnerabilityReportIssues: z3.object({
1317
- extraData: z3.object({
1318
- missing_files: z3.string().array().nullish(),
1319
- large_files: z3.string().array().nullish(),
1320
- error_files: z3.string().array().nullish()
1321
- })
1322
- }).array()
1323
- })
1324
- });
1325
-
1326
- // src/features/analysis/scm/shared/src/types/issue.ts
1327
- var MAX_SOURCE_CODE_FILE_SIZE_IN_BYTES = 1e5;
1328
- var CATEGORY = {
1329
- NoFix: "NoFix",
1330
- Unsupported: "Unsupported",
1331
- Irrelevant: "Irrelevant",
1332
- FalsePositive: "FalsePositive",
1333
- Fixable: "Fixable",
1334
- Filtered: "Filtered"
1335
- };
1336
- var ValidCategoriesZ = z4.union([
1337
- z4.literal(CATEGORY.NoFix),
1338
- z4.literal(CATEGORY.Unsupported),
1339
- z4.literal(CATEGORY.Irrelevant),
1340
- z4.literal(CATEGORY.FalsePositive),
1341
- z4.literal(CATEGORY.Fixable),
1342
- z4.literal(CATEGORY.Filtered)
1343
- ]);
1344
- var VulnerabilityReportIssueSharedStateZ = z4.object({
1345
- id: z4.string().uuid(),
1346
- isArchived: z4.boolean()
1347
- }).nullish();
1348
- var BaseIssuePartsZ = z4.object({
1349
- id: z4.string().uuid(),
1350
- safeIssueType: z4.string(),
1351
- safeIssueLanguage: z4.string(),
1352
- createdAt: z4.string(),
1353
- parsedSeverity: ParsedSeverityZ,
1354
- category: ValidCategoriesZ,
1355
- extraData: z4.object({
1356
- missing_files: z4.string().array().nullish(),
1357
- error_files: z4.string().array().nullish()
1358
- }),
1359
- vulnerabilityReportIssueTags: z4.array(
1360
- z4.object({
1361
- tag: z4.nativeEnum(Vulnerability_Report_Issue_Tag_Enum)
1362
- })
1363
- ),
1364
- codeNodes: z4.array(
1365
- z4.object({
1366
- path: z4.string(),
1367
- line: z4.number(),
1368
- index: z4.number()
1369
- })
1370
- ).transform((nodes) => nodes.sort((a, b) => b.index - a.index)),
1371
- sourceCodeNodes: z4.array(
1372
- z4.object({
1373
- sourceCodeFile: z4.object({
1374
- path: z4.string(),
1375
- signedFile: z4.object({
1376
- url: z4.string()
1377
- })
1378
- })
1379
- }).transform(async ({ sourceCodeFile }) => {
1380
- const { url } = sourceCodeFile.signedFile;
1381
- const sourceCodeRes = await fetch(url);
1382
- if (Number(sourceCodeRes.headers.get("Content-Length")) > MAX_SOURCE_CODE_FILE_SIZE_IN_BYTES) {
1383
- return null;
1384
- }
1385
- return {
1386
- path: sourceCodeFile.path,
1387
- fileContent: await sourceCodeRes.text()
1388
- };
1389
- })
1390
- ).transform((nodes) => nodes.filter((node) => node !== null)),
1391
- fix: FixPartsForFixScreenZ.nullish(),
1392
- vulnerabilityReportIssueNodeDiffFile: z4.object({
1393
- signedFile: z4.object({
1394
- url: z4.string()
1395
- }).transform(async ({ url }) => {
1396
- const codeDiff = await fetch(url).then((res) => res.text());
1397
- return { codeDiff };
1398
- })
1399
- }).nullish(),
1400
- sharedState: VulnerabilityReportIssueSharedStateZ
1401
- });
1402
- var FalsePositivePartsZ = z4.object({
1403
- extraContext: z4.array(z4.object({ key: z4.string(), value: z4.string() })),
1404
- fixDescription: z4.string()
1405
- });
1406
- var IssuePartsWithFixZ = BaseIssuePartsZ.merge(
1407
- z4.object({
1408
- category: z4.literal(CATEGORY.Irrelevant),
1409
- fix: FixPartsForFixScreenZ.nullish()
1410
- })
1411
- );
1412
- var IssuePartsFpZ = BaseIssuePartsZ.merge(
1413
- z4.object({
1414
- category: z4.literal(CATEGORY.FalsePositive),
1415
- fpId: z4.string().uuid(),
1416
- getFalsePositive: FalsePositivePartsZ
1417
- })
1418
- );
1419
- var GeneralIssueZ = BaseIssuePartsZ.merge(
1420
- z4.object({
1421
- category: z4.union([
1422
- z4.literal(CATEGORY.NoFix),
1423
- z4.literal(CATEGORY.Unsupported),
1424
- z4.literal(CATEGORY.Fixable),
1425
- z4.literal(CATEGORY.Filtered)
1426
- ])
1427
- })
1428
- );
1429
- var IssuePartsZ = z4.union([
1430
- IssuePartsFpZ,
1431
- IssuePartsWithFixZ,
1432
- GeneralIssueZ
1433
- ]);
1434
- var GetIssueIndexesZ = z4.object({
1435
- currentIndex: z4.number(),
1436
- totalIssues: z4.number(),
1437
- nextIssue: z4.object({
1438
- id: z4.string().uuid()
1439
- }).nullish(),
1440
- prevIssue: z4.object({
1441
- id: z4.string().uuid()
1442
- }).nullish()
1443
- });
1444
- var GetIssueScreenDataZ = z4.object({
1445
- fixReport_by_pk: FixPageFixReportZ,
1446
- vulnerability_report_issue_by_pk: IssuePartsZ,
1447
- issueIndexes: GetIssueIndexesZ
1448
- });
1449
- var IssueBucketZ = z4.enum(["fixable", "irrelevant", "remaining"]);
1450
- var mapCategoryToBucket = {
1451
- FalsePositive: "irrelevant",
1452
- Irrelevant: "irrelevant",
1453
- NoFix: "remaining",
1454
- Unsupported: "remaining",
1455
- Fixable: "fixable",
1456
- Filtered: "remaining"
1457
- };
1458
-
1459
- // src/features/analysis/scm/shared/src/types/types.ts
1460
- import { z as z7 } from "zod";
1461
-
1462
- // src/features/analysis/scm/shared/src/validations.ts
1463
- import { z as z6 } from "zod";
1464
-
1465
- // src/features/analysis/scm/shared/src/getIssueType.ts
1466
- import { z as z5 } from "zod";
1467
- var issueTypeMap = {
1468
- ["NO_LIMITS_OR_THROTTLING" /* NoLimitsOrThrottling */]: "Missing Rate Limiting",
1469
- ["SQL_Injection" /* SqlInjection */]: "SQL Injection",
1470
- ["CMDi_relative_path_command" /* CmDiRelativePathCommand */]: "Relative Path Command Injection",
1471
- ["CMDi" /* CmDi */]: "Command Injection",
1472
- ["CONFUSING_NAMING" /* ConfusingNaming */]: "Confusing Naming",
1473
- ["XXE" /* Xxe */]: "XXE",
1474
- ["XSS" /* Xss */]: "XSS",
1475
- ["PT" /* Pt */]: "Path Traversal",
1476
- ["ZIP_SLIP" /* ZipSlip */]: "Zip Slip",
1477
- ["INSECURE_RANDOMNESS" /* InsecureRandomness */]: "Insecure Randomness",
1478
- ["SSRF" /* Ssrf */]: "Server Side Request Forgery",
1479
- ["TYPE_CONFUSION" /* TypeConfusion */]: "Type Confusion",
1480
- ["REGEX_INJECTION" /* RegexInjection */]: "Regular Expression Injection",
1481
- ["INCOMPLETE_URL_SANITIZATION" /* IncompleteUrlSanitization */]: "Incomplete URL Sanitization",
1482
- ["LOCALE_DEPENDENT_COMPARISON" /* LocaleDependentComparison */]: "Locale Dependent Comparison",
1483
- ["LOG_FORGING" /* LogForging */]: "Log Forging",
1484
- ["MISSING_CHECK_AGAINST_NULL" /* MissingCheckAgainstNull */]: "Missing Check against Null",
1485
- ["PASSWORD_IN_COMMENT" /* PasswordInComment */]: "Password in Comment",
1486
- ["OVERLY_BROAD_CATCH" /* OverlyBroadCatch */]: "Poor Error Handling: Overly Broad Catch",
1487
- ["USE_OF_SYSTEM_OUTPUT_STREAM" /* UseOfSystemOutputStream */]: "Use of System.out/System.err",
1488
- ["DANGEROUS_FUNCTION_OVERFLOW" /* DangerousFunctionOverflow */]: "Use of dangerous function",
1489
- ["DOS_STRING_BUILDER" /* DosStringBuilder */]: "Denial of Service: StringBuilder",
1490
- ["OPEN_REDIRECT" /* OpenRedirect */]: "Open Redirect",
1491
- ["WEAK_XML_SCHEMA_UNBOUNDED_OCCURRENCES" /* WeakXmlSchemaUnboundedOccurrences */]: "Weak XML Schema: Unbounded Occurrences",
1492
- ["SYSTEM_INFORMATION_LEAK" /* SystemInformationLeak */]: "System Information Leak",
1493
- ["SYSTEM_INFORMATION_LEAK_EXTERNAL" /* SystemInformationLeakExternal */]: "External System Information Leak",
1494
- ["HTTP_RESPONSE_SPLITTING" /* HttpResponseSplitting */]: "HTTP response splitting",
1495
- ["HTTP_ONLY_COOKIE" /* HttpOnlyCookie */]: "Cookie is not HttpOnly",
1496
- ["INSECURE_COOKIE" /* InsecureCookie */]: "Insecure Cookie",
1497
- ["TRUST_BOUNDARY_VIOLATION" /* TrustBoundaryViolation */]: "Trust Boundary Violation",
1498
- ["NULL_DEREFERENCE" /* NullDereference */]: "Null Dereference",
1499
- ["UNSAFE_DESERIALIZATION" /* UnsafeDeserialization */]: "Unsafe deserialization",
1500
- ["INSECURE_BINDER_CONFIGURATION" /* InsecureBinderConfiguration */]: "Insecure Binder Configuration",
1501
- ["UNSAFE_TARGET_BLANK" /* UnsafeTargetBlank */]: "Unsafe use of target blank",
1502
- ["IFRAME_WITHOUT_SANDBOX" /* IframeWithoutSandbox */]: "Client use of iframe without sandbox",
1503
- ["JQUERY_DEPRECATED_SYMBOLS" /* JqueryDeprecatedSymbols */]: "jQuery deprecated symbols",
1504
- ["MISSING_ANTIFORGERY_VALIDATION" /* MissingAntiforgeryValidation */]: "Missing Anti-Forgery Validation",
1505
- ["GRAPHQL_DEPTH_LIMIT" /* GraphqlDepthLimit */]: "GraphQL Depth Limit",
1506
- ["UNCHECKED_LOOP_CONDITION" /* UncheckedLoopCondition */]: "Unchecked Loop Condition",
1507
- ["IMPROPER_RESOURCE_SHUTDOWN_OR_RELEASE" /* ImproperResourceShutdownOrRelease */]: "Improper Resource Shutdown or Release",
1508
- ["IMPROPER_EXCEPTION_HANDLING" /* ImproperExceptionHandling */]: "Improper Exception Handling",
1509
- ["DEFAULT_RIGHTS_IN_OBJ_DEFINITION" /* DefaultRightsInObjDefinition */]: "Default Definer Rights in Package or Object Definition",
1510
- ["HTML_COMMENT_IN_JSP" /* HtmlCommentInJsp */]: "HTML Comment in JSP",
1511
- ["ERROR_CONDTION_WITHOUT_ACTION" /* ErrorCondtionWithoutAction */]: "Error Condition Without Action",
1512
- ["DEPRECATED_FUNCTION" /* DeprecatedFunction */]: "Deprecated Function",
1513
- ["HARDCODED_SECRETS" /* HardcodedSecrets */]: "Hardcoded Secrets",
1514
- ["PROTOTYPE_POLLUTION" /* PrototypePollution */]: "Prototype Pollution",
1515
- ["RACE_CONDITION_FORMAT_FLAW" /* RaceConditionFormatFlaw */]: "Race Condition Format Flaw",
1516
- ["NON_FINAL_PUBLIC_STATIC_FIELD" /* NonFinalPublicStaticField */]: "Non-final Public Static Field",
1517
- ["MISSING_HSTS_HEADER" /* MissingHstsHeader */]: "Missing HSTS Header",
1518
- ["DEAD_CODE_UNUSED_FIELD" /* DeadCodeUnusedField */]: "Dead Code: Unused Field",
1519
- ["HEADER_MANIPULATION" /* HeaderManipulation */]: "Header Manipulation",
1520
- ["MISSING_EQUALS_OR_HASHCODE" /* MissingEqualsOrHashcode */]: "Missing equals or hashcode method",
1521
- ["WCF_MISCONFIGURATION_INSUFFICIENT_LOGGING" /* WcfMisconfigurationInsufficientLogging */]: "WCF Misconfiguration: Insufficient Logging",
1522
- ["WCF_MISCONFIGURATION_THROTTLING_NOT_ENABLED" /* WcfMisconfigurationThrottlingNotEnabled */]: "WCF Misconfiguration: Throttling Not Enabled",
1523
- ["USELESS_REGEXP_CHAR_ESCAPE" /* UselessRegexpCharEscape */]: "Useless regular-expression character escape",
1524
- ["INCOMPLETE_HOSTNAME_REGEX" /* IncompleteHostnameRegex */]: "Incomplete Hostname Regex",
1525
- ["OVERLY_LARGE_RANGE" /* OverlyLargeRange */]: "Regex: Overly Large Range",
1526
- ["INSUFFICIENT_LOGGING" /* InsufficientLogging */]: "Insufficient Logging of Sensitive Operations",
1527
- ["PRIVACY_VIOLATION" /* PrivacyViolation */]: "Privacy Violation",
1528
- ["INCOMPLETE_URL_SCHEME_CHECK" /* IncompleteUrlSchemeCheck */]: "Incomplete URL Scheme Check",
1529
- ["VALUE_NEVER_READ" /* ValueNeverRead */]: "Value Never Read",
1530
- ["VALUE_SHADOWING" /* ValueShadowing */]: "Value Shadowing",
1531
- ["NO_EQUIVALENCE_METHOD" /* NoEquivalenceMethod */]: "Class Does Not Implement Equivalence Method",
1532
- ["INFORMATION_EXPOSURE_VIA_HEADERS" /* InformationExposureViaHeaders */]: "Information Exposure via Headers",
1533
- ["DEBUG_ENABLED" /* DebugEnabled */]: "Debug Enabled",
1534
- ["LEFTOVER_DEBUG_CODE" /* LeftoverDebugCode */]: "Leftover Debug Code",
1535
- ["POOR_ERROR_HANDLING_EMPTY_CATCH_BLOCK" /* PoorErrorHandlingEmptyCatchBlock */]: "Poor Error Handling: Empty Catch Block",
1536
- ["ERRONEOUS_STRING_COMPARE" /* ErroneousStringCompare */]: "Erroneous String Compare",
1537
- ["UNVALIDATED_PUBLIC_METHOD_ARGUMENT" /* UnvalidatedPublicMethodArgument */]: "Unvalidated Public Method Argument",
1538
- ["AUTO_ESCAPE_FALSE" /* AutoEscapeFalse */]: "Auto-escape False",
1539
- ["MISSING_CSP_HEADER" /* MissingCspHeader */]: "Missing CSP Header",
1540
- ["HARDCODED_DOMAIN_IN_HTML" /* HardcodedDomainInHtml */]: "Hardcoded Domain in HTML",
1541
- ["HEAP_INSPECTION" /* HeapInspection */]: "Heap Inspection",
1542
- ["CLIENT_DOM_STORED_CODE_INJECTION" /* ClientDomStoredCodeInjection */]: "Client Code Injection",
1543
- ["STRING_FORMAT_MISUSE" /* StringFormatMisuse */]: "String Format Misuse",
1544
- ["NON_READONLY_FIELD" /* NonReadonlyField */]: "Non Readonly Field",
1545
- ["CSRF" /* Csrf */]: "Cross-Site Request Forgery (CSRF)",
1546
- ["WEAK_ENCRYPTION" /* WeakEncryption */]: "Weak Encryption Mechanism",
1547
- ["CODE_IN_COMMENT" /* CodeInComment */]: "Code in Comment",
1548
- ["REGEX_MISSING_TIMEOUT" /* RegexMissingTimeout */]: "Regex Missing Timeout",
1549
- ["FRAMEABLE_LOGIN_PAGE" /* FrameableLoginPage */]: "Frameable Login Page",
1550
- ["USE_OF_HARD_CODED_CRYPTOGRAPHIC_KEY" /* UseOfHardCodedCryptographicKey */]: "Use of Hardcoded Cryptographic Key",
1551
- ["MISSING_SSL_MINVERSION" /* MissingSslMinversion */]: "Missing SSL MinVersion",
1552
- ["WEBSOCKET_MISSING_ORIGIN_CHECK" /* WebsocketMissingOriginCheck */]: "Missing Websocket Origin Check",
1553
- ["DUPLICATED_STRINGS" /* DuplicatedStrings */]: "String Literals Should not Be Duplicated",
1554
- ["INSECURE_UUID_VERSION" /* InsecureUuidVersion */]: "Insecure UUID Version",
1555
- ["GH_ACTIONS_SHELL_INJECTION" /* GhActionsShellInjection */]: "GitHub Actions Shell Injection",
1556
- ["MODIFIED_DEFAULT_PARAM" /* ModifiedDefaultParam */]: "Modified Default Param",
1557
- ["UNSAFE_WEB_THREAD" /* UnsafeWebThread */]: "Unsafe Web Thread",
1558
- ["NO_VAR" /* NoVar */]: 'Prefer "let" or "const"',
1559
- ["INSECURE_TMP_FILE" /* InsecureTmpFile */]: "Insecure Temporary File",
1560
- ["RETURN_SHOULD_NOT_BE_INVARIANT" /* ReturnShouldNotBeInvariant */]: "Return Should Not Be Invariant",
1561
- ["SYSTEM_EXIT_SHOULD_RERAISE" /* SystemExitShouldReraise */]: "SystemExit Should Reraise",
1562
- ["NO_RETURN_IN_FINALLY" /* NoReturnInFinally */]: "No Return in Finally Block",
1563
- ["WILDCARD_IMPORTS" /* WildcardImports */]: "Wildcard Imports should not be used",
1564
- ["AVOID_IDENTITY_COMPARISON_CACHED_TYPES" /* AvoidIdentityComparisonCachedTypes */]: "Avoid Identity Comparison of Cached Types",
1565
- ["AVOID_BUILTIN_SHADOWING" /* AvoidBuiltinShadowing */]: "Avoid Builtin Shadowing",
1566
- ["IMPROPER_STRING_FORMATTING" /* ImproperStringFormatting */]: "Improper String Formatting",
1567
- ["TAR_SLIP" /* TarSlip */]: "Tar Slip",
1568
- ["MISSING_WHITESPACE" /* MissingWhitespace */]: "Missing Whitespace",
1569
- ["NO_PRINT_STATEMENT" /* NoPrintStatement */]: 'Python 2 "print" Statement Is Obsolete',
1570
- ["NO_OP_OVERHEAD" /* NoOpOverhead */]: "Expensive Arguments in Conditional Methods",
1571
- ["DO_NOT_RAISE_EXCEPTION" /* DoNotRaiseException */]: "Do Not Raise Exception",
1572
- ["DECLARE_VARIABLE_EXPLICITLY" /* DeclareVariableExplicitly */]: "Declare Variable Explicitly",
1573
- ["NO_NESTED_TRY" /* NoNestedTry */]: "No Nested Try",
1574
- ["UNNECESSARY_IMPORTS" /* UnnecessaryImports */]: "Unnecessary Imports",
1575
- ["REDOS" /* Redos */]: "Regular Expression Denial of Service",
1576
- ["DO_NOT_THROW_GENERIC_EXCEPTION" /* DoNotThrowGenericException */]: "Do Not Throw Generic Exception"
1577
- };
1578
- var issueTypeZ = z5.nativeEnum(IssueType_Enum);
1579
- var getIssueTypeFriendlyString = (issueType) => {
1580
- const issueTypeZParseRes = issueTypeZ.safeParse(issueType);
1581
- if (!issueTypeZParseRes.success) {
1582
- return issueType ? issueType.replaceAll("_", " ") : "Other";
1583
- }
1584
- return issueTypeMap[issueTypeZParseRes.data];
1585
- };
1586
- function getTagTooltip(tag) {
1587
- switch (tag) {
1588
- case "FALSE_POSITIVE":
1589
- return "Issue was found to be a false positive";
1590
- case "TEST_CODE":
1591
- return "Issue found in test files, not production code";
1592
- case "VENDOR_CODE":
1593
- return "Issue is in external libraries or dependencies not owned or maintained by your team";
1594
- case "AUTOGENERATED_CODE":
1595
- return "Code created by tools or frameworks, not manually written";
1596
- case "AUXILIARY_CODE":
1597
- return "Issue found in supporting files that don't impact core functionality";
1598
- case "Filtered":
1599
- return "Issue was filtered by user in the Fix Policy";
1600
- default:
1601
- return tag;
1602
- }
1603
- }
1604
- var issueDescription = {
1605
- ["AUTOGENERATED_CODE" /* AutogeneratedCode */]: "The flagged code is generated automatically by tools or frameworks as part of the build or runtime process. This categorization highlights that **the issue resides in non-manual code**, which often requires tool-specific solutions or exemptions.",
1606
- ["AUXILIARY_CODE" /* AuxiliaryCode */]: "The flagged code is auxiliary or supporting code, such as configuration files, build scripts, or other non-application logic. This categorization indicates that the issue is not directly related to the application's core functionality.",
1607
- ["FALSE_POSITIVE" /* FalsePositive */]: "The flagged code **does not represent an actual vulnerability within the application's context.** This categorization indicates that the issue is either misidentified by the scanner or deemed irrelevant to the application's functionality.",
1608
- ["TEST_CODE" /* TestCode */]: "The flagged code resides in a test-specific path or context. This categorization indicates that **it supports testing scenarios and is isolated from production use**.",
1609
- ["UNFIXABLE" /* Unfixable */]: "The flagged code cannot be fixed",
1610
- ["VENDOR_CODE" /* VendorCode */]: "The flagged code originates from a third-party library or dependency maintained externally. This categorization suggests that **the issue lies outside the application's direct control** and should be addressed by the vendor if necessary."
1611
- };
1612
- function replaceKeysWithValues(fixDescription, extraContext) {
1613
- let result = fixDescription;
1614
- extraContext.forEach(({ key, value }) => {
1615
- result = result.replace(`\${${key}}`, value);
1616
- });
1617
- return result;
1618
- }
1619
- function getParsedFalsePositiveMessage(data) {
1620
- const { fixDescription, extraContext } = data;
1621
- const containsTemplate = extraContext.some(
1622
- (context) => fixDescription.includes(`\${${context.key}}`)
1623
- );
1624
- const description2 = containsTemplate ? replaceKeysWithValues(fixDescription, extraContext) : fixDescription;
1625
- const contextString = containsTemplate ? null : `\`\`\`${extraContext.map(({ value }) => value).join(" ")} \`\`\``;
1626
- return { description: description2, contextString };
1627
- }
1628
-
1629
- // src/features/analysis/scm/shared/src/validations.ts
1630
- var IssueTypeSettingZ = z6.object({
1631
- autoPrEnabled: z6.boolean(),
1632
- enabled: z6.boolean(),
1633
- issueType: z6.nativeEnum(IssueType_Enum)
1634
- });
1635
- var IssueTypeSettingsZ = z6.array(IssueTypeSettingZ).transform((issueTypeSettings) => {
1636
- return Object.values(IssueType_Enum).map((issueTypeEnum) => {
1637
- const existingIssueTypeSetting = issueTypeSettings.find(
1638
- ({ issueType: dbIssueType }) => dbIssueType === issueTypeEnum
1639
- );
1640
- if (existingIssueTypeSetting) {
1641
- return existingIssueTypeSetting;
1642
- }
1643
- return {
1644
- autoPrEnabled: false,
1645
- enabled: true,
1646
- issueType: issueTypeEnum
1647
- };
1648
- }).sort((a, b) => {
1649
- return getIssueTypeFriendlyString(a.issueType).localeCompare(
1650
- getIssueTypeFriendlyString(b.issueType)
1651
- );
1652
- });
1653
- });
1654
-
1655
- // src/features/analysis/scm/shared/src/types/types.ts
1656
- var OrganizationScreenQueryParamsZ = z7.object({
1657
- organizationId: z7.string().uuid()
1658
- });
1659
- var ProjectPageQueryParamsZ = z7.object({
1660
- organizationId: z7.string().uuid(),
1661
- projectId: z7.string().uuid()
1662
- });
1663
- var AnalysisPageQueryParamsZ = ProjectPageQueryParamsZ.extend({
1664
- reportId: z7.string().uuid()
1665
- });
1666
- var FixPageQueryParamsZ = AnalysisPageQueryParamsZ.extend({
1667
- fixId: z7.string().uuid()
1668
- });
1669
- var IssuePageQueryParamsZ = AnalysisPageQueryParamsZ.extend({
1670
- issueId: z7.string().uuid()
1671
- });
1672
- var CliLoginPageQueryParamsZ = z7.object({
1673
- loginId: z7.string().uuid()
1674
- });
1675
- var AnalysisReportDigestedZ = z7.object({
1676
- id: z7.string().uuid(),
1677
- state: z7.nativeEnum(Fix_Report_State_Enum),
1678
- vulnerabilityReport: z7.object({
1679
- reportSummaryUrl: z7.string().url().nullish(),
1680
- scanDate: z7.string().nullable(),
1681
- supported: z7.object({
1682
- aggregate: z7.object({
1683
- count: z7.number()
1684
- })
1685
- }),
1686
- all: z7.object({
1687
- aggregate: z7.object({
1688
- count: z7.number()
1689
- })
1690
- }),
1691
- vendor: z7.nativeEnum(Vulnerability_Report_Vendor_Enum),
1692
- project: z7.object({
1693
- organizationId: z7.string().uuid()
1694
- })
1695
- })
1696
- });
1697
- var ReportQueryResultZ = z7.object({
1698
- fixReport_by_pk: z7.object({
1699
- id: z7.string().uuid(),
1700
- analysisUrl: z7.string(),
1701
- fixesCommitted: z7.object({
1702
- aggregate: z7.object({ count: z7.number() })
1703
- }),
1704
- fixesDownloaded: z7.object({
1705
- aggregate: z7.object({ count: z7.number() })
1706
- }),
1707
- fixesDoneCount: z7.number(),
1708
- fixesInprogressCount: z7.number(),
1709
- fixesReadyCount: z7.object({
1710
- aggregate: z7.object({ count: z7.number() })
1711
- }),
1712
- issueTypes: z7.record(z7.string(), z7.number()).nullable(),
1713
- issueLanguages: z7.record(z7.string(), z7.number()).nullable(),
1714
- fixesCountByEffort: z7.record(z7.string(), z7.number()).nullable(),
1715
- vulnerabilitySeverities: z7.record(z7.string(), z7.number()).nullable(),
1716
- createdOn: z7.string(),
1717
- expirationOn: z7.string().nullable(),
1718
- state: z7.nativeEnum(Fix_Report_State_Enum),
1719
- fixes: z7.array(
1720
- z7.object({
1721
- id: z7.string().uuid(),
1722
- safeIssueLanguage: z7.string(),
1723
- safeIssueType: z7.string(),
1724
- confidence: z7.number(),
1725
- effortToApplyFix: z7.nativeEnum(Effort_To_Apply_Fix_Enum).nullable(),
1726
- modifiedBy: z7.string().nullable(),
1727
- gitBlameLogin: z7.string().nullable(),
1728
- fixReportId: z7.string().uuid(),
1729
- filePaths: z7.array(
1730
- z7.object({
1731
- fileRepoRelativePath: z7.string()
1732
- })
1733
- ),
1734
- sharedState: FixSharedStateZ,
1735
- numberOfVulnerabilityIssues: z7.number(),
1736
- severityText: z7.nativeEnum(Vulnerability_Severity_Enum),
1737
- vulnerabilityReportIssues: z7.array(
1738
- z7.object({
1739
- id: z7.string().uuid(),
1740
- issueType: z7.string(),
1741
- issueLanguage: z7.string(),
1742
- category: z7.string()
1743
- })
1744
- )
1745
- // scmSubmitFixRequests: ScmSubmitFixRequestsZ,
1746
- })
1747
- ),
1748
- repo: z7.object({
1749
- name: z7.string().nullable(),
1750
- originalUrl: z7.string(),
1751
- reference: z7.string(),
1752
- commitSha: z7.string(),
1753
- isKnownBranch: z7.boolean().nullish().default(true)
1754
- }),
1755
- vulnerabilityReportIssuesFixedCount: z7.object({
1756
- vulnerabilityReportIssues_aggregate: z7.object({
1757
- aggregate: z7.object({ count: z7.number() })
1758
- })
1759
- }),
1760
- vulnerabilityReport: z7.object({
1761
- id: z7.string().uuid(),
1762
- reportSummaryUrl: z7.string().url().nullish(),
1763
- vendor: z7.nativeEnum(Vulnerability_Report_Vendor_Enum).nullable(),
1764
- issuesWithKnownLanguage: z7.number().nullable(),
1765
- scanDate: z7.string().nullable(),
1766
- vendorReportId: z7.string().uuid().nullable(),
1767
- projectId: z7.string().uuid(),
1768
- project: z7.object({
1769
- organizationId: z7.string().uuid()
1770
- }),
1771
- file: z7.object({
1772
- id: z7.string().uuid(),
1773
- path: z7.string()
1774
- }),
1775
- pending: z7.object({
1776
- aggregate: z7.object({
1777
- count: z7.number()
1778
- })
1779
- }),
1780
- irrelevant: z7.object({
1781
- aggregate: z7.object({
1782
- count: z7.number()
1783
- })
1784
- }),
1785
- remaining: z7.object({
1786
- aggregate: z7.object({
1787
- count: z7.number()
1788
- })
1789
- }),
1790
- digested: z7.object({
1791
- aggregate: z7.object({
1792
- count: z7.number()
1793
- })
1794
- }),
1795
- supported: z7.object({
1796
- aggregate: z7.object({
1797
- count: z7.number()
1798
- })
1799
- }),
1800
- all: z7.object({
1801
- aggregate: z7.object({
1802
- count: z7.number()
1803
- })
1804
- }),
1805
- fixable: z7.object({
1806
- aggregate: z7.object({
1807
- count: z7.number()
1808
- })
1809
- }),
1810
- errors: z7.object({
1811
- aggregate: z7.object({
1812
- count: z7.number()
1813
- })
1814
- }),
1815
- vulnerabilityReportIssues: z7.object({
1816
- id: z7.string().uuid(),
1817
- extraData: z7.object({
1818
- missing_files: z7.string().array().nullish(),
1819
- large_files: z7.string().array().nullish(),
1820
- error_files: z7.string().array().nullish()
1821
- })
1822
- }).array()
1823
- })
1824
- })
1825
- });
1826
- var ReportFixesQueryFixZ = z7.object({
1827
- id: z7.string().uuid(),
1828
- sharedState: FixSharedStateZ,
1829
- confidence: z7.number(),
1830
- gitBlameLogin: z7.string().nullable(),
1831
- effortToApplyFix: z7.nativeEnum(Effort_To_Apply_Fix_Enum).nullable(),
1832
- safeIssueLanguage: z7.string(),
1833
- safeIssueType: z7.string(),
1834
- fixReportId: z7.string().uuid(),
1835
- filePaths: z7.array(
1836
- z7.object({
1837
- fileRepoRelativePath: z7.string()
1838
- })
1839
- ),
1840
- numberOfVulnerabilityIssues: z7.number(),
1841
- severityText: z7.nativeEnum(Vulnerability_Severity_Enum),
1842
- vulnerabilityReportIssues: z7.array(
1843
- z7.object({
1844
- issueType: z7.string(),
1845
- issueLanguage: z7.string()
1846
- })
1847
- ).min(1)
1848
- });
1849
- var VulnerabilityReportIssueZ = z7.object({
1850
- id: z7.string().uuid(),
1851
- createdAt: z7.string(),
1852
- state: z7.nativeEnum(Vulnerability_Report_Issue_State_Enum),
1853
- safeIssueType: z7.string(),
1854
- safeIssueLanguage: z7.string(),
1855
- extraData: z7.object({
1856
- missing_files: z7.string().array().nullish(),
1857
- large_files: z7.string().array().nullish(),
1858
- error_files: z7.string().array().nullish()
1859
- }),
1860
- fix: ReportFixesQueryFixZ.nullable(),
1861
- falsePositive: z7.object({
1862
- id: z7.string().uuid()
1863
- }).nullable(),
1864
- parsedSeverity: ParsedSeverityZ,
1865
- severity: z7.string(),
1866
- severityValue: z7.number(),
1867
- category: z7.string(),
1868
- codeNodes: z7.array(z7.object({ path: z7.string() })),
1869
- vulnerabilityReportIssueTags: z7.array(
1870
- z7.object({
1871
- vulnerability_report_issue_tag_value: z7.string()
1872
- })
1873
- ),
1874
- sharedState: VulnerabilityReportIssueSharedStateZ
1875
- });
1876
- var GetReportIssuesQueryZ = z7.object({
1877
- fixReport: z7.object({
1878
- vulnerabilityReport: z7.object({
1879
- id: z7.string().uuid(),
1880
- lastIssueUpdatedAt: z7.string(),
1881
- vulnerabilityReportIssues_aggregate: z7.object({
1882
- aggregate: z7.object({ count: z7.number() })
1883
- }),
1884
- vulnerabilityReportIssues: z7.array(VulnerabilityReportIssueZ)
1885
- })
1886
- }).array()
1887
- }).nullish();
1888
- var FixReportByProjectZ = z7.object({
1889
- project_by_pk: z7.object({
1890
- vulnerabilityReports: z7.array(
1891
- z7.object({
1892
- fixReport: z7.object({ id: z7.string().uuid() }).nullable()
1893
- })
1894
- )
1895
- })
1896
- });
1897
- var FixScreenQueryResultZ = z7.object({
1898
- fixReport_by_pk: FixPageFixReportZ,
1899
- fix_by_pk: FixPartsForFixScreenZ,
1900
- fixesWithSameIssueType: z7.array(
1901
- z7.object({
1902
- id: z7.string().uuid(),
1903
- sharedState: z7.object({ state: z7.nativeEnum(Fix_State_Enum) }).nullable().default({ state: "Ready" /* Ready */ })
1904
- })
1905
- ),
1906
- relevantIssue: IssuePartsZ.nullish()
1907
- });
1908
- var FixPageQueryZ = z7.object({
1909
- data: FixScreenQueryResultZ
1910
- });
1911
- var GetReportFixesQueryZ = z7.object({
1912
- fixReport: z7.array(
1913
- z7.object({
1914
- fixes: z7.array(ReportFixesQueryFixZ),
1915
- vulnerabilityReportIssuesTotalCount: z7.object({
1916
- vulnerabilityReportIssues_aggregate: z7.object({
1917
- aggregate: z7.object({ count: z7.number() })
1918
- })
1919
- }),
1920
- vulnerabilityReportIssuesFixedCount: z7.object({
1921
- vulnerabilityReportIssues_aggregate: z7.object({
1922
- aggregate: z7.object({ count: z7.number() })
1923
- })
1924
- }),
1925
- vulnerabilityReportIssuesIrrelevantCount: z7.object({
1926
- vulnerabilityReportIssues_aggregate: z7.object({
1927
- aggregate: z7.object({ count: z7.number() })
1928
- })
1929
- }),
1930
- vulnerabilityReportIssuesRemainingCount: z7.object({
1931
- vulnerabilityReportIssues_aggregate: z7.object({
1932
- aggregate: z7.object({ count: z7.number() })
1933
- })
1934
- })
1935
- })
1936
- )
1937
- }).nullish();
1938
- var ProjectVulnerabilityReport = z7.object({
1939
- id: z7.string().uuid(),
1940
- name: z7.string().nullable(),
1941
- vendor: z7.nativeEnum(Vulnerability_Report_Vendor_Enum).nullable(),
1942
- fixReport: z7.object({
1943
- id: z7.string().uuid(),
1944
- createdOn: z7.string(),
1945
- vulnerabilityReportIssuesFixedCount: z7.object({
1946
- vulnerabilityReportIssues_aggregate: z7.object({
1947
- aggregate: z7.object({ count: z7.number() })
1948
- })
1949
- }),
1950
- issueTypes: z7.record(z7.string(), z7.number()).nullable(),
1951
- issueLanguages: z7.record(z7.nativeEnum(IssueLanguage_Enum), z7.number()).nullable(),
1952
- fixesCountByEffort: z7.record(z7.nativeEnum(Effort_To_Apply_Fix_Enum), z7.number()).nullable(),
1953
- vulnerabilitySeverities: z7.record(z7.nativeEnum(Vulnerability_Severity_Enum), z7.number()).nullable(),
1954
- fixesDoneCount: z7.number(),
1955
- fixesInprogressCount: z7.number(),
1956
- fixesReadyCount: z7.number(),
1957
- repo: z7.object({
1958
- originalUrl: z7.string(),
1959
- reference: z7.string(),
1960
- name: z7.string()
1961
- }),
1962
- createdByUser: z7.object({
1963
- email: z7.string()
1964
- }).nullable(),
1965
- state: z7.nativeEnum(Fix_Report_State_Enum),
1966
- expirationOn: z7.string()
1967
- })
1968
- });
1969
- var ProjectGetProjectZ = z7.object({
1970
- id: z7.string().uuid(),
1971
- name: z7.string(),
1972
- vulnerabilityReports: z7.object({
1973
- vendor: z7.nativeEnum(Vulnerability_Report_Vendor_Enum).nullable(),
1974
- fixReport: z7.object({
1975
- issueLanguages: z7.record(z7.nativeEnum(IssueLanguage_Enum), z7.number()).nullable(),
1976
- state: z7.nativeEnum(Fix_Report_State_Enum),
1977
- repo: z7.object({
1978
- originalUrl: z7.string(),
1979
- reference: z7.string()
1980
- }),
1981
- expirationOn: z7.string()
1982
- })
1983
- }).array()
1984
- });
1985
- var GetProjectsQueryZ = z7.array(ProjectGetProjectZ);
1986
- var ProjectPageQueryResultZ = z7.object({
1987
- name: z7.string(),
1988
- id: z7.string().uuid(),
1989
- isDefault: z7.boolean().default(false),
1990
- organizationId: z7.string().uuid(),
1991
- vulnerabilityReports: z7.array(ProjectVulnerabilityReport),
1992
- projectIssueTypeSettings: z7.array(
1993
- IssueTypeSettingZ.merge(z7.object({ id: z7.string() }))
1994
- )
1995
- });
1996
- var GetProjectMembersDataZ = z7.object({
1997
- project_by_pk: z7.object({
1998
- name: z7.string(),
1999
- id: z7.string(),
2000
- projectUsers: z7.array(
2001
- z7.object({
2002
- projectToRole: z7.object({
2003
- projectRole: z7.object({
2004
- type: z7.nativeEnum(Project_Role_Type_Enum)
2005
- })
2006
- }),
2007
- user: z7.object({
2008
- id: z7.string().uuid(),
2009
- picture: z7.string().optional(),
2010
- name: z7.string().nullish(),
2011
- email: z7.string().email()
2012
- })
2013
- })
2014
- )
2015
- })
2016
- });
2017
- var RepoArgsZ = z7.object({
2018
- originalUrl: z7.string().url(),
2019
- branch: z7.string(),
2020
- commitSha: z7.string()
2021
- });
2022
- var scmCloudUrl = {
2023
- GitLab: "https://gitlab.com",
2024
- GitHub: "https://github.com",
2025
- Ado: "https://dev.azure.com",
2026
- Bitbucket: "https://bitbucket.org"
2027
- };
2028
- var ScmType = /* @__PURE__ */ ((ScmType2) => {
2029
- ScmType2["GitHub"] = "GitHub";
2030
- ScmType2["GitLab"] = "GitLab";
2031
- ScmType2["Ado"] = "Ado";
2032
- ScmType2["Bitbucket"] = "Bitbucket";
2033
- return ScmType2;
2034
- })(ScmType || {});
2035
- var ConvertToSarifInputFileFormat = /* @__PURE__ */ ((ConvertToSarifInputFileFormat2) => {
2036
- ConvertToSarifInputFileFormat2["FortifyFPR"] = "FortifyFPR";
2037
- return ConvertToSarifInputFileFormat2;
2038
- })(ConvertToSarifInputFileFormat || {});
2039
-
2040
- // src/features/analysis/scm/ado/constants.ts
2041
- var DEFUALT_ADO_ORIGIN = scmCloudUrl.Ado;
2042
-
2043
- // src/features/analysis/scm/ado/utils.ts
2044
- import querystring from "querystring";
2045
- import * as api from "azure-devops-node-api";
2046
- import Debug from "debug";
2047
- import { z as z17 } from "zod";
2048
-
2049
- // src/features/analysis/scm/env.ts
2050
- import { z as z8 } from "zod";
2051
- var EnvVariablesZod = z8.object({
2052
- GITLAB_API_TOKEN: z8.string().optional(),
2053
- GITHUB_API_TOKEN: z8.string().optional(),
2054
- GIT_PROXY_HOST: z8.string().optional().default("http://tinyproxy:8888")
2055
- });
2056
- var { GITLAB_API_TOKEN, GITHUB_API_TOKEN, GIT_PROXY_HOST } = EnvVariablesZod.parse(process.env);
2057
-
2058
- // src/features/analysis/scm/shared/src/commitDescriptionMarkup.ts
2059
- import { z as z9 } from "zod";
2060
-
2061
1136
  // src/features/analysis/scm/shared/src/fixDetailsData.ts
2062
1137
  var fixDetailsData = {
2063
1138
  ["PT" /* Pt */]: {
@@ -2324,6 +1399,170 @@ var fixDetailsData = {
2324
1399
  ["DO_NOT_THROW_GENERIC_EXCEPTION" /* DoNotThrowGenericException */]: void 0
2325
1400
  };
2326
1401
 
1402
+ // src/features/analysis/scm/shared/src/getIssueType.ts
1403
+ import { z } from "zod";
1404
+ var issueTypeMap = {
1405
+ ["NO_LIMITS_OR_THROTTLING" /* NoLimitsOrThrottling */]: "Missing Rate Limiting",
1406
+ ["SQL_Injection" /* SqlInjection */]: "SQL Injection",
1407
+ ["CMDi_relative_path_command" /* CmDiRelativePathCommand */]: "Relative Path Command Injection",
1408
+ ["CMDi" /* CmDi */]: "Command Injection",
1409
+ ["CONFUSING_NAMING" /* ConfusingNaming */]: "Confusing Naming",
1410
+ ["XXE" /* Xxe */]: "XXE",
1411
+ ["XSS" /* Xss */]: "XSS",
1412
+ ["PT" /* Pt */]: "Path Traversal",
1413
+ ["ZIP_SLIP" /* ZipSlip */]: "Zip Slip",
1414
+ ["INSECURE_RANDOMNESS" /* InsecureRandomness */]: "Insecure Randomness",
1415
+ ["SSRF" /* Ssrf */]: "Server Side Request Forgery",
1416
+ ["TYPE_CONFUSION" /* TypeConfusion */]: "Type Confusion",
1417
+ ["REGEX_INJECTION" /* RegexInjection */]: "Regular Expression Injection",
1418
+ ["INCOMPLETE_URL_SANITIZATION" /* IncompleteUrlSanitization */]: "Incomplete URL Sanitization",
1419
+ ["LOCALE_DEPENDENT_COMPARISON" /* LocaleDependentComparison */]: "Locale Dependent Comparison",
1420
+ ["LOG_FORGING" /* LogForging */]: "Log Forging",
1421
+ ["MISSING_CHECK_AGAINST_NULL" /* MissingCheckAgainstNull */]: "Missing Check against Null",
1422
+ ["PASSWORD_IN_COMMENT" /* PasswordInComment */]: "Password in Comment",
1423
+ ["OVERLY_BROAD_CATCH" /* OverlyBroadCatch */]: "Poor Error Handling: Overly Broad Catch",
1424
+ ["USE_OF_SYSTEM_OUTPUT_STREAM" /* UseOfSystemOutputStream */]: "Use of System.out/System.err",
1425
+ ["DANGEROUS_FUNCTION_OVERFLOW" /* DangerousFunctionOverflow */]: "Use of dangerous function",
1426
+ ["DOS_STRING_BUILDER" /* DosStringBuilder */]: "Denial of Service: StringBuilder",
1427
+ ["OPEN_REDIRECT" /* OpenRedirect */]: "Open Redirect",
1428
+ ["WEAK_XML_SCHEMA_UNBOUNDED_OCCURRENCES" /* WeakXmlSchemaUnboundedOccurrences */]: "Weak XML Schema: Unbounded Occurrences",
1429
+ ["SYSTEM_INFORMATION_LEAK" /* SystemInformationLeak */]: "System Information Leak",
1430
+ ["SYSTEM_INFORMATION_LEAK_EXTERNAL" /* SystemInformationLeakExternal */]: "External System Information Leak",
1431
+ ["HTTP_RESPONSE_SPLITTING" /* HttpResponseSplitting */]: "HTTP response splitting",
1432
+ ["HTTP_ONLY_COOKIE" /* HttpOnlyCookie */]: "Cookie is not HttpOnly",
1433
+ ["INSECURE_COOKIE" /* InsecureCookie */]: "Insecure Cookie",
1434
+ ["TRUST_BOUNDARY_VIOLATION" /* TrustBoundaryViolation */]: "Trust Boundary Violation",
1435
+ ["NULL_DEREFERENCE" /* NullDereference */]: "Null Dereference",
1436
+ ["UNSAFE_DESERIALIZATION" /* UnsafeDeserialization */]: "Unsafe deserialization",
1437
+ ["INSECURE_BINDER_CONFIGURATION" /* InsecureBinderConfiguration */]: "Insecure Binder Configuration",
1438
+ ["UNSAFE_TARGET_BLANK" /* UnsafeTargetBlank */]: "Unsafe use of target blank",
1439
+ ["IFRAME_WITHOUT_SANDBOX" /* IframeWithoutSandbox */]: "Client use of iframe without sandbox",
1440
+ ["JQUERY_DEPRECATED_SYMBOLS" /* JqueryDeprecatedSymbols */]: "jQuery deprecated symbols",
1441
+ ["MISSING_ANTIFORGERY_VALIDATION" /* MissingAntiforgeryValidation */]: "Missing Anti-Forgery Validation",
1442
+ ["GRAPHQL_DEPTH_LIMIT" /* GraphqlDepthLimit */]: "GraphQL Depth Limit",
1443
+ ["UNCHECKED_LOOP_CONDITION" /* UncheckedLoopCondition */]: "Unchecked Loop Condition",
1444
+ ["IMPROPER_RESOURCE_SHUTDOWN_OR_RELEASE" /* ImproperResourceShutdownOrRelease */]: "Improper Resource Shutdown or Release",
1445
+ ["IMPROPER_EXCEPTION_HANDLING" /* ImproperExceptionHandling */]: "Improper Exception Handling",
1446
+ ["DEFAULT_RIGHTS_IN_OBJ_DEFINITION" /* DefaultRightsInObjDefinition */]: "Default Definer Rights in Package or Object Definition",
1447
+ ["HTML_COMMENT_IN_JSP" /* HtmlCommentInJsp */]: "HTML Comment in JSP",
1448
+ ["ERROR_CONDTION_WITHOUT_ACTION" /* ErrorCondtionWithoutAction */]: "Error Condition Without Action",
1449
+ ["DEPRECATED_FUNCTION" /* DeprecatedFunction */]: "Deprecated Function",
1450
+ ["HARDCODED_SECRETS" /* HardcodedSecrets */]: "Hardcoded Secrets",
1451
+ ["PROTOTYPE_POLLUTION" /* PrototypePollution */]: "Prototype Pollution",
1452
+ ["RACE_CONDITION_FORMAT_FLAW" /* RaceConditionFormatFlaw */]: "Race Condition Format Flaw",
1453
+ ["NON_FINAL_PUBLIC_STATIC_FIELD" /* NonFinalPublicStaticField */]: "Non-final Public Static Field",
1454
+ ["MISSING_HSTS_HEADER" /* MissingHstsHeader */]: "Missing HSTS Header",
1455
+ ["DEAD_CODE_UNUSED_FIELD" /* DeadCodeUnusedField */]: "Dead Code: Unused Field",
1456
+ ["HEADER_MANIPULATION" /* HeaderManipulation */]: "Header Manipulation",
1457
+ ["MISSING_EQUALS_OR_HASHCODE" /* MissingEqualsOrHashcode */]: "Missing equals or hashcode method",
1458
+ ["WCF_MISCONFIGURATION_INSUFFICIENT_LOGGING" /* WcfMisconfigurationInsufficientLogging */]: "WCF Misconfiguration: Insufficient Logging",
1459
+ ["WCF_MISCONFIGURATION_THROTTLING_NOT_ENABLED" /* WcfMisconfigurationThrottlingNotEnabled */]: "WCF Misconfiguration: Throttling Not Enabled",
1460
+ ["USELESS_REGEXP_CHAR_ESCAPE" /* UselessRegexpCharEscape */]: "Useless regular-expression character escape",
1461
+ ["INCOMPLETE_HOSTNAME_REGEX" /* IncompleteHostnameRegex */]: "Incomplete Hostname Regex",
1462
+ ["OVERLY_LARGE_RANGE" /* OverlyLargeRange */]: "Regex: Overly Large Range",
1463
+ ["INSUFFICIENT_LOGGING" /* InsufficientLogging */]: "Insufficient Logging of Sensitive Operations",
1464
+ ["PRIVACY_VIOLATION" /* PrivacyViolation */]: "Privacy Violation",
1465
+ ["INCOMPLETE_URL_SCHEME_CHECK" /* IncompleteUrlSchemeCheck */]: "Incomplete URL Scheme Check",
1466
+ ["VALUE_NEVER_READ" /* ValueNeverRead */]: "Value Never Read",
1467
+ ["VALUE_SHADOWING" /* ValueShadowing */]: "Value Shadowing",
1468
+ ["NO_EQUIVALENCE_METHOD" /* NoEquivalenceMethod */]: "Class Does Not Implement Equivalence Method",
1469
+ ["INFORMATION_EXPOSURE_VIA_HEADERS" /* InformationExposureViaHeaders */]: "Information Exposure via Headers",
1470
+ ["DEBUG_ENABLED" /* DebugEnabled */]: "Debug Enabled",
1471
+ ["LEFTOVER_DEBUG_CODE" /* LeftoverDebugCode */]: "Leftover Debug Code",
1472
+ ["POOR_ERROR_HANDLING_EMPTY_CATCH_BLOCK" /* PoorErrorHandlingEmptyCatchBlock */]: "Poor Error Handling: Empty Catch Block",
1473
+ ["ERRONEOUS_STRING_COMPARE" /* ErroneousStringCompare */]: "Erroneous String Compare",
1474
+ ["UNVALIDATED_PUBLIC_METHOD_ARGUMENT" /* UnvalidatedPublicMethodArgument */]: "Unvalidated Public Method Argument",
1475
+ ["AUTO_ESCAPE_FALSE" /* AutoEscapeFalse */]: "Auto-escape False",
1476
+ ["MISSING_CSP_HEADER" /* MissingCspHeader */]: "Missing CSP Header",
1477
+ ["HARDCODED_DOMAIN_IN_HTML" /* HardcodedDomainInHtml */]: "Hardcoded Domain in HTML",
1478
+ ["HEAP_INSPECTION" /* HeapInspection */]: "Heap Inspection",
1479
+ ["CLIENT_DOM_STORED_CODE_INJECTION" /* ClientDomStoredCodeInjection */]: "Client Code Injection",
1480
+ ["STRING_FORMAT_MISUSE" /* StringFormatMisuse */]: "String Format Misuse",
1481
+ ["NON_READONLY_FIELD" /* NonReadonlyField */]: "Non Readonly Field",
1482
+ ["CSRF" /* Csrf */]: "Cross-Site Request Forgery (CSRF)",
1483
+ ["WEAK_ENCRYPTION" /* WeakEncryption */]: "Weak Encryption Mechanism",
1484
+ ["CODE_IN_COMMENT" /* CodeInComment */]: "Code in Comment",
1485
+ ["REGEX_MISSING_TIMEOUT" /* RegexMissingTimeout */]: "Regex Missing Timeout",
1486
+ ["FRAMEABLE_LOGIN_PAGE" /* FrameableLoginPage */]: "Frameable Login Page",
1487
+ ["USE_OF_HARD_CODED_CRYPTOGRAPHIC_KEY" /* UseOfHardCodedCryptographicKey */]: "Use of Hardcoded Cryptographic Key",
1488
+ ["MISSING_SSL_MINVERSION" /* MissingSslMinversion */]: "Missing SSL MinVersion",
1489
+ ["WEBSOCKET_MISSING_ORIGIN_CHECK" /* WebsocketMissingOriginCheck */]: "Missing Websocket Origin Check",
1490
+ ["DUPLICATED_STRINGS" /* DuplicatedStrings */]: "String Literals Should not Be Duplicated",
1491
+ ["INSECURE_UUID_VERSION" /* InsecureUuidVersion */]: "Insecure UUID Version",
1492
+ ["GH_ACTIONS_SHELL_INJECTION" /* GhActionsShellInjection */]: "GitHub Actions Shell Injection",
1493
+ ["MODIFIED_DEFAULT_PARAM" /* ModifiedDefaultParam */]: "Modified Default Param",
1494
+ ["UNSAFE_WEB_THREAD" /* UnsafeWebThread */]: "Unsafe Web Thread",
1495
+ ["NO_VAR" /* NoVar */]: 'Prefer "let" or "const"',
1496
+ ["INSECURE_TMP_FILE" /* InsecureTmpFile */]: "Insecure Temporary File",
1497
+ ["RETURN_SHOULD_NOT_BE_INVARIANT" /* ReturnShouldNotBeInvariant */]: "Return Should Not Be Invariant",
1498
+ ["SYSTEM_EXIT_SHOULD_RERAISE" /* SystemExitShouldReraise */]: "SystemExit Should Reraise",
1499
+ ["NO_RETURN_IN_FINALLY" /* NoReturnInFinally */]: "No Return in Finally Block",
1500
+ ["WILDCARD_IMPORTS" /* WildcardImports */]: "Wildcard Imports should not be used",
1501
+ ["AVOID_IDENTITY_COMPARISON_CACHED_TYPES" /* AvoidIdentityComparisonCachedTypes */]: "Avoid Identity Comparison of Cached Types",
1502
+ ["AVOID_BUILTIN_SHADOWING" /* AvoidBuiltinShadowing */]: "Avoid Builtin Shadowing",
1503
+ ["IMPROPER_STRING_FORMATTING" /* ImproperStringFormatting */]: "Improper String Formatting",
1504
+ ["TAR_SLIP" /* TarSlip */]: "Tar Slip",
1505
+ ["MISSING_WHITESPACE" /* MissingWhitespace */]: "Missing Whitespace",
1506
+ ["NO_PRINT_STATEMENT" /* NoPrintStatement */]: 'Python 2 "print" Statement Is Obsolete',
1507
+ ["NO_OP_OVERHEAD" /* NoOpOverhead */]: "Expensive Arguments in Conditional Methods",
1508
+ ["DO_NOT_RAISE_EXCEPTION" /* DoNotRaiseException */]: "Do Not Raise Exception",
1509
+ ["DECLARE_VARIABLE_EXPLICITLY" /* DeclareVariableExplicitly */]: "Declare Variable Explicitly",
1510
+ ["NO_NESTED_TRY" /* NoNestedTry */]: "No Nested Try",
1511
+ ["UNNECESSARY_IMPORTS" /* UnnecessaryImports */]: "Unnecessary Imports",
1512
+ ["REDOS" /* Redos */]: "Regular Expression Denial of Service",
1513
+ ["DO_NOT_THROW_GENERIC_EXCEPTION" /* DoNotThrowGenericException */]: "Do Not Throw Generic Exception"
1514
+ };
1515
+ var issueTypeZ = z.nativeEnum(IssueType_Enum);
1516
+ var getIssueTypeFriendlyString = (issueType) => {
1517
+ const issueTypeZParseRes = issueTypeZ.safeParse(issueType);
1518
+ if (!issueTypeZParseRes.success) {
1519
+ return issueType ? issueType.replaceAll("_", " ") : "Other";
1520
+ }
1521
+ return issueTypeMap[issueTypeZParseRes.data];
1522
+ };
1523
+ function getTagTooltip(tag) {
1524
+ switch (tag) {
1525
+ case "FALSE_POSITIVE":
1526
+ return "Issue was found to be a false positive";
1527
+ case "TEST_CODE":
1528
+ return "Issue found in test files, not production code";
1529
+ case "VENDOR_CODE":
1530
+ return "Issue is in external libraries or dependencies not owned or maintained by your team";
1531
+ case "AUTOGENERATED_CODE":
1532
+ return "Code created by tools or frameworks, not manually written";
1533
+ case "AUXILIARY_CODE":
1534
+ return "Issue found in supporting files that don't impact core functionality";
1535
+ case "Filtered":
1536
+ return "Issue was filtered by user in the Fix Policy";
1537
+ default:
1538
+ return tag;
1539
+ }
1540
+ }
1541
+ var issueDescription = {
1542
+ ["AUTOGENERATED_CODE" /* AutogeneratedCode */]: "The flagged code is generated automatically by tools or frameworks as part of the build or runtime process. This categorization highlights that **the issue resides in non-manual code**, which often requires tool-specific solutions or exemptions.",
1543
+ ["AUXILIARY_CODE" /* AuxiliaryCode */]: "The flagged code is auxiliary or supporting code, such as configuration files, build scripts, or other non-application logic. This categorization indicates that the issue is not directly related to the application's core functionality.",
1544
+ ["FALSE_POSITIVE" /* FalsePositive */]: "The flagged code **does not represent an actual vulnerability within the application's context.** This categorization indicates that the issue is either misidentified by the scanner or deemed irrelevant to the application's functionality.",
1545
+ ["TEST_CODE" /* TestCode */]: "The flagged code resides in a test-specific path or context. This categorization indicates that **it supports testing scenarios and is isolated from production use**.",
1546
+ ["UNFIXABLE" /* Unfixable */]: "The flagged code cannot be fixed",
1547
+ ["VENDOR_CODE" /* VendorCode */]: "The flagged code originates from a third-party library or dependency maintained externally. This categorization suggests that **the issue lies outside the application's direct control** and should be addressed by the vendor if necessary."
1548
+ };
1549
+ function replaceKeysWithValues(fixDescription, extraContext) {
1550
+ let result = fixDescription;
1551
+ extraContext.forEach(({ key, value }) => {
1552
+ result = result.replace(`\${${key}}`, value);
1553
+ });
1554
+ return result;
1555
+ }
1556
+ function getParsedFalsePositiveMessage(data) {
1557
+ const { fixDescription, extraContext } = data;
1558
+ const containsTemplate = extraContext.some(
1559
+ (context) => fixDescription.includes(`\${${context.key}}`)
1560
+ );
1561
+ const description2 = containsTemplate ? replaceKeysWithValues(fixDescription, extraContext) : fixDescription;
1562
+ const contextString = containsTemplate ? null : `\`\`\`${extraContext.map(({ value }) => value).join(" ")} \`\`\``;
1563
+ return { description: description2, contextString };
1564
+ }
1565
+
2327
1566
  // src/features/analysis/scm/shared/src/commitDescriptionMarkup.ts
2328
1567
  function capitalizeFirstLetter(str) {
2329
1568
  return str?.length ? str[0].toUpperCase() + str.slice(1) : "";
@@ -2352,7 +1591,7 @@ var getCommitDescription = ({
2352
1591
  )}**.
2353
1592
 
2354
1593
  `;
2355
- const parseIssueTypeRes = z9.nativeEnum(IssueType_Enum).safeParse(issueType);
1594
+ const parseIssueTypeRes = z2.nativeEnum(IssueType_Enum).safeParse(issueType);
2356
1595
  if (issueType && parseIssueTypeRes.success) {
2357
1596
  if (irrelevantIssueWithTags?.[0]?.tag) {
2358
1597
  description2 += `
@@ -2395,7 +1634,7 @@ var getCommitIssueDescription = ({
2395
1634
  const issueTypeString = getIssueTypeFriendlyString(issueType);
2396
1635
  let description2 = `The following issues reported by ${capitalizeFirstLetter(vendor)} on this PR were found to be irrelevant to your project:
2397
1636
  `;
2398
- const parseIssueTypeRes = z9.nativeEnum(IssueType_Enum).safeParse(issueType);
1637
+ const parseIssueTypeRes = z2.nativeEnum(IssueType_Enum).safeParse(issueType);
2399
1638
  if (issueType && parseIssueTypeRes.success) {
2400
1639
  if (irrelevantIssueWithTags?.[0]?.tag) {
2401
1640
  description2 = `
@@ -2420,10 +1659,10 @@ ${staticData.issueDescription}
2420
1659
  };
2421
1660
 
2422
1661
  // src/features/analysis/scm/shared/src/guidances.ts
2423
- import { z as z12 } from "zod";
1662
+ import { z as z5 } from "zod";
2424
1663
 
2425
1664
  // src/features/analysis/scm/shared/src/storedFixData/index.ts
2426
- import { z as z10 } from "zod";
1665
+ import { z as z3 } from "zod";
2427
1666
 
2428
1667
  // src/features/analysis/scm/shared/src/storedFixData/passwordInComment.ts
2429
1668
  var passwordInComment = {
@@ -2599,8 +1838,8 @@ var vulnerabilities8 = {
2599
1838
  var xml_default = vulnerabilities8;
2600
1839
 
2601
1840
  // src/features/analysis/scm/shared/src/storedFixData/index.ts
2602
- var StoredFixDataItemZ = z10.object({
2603
- guidance: z10.function().returns(z10.string())
1841
+ var StoredFixDataItemZ = z3.object({
1842
+ guidance: z3.function().returns(z3.string())
2604
1843
  });
2605
1844
  var languages = {
2606
1845
  ["Java" /* Java */]: java_default,
@@ -2614,7 +1853,7 @@ var languages = {
2614
1853
  };
2615
1854
 
2616
1855
  // src/features/analysis/scm/shared/src/storedQuestionData/index.ts
2617
- import { z as z11 } from "zod";
1856
+ import { z as z4 } from "zod";
2618
1857
 
2619
1858
  // src/features/analysis/scm/shared/src/storedQuestionData/csharp/httpOnlyCookie.ts
2620
1859
  var httpOnlyCookie = {
@@ -3836,10 +3075,10 @@ var vulnerabilities14 = {
3836
3075
  var xml_default2 = vulnerabilities14;
3837
3076
 
3838
3077
  // src/features/analysis/scm/shared/src/storedQuestionData/index.ts
3839
- var StoredQuestionDataItemZ = z11.object({
3840
- content: z11.function().args(z11.any()).returns(z11.string()),
3841
- description: z11.function().args(z11.any()).returns(z11.string()),
3842
- guidance: z11.function().args(z11.any()).returns(z11.string())
3078
+ var StoredQuestionDataItemZ = z4.object({
3079
+ content: z4.function().args(z4.any()).returns(z4.string()),
3080
+ description: z4.function().args(z4.any()).returns(z4.string()),
3081
+ guidance: z4.function().args(z4.any()).returns(z4.string())
3843
3082
  });
3844
3083
  var languages2 = {
3845
3084
  ["Java" /* Java */]: java_default2,
@@ -3934,47 +3173,791 @@ function getFixGuidances({
3934
3173
  const fixGuidance = storeFixResult.success ? [storeFixResult.data.guidance({ questions, ...extraContext })] : [];
3935
3174
  return libGuidances.concat(fixGuidance).filter((guidance) => !!guidance);
3936
3175
  }
3937
- var IssueTypeAndLanguageZ = z12.object({
3938
- issueType: z12.nativeEnum(IssueType_Enum),
3939
- issueLanguage: z12.nativeEnum(IssueLanguage_Enum)
3176
+ var IssueTypeAndLanguageZ = z5.object({
3177
+ issueType: z5.nativeEnum(IssueType_Enum),
3178
+ issueLanguage: z5.nativeEnum(IssueLanguage_Enum)
3179
+ });
3180
+ function getGuidances(args) {
3181
+ const safeIssueTypeAndLanguage = IssueTypeAndLanguageZ.safeParse({
3182
+ issueType: args.issueType,
3183
+ issueLanguage: args.issueLanguage
3184
+ });
3185
+ if (!safeIssueTypeAndLanguage.success) {
3186
+ return [];
3187
+ }
3188
+ const { questions, fixExtraContext } = args;
3189
+ const { issueType, issueLanguage } = safeIssueTypeAndLanguage.data;
3190
+ const fixGuidances = getFixGuidances({
3191
+ issueType,
3192
+ issueLanguage,
3193
+ fixExtraContext,
3194
+ questions
3195
+ }).map((guidance, index) => ({ guidance, key: `fixGuidance_index_${index}` }));
3196
+ return questions.map((question) => {
3197
+ let questionGuidance = question.guidance;
3198
+ if (!questionGuidance && issueType && issueLanguage) {
3199
+ const getFixInformation = curriedQuestionInformationByQuestion({
3200
+ issueType,
3201
+ language: issueLanguage
3202
+ });
3203
+ const { guidance } = getFixInformation(question);
3204
+ questionGuidance = guidance({
3205
+ userInputValue: question.value
3206
+ });
3207
+ }
3208
+ return {
3209
+ ...question,
3210
+ guidance: questionGuidance
3211
+ };
3212
+ }).filter(({ guidance }) => !!guidance).map(({ guidance, key }) => ({ guidance, key })).concat(fixGuidances);
3213
+ }
3214
+
3215
+ // src/features/analysis/scm/shared/src/types/fix.ts
3216
+ import { z as z7 } from "zod";
3217
+
3218
+ // src/features/analysis/scm/shared/src/types/shared.ts
3219
+ import { z as z6 } from "zod";
3220
+ var ParsedSeverityZ = z6.nativeEnum(Vulnerability_Severity_Enum).nullish().transform((i) => i ?? "low" /* Low */);
3221
+ var ScmSubmitFixRequestsZ = z6.array(
3222
+ z6.object({
3223
+ scmSubmitFixRequest: z6.object({
3224
+ submitFixRequest: z6.object({
3225
+ createdByUser: z6.object({
3226
+ email: z6.string()
3227
+ }),
3228
+ targetBranchName: z6.string().default("")
3229
+ }),
3230
+ prUrl: z6.string().nullable(),
3231
+ prStatus: z6.nativeEnum(Pr_Status_Enum).nullable(),
3232
+ commitUrl: z6.string().nullable(),
3233
+ scmId: z6.string()
3234
+ })
3235
+ })
3236
+ );
3237
+
3238
+ // src/features/analysis/scm/shared/src/types/fix.ts
3239
+ var PackageInfoZ = z7.object({
3240
+ name: z7.string(),
3241
+ version: z7.string(),
3242
+ envName: z7.string().nullable()
3243
+ });
3244
+ var ManifestActionRequiredZ = z7.object({
3245
+ action: z7.nativeEnum(ManifestAction),
3246
+ language: z7.nativeEnum(Language),
3247
+ lib: PackageInfoZ,
3248
+ typesLib: PackageInfoZ.nullable()
3249
+ });
3250
+ var ExtraContextInternalZ = z7.object({
3251
+ key: z7.string(),
3252
+ value: z7.string().or(z7.boolean()).or(
3253
+ z7.object({
3254
+ int: z7.boolean(),
3255
+ integer: z7.boolean(),
3256
+ string: z7.boolean(),
3257
+ date: z7.boolean()
3258
+ })
3259
+ )
3260
+ });
3261
+ var FixExtraContextZ = z7.object({
3262
+ fixDescription: z7.string(),
3263
+ manifestActionsRequired: z7.array(ManifestActionRequiredZ),
3264
+ extraContext: z7.array(ExtraContextInternalZ)
3265
+ });
3266
+ var PatchAndQuestionsZ = z7.object({
3267
+ __typename: z7.literal("FixData"),
3268
+ patch: z7.string(),
3269
+ patchOriginalEncodingBase64: z7.string(),
3270
+ questions: z7.array(
3271
+ z7.object({
3272
+ name: z7.string(),
3273
+ key: z7.string(),
3274
+ index: z7.number(),
3275
+ defaultValue: z7.string(),
3276
+ value: z7.string().nullable(),
3277
+ extraContext: z7.array(ExtraContextInternalZ),
3278
+ inputType: z7.nativeEnum(FixQuestionInputType),
3279
+ options: z7.array(z7.string())
3280
+ })
3281
+ ),
3282
+ extraContext: FixExtraContextZ
3283
+ });
3284
+ var FixRatingZ = z7.object({
3285
+ voteScore: z7.number(),
3286
+ fixRatingTag: z7.nativeEnum(Fix_Rating_Tag_Enum).nullable().default(null),
3287
+ comment: z7.string().nullable().default(null),
3288
+ updatedDate: z7.string().nullable(),
3289
+ user: z7.object({
3290
+ email: z7.string(),
3291
+ name: z7.string()
3292
+ })
3293
+ });
3294
+ var FixSharedStateZ = z7.object({
3295
+ state: z7.nativeEnum(Fix_State_Enum),
3296
+ isArchived: z7.boolean(),
3297
+ scmSubmitFixRequests: ScmSubmitFixRequestsZ,
3298
+ fixRatings: z7.array(FixRatingZ).default([])
3299
+ }).nullish().transform(
3300
+ (data) => data ? data : {
3301
+ state: "Ready" /* Ready */,
3302
+ isArchived: false,
3303
+ scmSubmitFixRequests: [],
3304
+ fixRatings: []
3305
+ }
3306
+ );
3307
+ var FixQueryZ = z7.object({
3308
+ __typename: z7.literal("fix").optional(),
3309
+ id: z7.string().uuid(),
3310
+ sharedState: FixSharedStateZ,
3311
+ modifiedBy: z7.string().nullable(),
3312
+ gitBlameLogin: z7.string().nullable(),
3313
+ safeIssueLanguage: z7.string(),
3314
+ safeIssueType: z7.string(),
3315
+ confidence: z7.number(),
3316
+ fixReportId: z7.string().uuid(),
3317
+ isExpired: z7.boolean().default(false),
3318
+ fixFiles: z7.array(
3319
+ z7.object({
3320
+ fileRepoRelativePath: z7.string()
3321
+ })
3322
+ ),
3323
+ numberOfVulnerabilityIssues: z7.number(),
3324
+ severityText: z7.nativeEnum(Vulnerability_Severity_Enum),
3325
+ vulnerabilityReportIssues: z7.array(
3326
+ z7.object({
3327
+ vendorIssueId: z7.string(),
3328
+ issueLanguage: z7.string(),
3329
+ parsedSeverity: ParsedSeverityZ
3330
+ })
3331
+ ),
3332
+ patchAndQuestions: PatchAndQuestionsZ,
3333
+ effortToApplyFix: z7.nativeEnum(Effort_To_Apply_Fix_Enum).nullable()
3334
+ });
3335
+ var FixPartsForFixScreenZ = FixQueryZ.merge(
3336
+ z7.object({
3337
+ vulnerabilityReportIssues: z7.array(
3338
+ z7.object({
3339
+ vendorIssueId: z7.string(),
3340
+ issueType: z7.string(),
3341
+ issueLanguage: z7.string()
3342
+ })
3343
+ )
3344
+ })
3345
+ );
3346
+
3347
+ // src/features/analysis/scm/shared/src/types/issue.ts
3348
+ import { z as z9 } from "zod";
3349
+
3350
+ // src/features/analysis/scm/shared/src/types/analysis.ts
3351
+ import { z as z8 } from "zod";
3352
+ var FixPageFixReportZ = z8.object({
3353
+ id: z8.string().uuid(),
3354
+ analysisUrl: z8.string(),
3355
+ expirationOn: z8.string(),
3356
+ createdOn: z8.string(),
3357
+ state: z8.nativeEnum(Fix_Report_State_Enum),
3358
+ repo: z8.object({
3359
+ name: z8.string().nullable(),
3360
+ originalUrl: z8.string(),
3361
+ reference: z8.string(),
3362
+ commitSha: z8.string(),
3363
+ isKnownBranch: z8.boolean().nullable()
3364
+ }),
3365
+ vulnerabilityReport: z8.object({
3366
+ vendor: z8.nativeEnum(Vulnerability_Report_Vendor_Enum),
3367
+ vendorReportId: z8.string().uuid().nullable(),
3368
+ projectId: z8.string().uuid(),
3369
+ project: z8.object({
3370
+ organizationId: z8.string().uuid()
3371
+ }),
3372
+ file: z8.object({
3373
+ id: z8.string().uuid(),
3374
+ path: z8.string()
3375
+ }),
3376
+ pending: z8.object({
3377
+ aggregate: z8.object({
3378
+ count: z8.number()
3379
+ })
3380
+ }),
3381
+ supported: z8.object({
3382
+ aggregate: z8.object({
3383
+ count: z8.number()
3384
+ })
3385
+ }),
3386
+ all: z8.object({
3387
+ aggregate: z8.object({
3388
+ count: z8.number()
3389
+ })
3390
+ }),
3391
+ fixable: z8.object({
3392
+ aggregate: z8.object({
3393
+ count: z8.number()
3394
+ })
3395
+ }),
3396
+ errors: z8.object({
3397
+ aggregate: z8.object({
3398
+ count: z8.number()
3399
+ })
3400
+ }),
3401
+ vulnerabilityReportIssues: z8.object({
3402
+ extraData: z8.object({
3403
+ missing_files: z8.string().array().nullish(),
3404
+ large_files: z8.string().array().nullish(),
3405
+ error_files: z8.string().array().nullish()
3406
+ })
3407
+ }).array()
3408
+ })
3409
+ });
3410
+
3411
+ // src/features/analysis/scm/shared/src/types/issue.ts
3412
+ var MAX_SOURCE_CODE_FILE_SIZE_IN_BYTES = 1e5;
3413
+ var CATEGORY = {
3414
+ NoFix: "NoFix",
3415
+ Unsupported: "Unsupported",
3416
+ Irrelevant: "Irrelevant",
3417
+ FalsePositive: "FalsePositive",
3418
+ Fixable: "Fixable",
3419
+ Filtered: "Filtered"
3420
+ };
3421
+ var ValidCategoriesZ = z9.union([
3422
+ z9.literal(CATEGORY.NoFix),
3423
+ z9.literal(CATEGORY.Unsupported),
3424
+ z9.literal(CATEGORY.Irrelevant),
3425
+ z9.literal(CATEGORY.FalsePositive),
3426
+ z9.literal(CATEGORY.Fixable),
3427
+ z9.literal(CATEGORY.Filtered)
3428
+ ]);
3429
+ var VulnerabilityReportIssueSharedStateZ = z9.object({
3430
+ id: z9.string().uuid(),
3431
+ isArchived: z9.boolean()
3432
+ }).nullish();
3433
+ var BaseIssuePartsZ = z9.object({
3434
+ id: z9.string().uuid(),
3435
+ safeIssueType: z9.string(),
3436
+ safeIssueLanguage: z9.string(),
3437
+ createdAt: z9.string(),
3438
+ parsedSeverity: ParsedSeverityZ,
3439
+ category: ValidCategoriesZ,
3440
+ extraData: z9.object({
3441
+ missing_files: z9.string().array().nullish(),
3442
+ error_files: z9.string().array().nullish()
3443
+ }),
3444
+ vulnerabilityReportIssueTags: z9.array(
3445
+ z9.object({
3446
+ tag: z9.nativeEnum(Vulnerability_Report_Issue_Tag_Enum)
3447
+ })
3448
+ ),
3449
+ codeNodes: z9.array(
3450
+ z9.object({
3451
+ path: z9.string(),
3452
+ line: z9.number(),
3453
+ index: z9.number()
3454
+ })
3455
+ ).transform((nodes) => nodes.sort((a, b) => b.index - a.index)),
3456
+ sourceCodeNodes: z9.array(
3457
+ z9.object({
3458
+ sourceCodeFile: z9.object({
3459
+ path: z9.string(),
3460
+ signedFile: z9.object({
3461
+ url: z9.string()
3462
+ })
3463
+ })
3464
+ }).transform(async ({ sourceCodeFile }) => {
3465
+ const { url } = sourceCodeFile.signedFile;
3466
+ const sourceCodeRes = await fetch(url);
3467
+ if (Number(sourceCodeRes.headers.get("Content-Length")) > MAX_SOURCE_CODE_FILE_SIZE_IN_BYTES) {
3468
+ return null;
3469
+ }
3470
+ return {
3471
+ path: sourceCodeFile.path,
3472
+ fileContent: await sourceCodeRes.text()
3473
+ };
3474
+ })
3475
+ ).transform((nodes) => nodes.filter((node) => node !== null)),
3476
+ fix: FixPartsForFixScreenZ.nullish(),
3477
+ vulnerabilityReportIssueNodeDiffFile: z9.object({
3478
+ signedFile: z9.object({
3479
+ url: z9.string()
3480
+ }).transform(async ({ url }) => {
3481
+ const codeDiff = await fetch(url).then((res) => res.text());
3482
+ return { codeDiff };
3483
+ })
3484
+ }).nullish(),
3485
+ sharedState: VulnerabilityReportIssueSharedStateZ
3940
3486
  });
3941
- function getGuidances(args) {
3942
- const safeIssueTypeAndLanguage = IssueTypeAndLanguageZ.safeParse({
3943
- issueType: args.issueType,
3944
- issueLanguage: args.issueLanguage
3945
- });
3946
- if (!safeIssueTypeAndLanguage.success) {
3947
- return [];
3948
- }
3949
- const { questions, fixExtraContext } = args;
3950
- const { issueType, issueLanguage } = safeIssueTypeAndLanguage.data;
3951
- const fixGuidances = getFixGuidances({
3952
- issueType,
3953
- issueLanguage,
3954
- fixExtraContext,
3955
- questions
3956
- }).map((guidance, index) => ({ guidance, key: `fixGuidance_index_${index}` }));
3957
- return questions.map((question) => {
3958
- let questionGuidance = question.guidance;
3959
- if (!questionGuidance && issueType && issueLanguage) {
3960
- const getFixInformation = curriedQuestionInformationByQuestion({
3961
- issueType,
3962
- language: issueLanguage
3963
- });
3964
- const { guidance } = getFixInformation(question);
3965
- questionGuidance = guidance({
3966
- userInputValue: question.value
3967
- });
3487
+ var FalsePositivePartsZ = z9.object({
3488
+ extraContext: z9.array(z9.object({ key: z9.string(), value: z9.string() })),
3489
+ fixDescription: z9.string()
3490
+ });
3491
+ var IssuePartsWithFixZ = BaseIssuePartsZ.merge(
3492
+ z9.object({
3493
+ category: z9.literal(CATEGORY.Irrelevant),
3494
+ fix: FixPartsForFixScreenZ.nullish()
3495
+ })
3496
+ );
3497
+ var IssuePartsFpZ = BaseIssuePartsZ.merge(
3498
+ z9.object({
3499
+ category: z9.literal(CATEGORY.FalsePositive),
3500
+ fpId: z9.string().uuid(),
3501
+ getFalsePositive: FalsePositivePartsZ
3502
+ })
3503
+ );
3504
+ var GeneralIssueZ = BaseIssuePartsZ.merge(
3505
+ z9.object({
3506
+ category: z9.union([
3507
+ z9.literal(CATEGORY.NoFix),
3508
+ z9.literal(CATEGORY.Unsupported),
3509
+ z9.literal(CATEGORY.Fixable),
3510
+ z9.literal(CATEGORY.Filtered)
3511
+ ])
3512
+ })
3513
+ );
3514
+ var IssuePartsZ = z9.union([
3515
+ IssuePartsFpZ,
3516
+ IssuePartsWithFixZ,
3517
+ GeneralIssueZ
3518
+ ]);
3519
+ var GetIssueIndexesZ = z9.object({
3520
+ currentIndex: z9.number(),
3521
+ totalIssues: z9.number(),
3522
+ nextIssue: z9.object({
3523
+ id: z9.string().uuid()
3524
+ }).nullish(),
3525
+ prevIssue: z9.object({
3526
+ id: z9.string().uuid()
3527
+ }).nullish()
3528
+ });
3529
+ var GetIssueScreenDataZ = z9.object({
3530
+ fixReport_by_pk: FixPageFixReportZ,
3531
+ vulnerability_report_issue_by_pk: IssuePartsZ,
3532
+ issueIndexes: GetIssueIndexesZ
3533
+ });
3534
+ var IssueBucketZ = z9.enum(["fixable", "irrelevant", "remaining"]);
3535
+ var mapCategoryToBucket = {
3536
+ FalsePositive: "irrelevant",
3537
+ Irrelevant: "irrelevant",
3538
+ NoFix: "remaining",
3539
+ Unsupported: "remaining",
3540
+ Fixable: "fixable",
3541
+ Filtered: "remaining"
3542
+ };
3543
+
3544
+ // src/features/analysis/scm/shared/src/types/types.ts
3545
+ import { z as z11 } from "zod";
3546
+
3547
+ // src/features/analysis/scm/shared/src/validations.ts
3548
+ import { z as z10 } from "zod";
3549
+ var IssueTypeSettingZ = z10.object({
3550
+ autoPrEnabled: z10.boolean(),
3551
+ enabled: z10.boolean(),
3552
+ issueType: z10.nativeEnum(IssueType_Enum)
3553
+ });
3554
+ var IssueTypeSettingsZ = z10.array(IssueTypeSettingZ).transform((issueTypeSettings) => {
3555
+ return Object.values(IssueType_Enum).map((issueTypeEnum) => {
3556
+ const existingIssueTypeSetting = issueTypeSettings.find(
3557
+ ({ issueType: dbIssueType }) => dbIssueType === issueTypeEnum
3558
+ );
3559
+ if (existingIssueTypeSetting) {
3560
+ return existingIssueTypeSetting;
3968
3561
  }
3969
3562
  return {
3970
- ...question,
3971
- guidance: questionGuidance
3563
+ autoPrEnabled: false,
3564
+ enabled: true,
3565
+ issueType: issueTypeEnum
3972
3566
  };
3973
- }).filter(({ guidance }) => !!guidance).map(({ guidance, key }) => ({ guidance, key })).concat(fixGuidances);
3974
- }
3567
+ }).sort((a, b) => {
3568
+ return getIssueTypeFriendlyString(a.issueType).localeCompare(
3569
+ getIssueTypeFriendlyString(b.issueType)
3570
+ );
3571
+ });
3572
+ });
3573
+
3574
+ // src/features/analysis/scm/shared/src/types/types.ts
3575
+ var OrganizationScreenQueryParamsZ = z11.object({
3576
+ organizationId: z11.string().uuid()
3577
+ });
3578
+ var ProjectPageQueryParamsZ = z11.object({
3579
+ organizationId: z11.string().uuid(),
3580
+ projectId: z11.string().uuid()
3581
+ });
3582
+ var AnalysisPageQueryParamsZ = ProjectPageQueryParamsZ.extend({
3583
+ reportId: z11.string().uuid()
3584
+ });
3585
+ var FixPageQueryParamsZ = AnalysisPageQueryParamsZ.extend({
3586
+ fixId: z11.string().uuid()
3587
+ });
3588
+ var IssuePageQueryParamsZ = AnalysisPageQueryParamsZ.extend({
3589
+ issueId: z11.string().uuid()
3590
+ });
3591
+ var CliLoginPageQueryParamsZ = z11.object({
3592
+ loginId: z11.string().uuid()
3593
+ });
3594
+ var AnalysisReportDigestedZ = z11.object({
3595
+ id: z11.string().uuid(),
3596
+ state: z11.nativeEnum(Fix_Report_State_Enum),
3597
+ vulnerabilityReport: z11.object({
3598
+ reportSummaryUrl: z11.string().url().nullish(),
3599
+ scanDate: z11.string().nullable(),
3600
+ supported: z11.object({
3601
+ aggregate: z11.object({
3602
+ count: z11.number()
3603
+ })
3604
+ }),
3605
+ all: z11.object({
3606
+ aggregate: z11.object({
3607
+ count: z11.number()
3608
+ })
3609
+ }),
3610
+ vendor: z11.nativeEnum(Vulnerability_Report_Vendor_Enum),
3611
+ project: z11.object({
3612
+ organizationId: z11.string().uuid()
3613
+ })
3614
+ })
3615
+ });
3616
+ var ReportQueryResultZ = z11.object({
3617
+ fixReport_by_pk: z11.object({
3618
+ id: z11.string().uuid(),
3619
+ analysisUrl: z11.string(),
3620
+ fixesCommitted: z11.object({
3621
+ aggregate: z11.object({ count: z11.number() })
3622
+ }),
3623
+ fixesDownloaded: z11.object({
3624
+ aggregate: z11.object({ count: z11.number() })
3625
+ }),
3626
+ fixesDoneCount: z11.number(),
3627
+ fixesInprogressCount: z11.number(),
3628
+ fixesReadyCount: z11.object({
3629
+ aggregate: z11.object({ count: z11.number() })
3630
+ }),
3631
+ issueTypes: z11.record(z11.string(), z11.number()).nullable(),
3632
+ issueLanguages: z11.record(z11.string(), z11.number()).nullable(),
3633
+ fixesCountByEffort: z11.record(z11.string(), z11.number()).nullable(),
3634
+ vulnerabilitySeverities: z11.record(z11.string(), z11.number()).nullable(),
3635
+ createdOn: z11.string(),
3636
+ expirationOn: z11.string().nullable(),
3637
+ state: z11.nativeEnum(Fix_Report_State_Enum),
3638
+ fixes: z11.array(
3639
+ z11.object({
3640
+ id: z11.string().uuid(),
3641
+ safeIssueLanguage: z11.string(),
3642
+ safeIssueType: z11.string(),
3643
+ confidence: z11.number(),
3644
+ effortToApplyFix: z11.nativeEnum(Effort_To_Apply_Fix_Enum).nullable(),
3645
+ modifiedBy: z11.string().nullable(),
3646
+ gitBlameLogin: z11.string().nullable(),
3647
+ fixReportId: z11.string().uuid(),
3648
+ filePaths: z11.array(
3649
+ z11.object({
3650
+ fileRepoRelativePath: z11.string()
3651
+ })
3652
+ ),
3653
+ sharedState: FixSharedStateZ,
3654
+ numberOfVulnerabilityIssues: z11.number(),
3655
+ severityText: z11.nativeEnum(Vulnerability_Severity_Enum),
3656
+ vulnerabilityReportIssues: z11.array(
3657
+ z11.object({
3658
+ id: z11.string().uuid(),
3659
+ issueType: z11.string(),
3660
+ issueLanguage: z11.string(),
3661
+ category: z11.string()
3662
+ })
3663
+ )
3664
+ // scmSubmitFixRequests: ScmSubmitFixRequestsZ,
3665
+ })
3666
+ ),
3667
+ repo: z11.object({
3668
+ name: z11.string().nullable(),
3669
+ originalUrl: z11.string(),
3670
+ reference: z11.string(),
3671
+ commitSha: z11.string(),
3672
+ isKnownBranch: z11.boolean().nullish().default(true)
3673
+ }),
3674
+ vulnerabilityReportIssuesFixedCount: z11.object({
3675
+ vulnerabilityReportIssues_aggregate: z11.object({
3676
+ aggregate: z11.object({ count: z11.number() })
3677
+ })
3678
+ }),
3679
+ vulnerabilityReport: z11.object({
3680
+ id: z11.string().uuid(),
3681
+ reportSummaryUrl: z11.string().url().nullish(),
3682
+ vendor: z11.nativeEnum(Vulnerability_Report_Vendor_Enum).nullable(),
3683
+ issuesWithKnownLanguage: z11.number().nullable(),
3684
+ scanDate: z11.string().nullable(),
3685
+ vendorReportId: z11.string().uuid().nullable(),
3686
+ projectId: z11.string().uuid(),
3687
+ project: z11.object({
3688
+ organizationId: z11.string().uuid()
3689
+ }),
3690
+ file: z11.object({
3691
+ id: z11.string().uuid(),
3692
+ path: z11.string()
3693
+ }),
3694
+ pending: z11.object({
3695
+ aggregate: z11.object({
3696
+ count: z11.number()
3697
+ })
3698
+ }),
3699
+ irrelevant: z11.object({
3700
+ aggregate: z11.object({
3701
+ count: z11.number()
3702
+ })
3703
+ }),
3704
+ remaining: z11.object({
3705
+ aggregate: z11.object({
3706
+ count: z11.number()
3707
+ })
3708
+ }),
3709
+ digested: z11.object({
3710
+ aggregate: z11.object({
3711
+ count: z11.number()
3712
+ })
3713
+ }),
3714
+ supported: z11.object({
3715
+ aggregate: z11.object({
3716
+ count: z11.number()
3717
+ })
3718
+ }),
3719
+ all: z11.object({
3720
+ aggregate: z11.object({
3721
+ count: z11.number()
3722
+ })
3723
+ }),
3724
+ fixable: z11.object({
3725
+ aggregate: z11.object({
3726
+ count: z11.number()
3727
+ })
3728
+ }),
3729
+ errors: z11.object({
3730
+ aggregate: z11.object({
3731
+ count: z11.number()
3732
+ })
3733
+ }),
3734
+ vulnerabilityReportIssues: z11.object({
3735
+ id: z11.string().uuid(),
3736
+ extraData: z11.object({
3737
+ missing_files: z11.string().array().nullish(),
3738
+ large_files: z11.string().array().nullish(),
3739
+ error_files: z11.string().array().nullish()
3740
+ })
3741
+ }).array()
3742
+ })
3743
+ })
3744
+ });
3745
+ var ReportFixesQueryFixZ = z11.object({
3746
+ id: z11.string().uuid(),
3747
+ sharedState: FixSharedStateZ,
3748
+ confidence: z11.number(),
3749
+ gitBlameLogin: z11.string().nullable(),
3750
+ effortToApplyFix: z11.nativeEnum(Effort_To_Apply_Fix_Enum).nullable(),
3751
+ safeIssueLanguage: z11.string(),
3752
+ safeIssueType: z11.string(),
3753
+ fixReportId: z11.string().uuid(),
3754
+ filePaths: z11.array(
3755
+ z11.object({
3756
+ fileRepoRelativePath: z11.string()
3757
+ })
3758
+ ),
3759
+ numberOfVulnerabilityIssues: z11.number(),
3760
+ severityText: z11.nativeEnum(Vulnerability_Severity_Enum),
3761
+ vulnerabilityReportIssues: z11.array(
3762
+ z11.object({
3763
+ issueType: z11.string(),
3764
+ issueLanguage: z11.string()
3765
+ })
3766
+ ).min(1)
3767
+ });
3768
+ var VulnerabilityReportIssueZ = z11.object({
3769
+ id: z11.string().uuid(),
3770
+ createdAt: z11.string(),
3771
+ state: z11.nativeEnum(Vulnerability_Report_Issue_State_Enum),
3772
+ safeIssueType: z11.string(),
3773
+ safeIssueLanguage: z11.string(),
3774
+ extraData: z11.object({
3775
+ missing_files: z11.string().array().nullish(),
3776
+ large_files: z11.string().array().nullish(),
3777
+ error_files: z11.string().array().nullish()
3778
+ }),
3779
+ fix: ReportFixesQueryFixZ.nullable(),
3780
+ falsePositive: z11.object({
3781
+ id: z11.string().uuid()
3782
+ }).nullable(),
3783
+ parsedSeverity: ParsedSeverityZ,
3784
+ severity: z11.string(),
3785
+ severityValue: z11.number(),
3786
+ category: z11.string(),
3787
+ codeNodes: z11.array(z11.object({ path: z11.string() })),
3788
+ vulnerabilityReportIssueTags: z11.array(
3789
+ z11.object({
3790
+ vulnerability_report_issue_tag_value: z11.string()
3791
+ })
3792
+ ),
3793
+ sharedState: VulnerabilityReportIssueSharedStateZ
3794
+ });
3795
+ var GetReportIssuesQueryZ = z11.object({
3796
+ fixReport: z11.object({
3797
+ vulnerabilityReport: z11.object({
3798
+ id: z11.string().uuid(),
3799
+ lastIssueUpdatedAt: z11.string(),
3800
+ vulnerabilityReportIssues_aggregate: z11.object({
3801
+ aggregate: z11.object({ count: z11.number() })
3802
+ }),
3803
+ vulnerabilityReportIssues: z11.array(VulnerabilityReportIssueZ)
3804
+ })
3805
+ }).array()
3806
+ }).nullish();
3807
+ var FixReportByProjectZ = z11.object({
3808
+ project_by_pk: z11.object({
3809
+ vulnerabilityReports: z11.array(
3810
+ z11.object({
3811
+ fixReport: z11.object({ id: z11.string().uuid() }).nullable()
3812
+ })
3813
+ )
3814
+ })
3815
+ });
3816
+ var FixScreenQueryResultZ = z11.object({
3817
+ fixReport_by_pk: FixPageFixReportZ,
3818
+ fix_by_pk: FixPartsForFixScreenZ,
3819
+ fixesWithSameIssueType: z11.array(
3820
+ z11.object({
3821
+ id: z11.string().uuid(),
3822
+ sharedState: z11.object({ state: z11.nativeEnum(Fix_State_Enum) }).nullable().default({ state: "Ready" /* Ready */ })
3823
+ })
3824
+ ),
3825
+ relevantIssue: IssuePartsZ.nullish()
3826
+ });
3827
+ var FixPageQueryZ = z11.object({
3828
+ data: FixScreenQueryResultZ
3829
+ });
3830
+ var GetReportFixesQueryZ = z11.object({
3831
+ fixReport: z11.array(
3832
+ z11.object({
3833
+ fixes: z11.array(ReportFixesQueryFixZ),
3834
+ vulnerabilityReportIssuesTotalCount: z11.object({
3835
+ vulnerabilityReportIssues_aggregate: z11.object({
3836
+ aggregate: z11.object({ count: z11.number() })
3837
+ })
3838
+ }),
3839
+ vulnerabilityReportIssuesFixedCount: z11.object({
3840
+ vulnerabilityReportIssues_aggregate: z11.object({
3841
+ aggregate: z11.object({ count: z11.number() })
3842
+ })
3843
+ }),
3844
+ vulnerabilityReportIssuesIrrelevantCount: z11.object({
3845
+ vulnerabilityReportIssues_aggregate: z11.object({
3846
+ aggregate: z11.object({ count: z11.number() })
3847
+ })
3848
+ }),
3849
+ vulnerabilityReportIssuesRemainingCount: z11.object({
3850
+ vulnerabilityReportIssues_aggregate: z11.object({
3851
+ aggregate: z11.object({ count: z11.number() })
3852
+ })
3853
+ })
3854
+ })
3855
+ )
3856
+ }).nullish();
3857
+ var ProjectVulnerabilityReport = z11.object({
3858
+ id: z11.string().uuid(),
3859
+ name: z11.string().nullable(),
3860
+ vendor: z11.nativeEnum(Vulnerability_Report_Vendor_Enum).nullable(),
3861
+ fixReport: z11.object({
3862
+ id: z11.string().uuid(),
3863
+ createdOn: z11.string(),
3864
+ vulnerabilityReportIssuesFixedCount: z11.object({
3865
+ vulnerabilityReportIssues_aggregate: z11.object({
3866
+ aggregate: z11.object({ count: z11.number() })
3867
+ })
3868
+ }),
3869
+ issueTypes: z11.record(z11.string(), z11.number()).nullable(),
3870
+ issueLanguages: z11.record(z11.nativeEnum(IssueLanguage_Enum), z11.number()).nullable(),
3871
+ fixesCountByEffort: z11.record(z11.nativeEnum(Effort_To_Apply_Fix_Enum), z11.number()).nullable(),
3872
+ vulnerabilitySeverities: z11.record(z11.nativeEnum(Vulnerability_Severity_Enum), z11.number()).nullable(),
3873
+ fixesDoneCount: z11.number(),
3874
+ fixesInprogressCount: z11.number(),
3875
+ fixesReadyCount: z11.number(),
3876
+ repo: z11.object({
3877
+ originalUrl: z11.string(),
3878
+ reference: z11.string(),
3879
+ name: z11.string()
3880
+ }),
3881
+ createdByUser: z11.object({
3882
+ email: z11.string()
3883
+ }).nullable(),
3884
+ state: z11.nativeEnum(Fix_Report_State_Enum),
3885
+ expirationOn: z11.string()
3886
+ })
3887
+ });
3888
+ var ProjectGetProjectZ = z11.object({
3889
+ id: z11.string().uuid(),
3890
+ name: z11.string(),
3891
+ vulnerabilityReports: z11.object({
3892
+ vendor: z11.nativeEnum(Vulnerability_Report_Vendor_Enum).nullable(),
3893
+ fixReport: z11.object({
3894
+ issueLanguages: z11.record(z11.nativeEnum(IssueLanguage_Enum), z11.number()).nullable(),
3895
+ state: z11.nativeEnum(Fix_Report_State_Enum),
3896
+ repo: z11.object({
3897
+ originalUrl: z11.string(),
3898
+ reference: z11.string()
3899
+ }),
3900
+ expirationOn: z11.string()
3901
+ })
3902
+ }).array()
3903
+ });
3904
+ var GetProjectsQueryZ = z11.array(ProjectGetProjectZ);
3905
+ var ProjectPageQueryResultZ = z11.object({
3906
+ name: z11.string(),
3907
+ id: z11.string().uuid(),
3908
+ isDefault: z11.boolean().default(false),
3909
+ organizationId: z11.string().uuid(),
3910
+ vulnerabilityReports: z11.array(ProjectVulnerabilityReport),
3911
+ projectIssueTypeSettings: z11.array(
3912
+ IssueTypeSettingZ.merge(z11.object({ id: z11.string() }))
3913
+ )
3914
+ });
3915
+ var GetProjectMembersDataZ = z11.object({
3916
+ project_by_pk: z11.object({
3917
+ name: z11.string(),
3918
+ id: z11.string(),
3919
+ projectUsers: z11.array(
3920
+ z11.object({
3921
+ projectToRole: z11.object({
3922
+ projectRole: z11.object({
3923
+ type: z11.nativeEnum(Project_Role_Type_Enum)
3924
+ })
3925
+ }),
3926
+ user: z11.object({
3927
+ id: z11.string().uuid(),
3928
+ picture: z11.string().optional(),
3929
+ name: z11.string().nullish(),
3930
+ email: z11.string().email()
3931
+ })
3932
+ })
3933
+ )
3934
+ })
3935
+ });
3936
+ var RepoArgsZ = z11.object({
3937
+ originalUrl: z11.string().url(),
3938
+ branch: z11.string(),
3939
+ commitSha: z11.string()
3940
+ });
3941
+ var scmCloudUrl = {
3942
+ GitLab: "https://gitlab.com",
3943
+ GitHub: "https://github.com",
3944
+ Ado: "https://dev.azure.com",
3945
+ Bitbucket: "https://bitbucket.org"
3946
+ };
3947
+ var ScmType = /* @__PURE__ */ ((ScmType2) => {
3948
+ ScmType2["GitHub"] = "GitHub";
3949
+ ScmType2["GitLab"] = "GitLab";
3950
+ ScmType2["Ado"] = "Ado";
3951
+ ScmType2["Bitbucket"] = "Bitbucket";
3952
+ return ScmType2;
3953
+ })(ScmType || {});
3954
+ var ConvertToSarifInputFileFormat = /* @__PURE__ */ ((ConvertToSarifInputFileFormat2) => {
3955
+ ConvertToSarifInputFileFormat2["FortifyFPR"] = "FortifyFPR";
3956
+ return ConvertToSarifInputFileFormat2;
3957
+ })(ConvertToSarifInputFileFormat || {});
3975
3958
 
3976
3959
  // src/features/analysis/scm/shared/src/urlParser/urlParser.ts
3977
- import { z as z13 } from "zod";
3960
+ import { z as z12 } from "zod";
3978
3961
  var ADO_PREFIX_PATH = "tfs";
3979
3962
  var NAME_REGEX = /[a-z0-9\-_.+]+/i;
3980
3963
  function detectAdoUrl(args) {
@@ -3991,7 +3974,7 @@ function detectAdoUrl(args) {
3991
3974
  scmType: "Ado" /* Ado */,
3992
3975
  organization,
3993
3976
  // project has single repo - repoName === projectName
3994
- projectName: z13.string().parse(projectName),
3977
+ projectName: z12.string().parse(projectName),
3995
3978
  repoName: projectName,
3996
3979
  prefixPath
3997
3980
  };
@@ -4002,7 +3985,7 @@ function detectAdoUrl(args) {
4002
3985
  return {
4003
3986
  scmType: "Ado" /* Ado */,
4004
3987
  organization,
4005
- projectName: z13.string().parse(projectName),
3988
+ projectName: z12.string().parse(projectName),
4006
3989
  repoName,
4007
3990
  prefixPath
4008
3991
  };
@@ -4016,7 +3999,7 @@ function detectAdoUrl(args) {
4016
3999
  scmType: "Ado" /* Ado */,
4017
4000
  organization,
4018
4001
  // project has only one repo - repoName === projectName
4019
- projectName: z13.string().parse(repoName),
4002
+ projectName: z12.string().parse(repoName),
4020
4003
  repoName,
4021
4004
  prefixPath
4022
4005
  };
@@ -4026,7 +4009,7 @@ function detectAdoUrl(args) {
4026
4009
  return {
4027
4010
  scmType: "Ado" /* Ado */,
4028
4011
  organization,
4029
- projectName: z13.string().parse(projectName),
4012
+ projectName: z12.string().parse(projectName),
4030
4013
  repoName,
4031
4014
  prefixPath
4032
4015
  };
@@ -4152,11 +4135,8 @@ function getIssueUrl({
4152
4135
  return `${appBaseUrl}/organization/${organizationId}/project/${projectId}/report/${analysisId}/issue/${issueId}`;
4153
4136
  }
4154
4137
 
4155
- // src/features/analysis/scm/utils/index.ts
4156
- import { z as z15 } from "zod";
4157
-
4158
4138
  // src/features/analysis/scm/types.ts
4159
- import { z as z14 } from "zod";
4139
+ import { z as z13 } from "zod";
4160
4140
  var ReferenceType = /* @__PURE__ */ ((ReferenceType2) => {
4161
4141
  ReferenceType2["BRANCH"] = "BRANCH";
4162
4142
  ReferenceType2["COMMIT"] = "COMMIT";
@@ -4188,12 +4168,19 @@ var scmTypeToScmLibScmType = {
4188
4168
  ["Ado" /* Ado */]: "ADO" /* ADO */,
4189
4169
  ["Bitbucket" /* Bitbucket */]: "BITBUCKET" /* BITBUCKET */
4190
4170
  };
4191
- var GetRefererenceResultZ = z14.object({
4192
- date: z14.date().optional(),
4193
- sha: z14.string(),
4194
- type: z14.nativeEnum(ReferenceType)
4171
+ var GetRefererenceResultZ = z13.object({
4172
+ date: z13.date().optional(),
4173
+ sha: z13.string(),
4174
+ type: z13.nativeEnum(ReferenceType)
4195
4175
  });
4196
4176
 
4177
+ // src/features/analysis/scm/utils/scm.ts
4178
+ var safeBody = (body, maxBodyLength) => {
4179
+ const truncationNotice = "\n\n... Message was cut here because it is too long";
4180
+ const maxBodyContentLength = maxBodyLength - truncationNotice.length;
4181
+ return body.length > maxBodyLength ? body.slice(0, maxBodyContentLength) + truncationNotice : body;
4182
+ };
4183
+
4197
4184
  // src/features/analysis/scm/utils/index.ts
4198
4185
  function getFixUrlWithRedirect(params) {
4199
4186
  const {
@@ -4305,7 +4292,7 @@ function shouldValidateUrl(repoUrl) {
4305
4292
  return repoUrl && isUrlHasPath(repoUrl);
4306
4293
  }
4307
4294
  function isBrokerUrl(url) {
4308
- return z15.string().uuid().safeParse(new URL(url).host).success;
4295
+ return z14.string().uuid().safeParse(new URL(url).host).success;
4309
4296
  }
4310
4297
  function buildAuthorizedRepoUrl(args) {
4311
4298
  const { url, username, password } = args;
@@ -4341,7 +4328,7 @@ function getCloudScmLibTypeFromUrl(url) {
4341
4328
  return void 0;
4342
4329
  }
4343
4330
  function getScmLibTypeFromScmType(scmType) {
4344
- const parsedScmType = z15.nativeEnum(ScmType).parse(scmType);
4331
+ const parsedScmType = z14.nativeEnum(ScmType).parse(scmType);
4345
4332
  return scmTypeToScmLibScmType[parsedScmType];
4346
4333
  }
4347
4334
  function getScmConfig({
@@ -4407,6 +4394,24 @@ function getScmConfig({
4407
4394
  };
4408
4395
  }
4409
4396
 
4397
+ // src/features/analysis/scm/ado/constants.ts
4398
+ var DEFUALT_ADO_ORIGIN = scmCloudUrl.Ado;
4399
+
4400
+ // src/features/analysis/scm/ado/utils.ts
4401
+ import querystring from "querystring";
4402
+ import * as api from "azure-devops-node-api";
4403
+ import Debug from "debug";
4404
+ import { z as z17 } from "zod";
4405
+
4406
+ // src/features/analysis/scm/env.ts
4407
+ import { z as z15 } from "zod";
4408
+ var EnvVariablesZod = z15.object({
4409
+ GITLAB_API_TOKEN: z15.string().optional(),
4410
+ GITHUB_API_TOKEN: z15.string().optional(),
4411
+ GIT_PROXY_HOST: z15.string().optional().default("http://tinyproxy:8888")
4412
+ });
4413
+ var { GITLAB_API_TOKEN, GITHUB_API_TOKEN, GIT_PROXY_HOST } = EnvVariablesZod.parse(process.env);
4414
+
4410
4415
  // src/features/analysis/scm/ado/validation.ts
4411
4416
  import { z as z16 } from "zod";
4412
4417
  var ValidPullRequestStatusZ = z16.union([
@@ -4690,6 +4695,7 @@ async function validateAdoRepo({
4690
4695
  }
4691
4696
 
4692
4697
  // src/features/analysis/scm/ado/ado.ts
4698
+ var MAX_ADO_PR_BODY_LENGTH = 15e4;
4693
4699
  async function getAdoSdk(params) {
4694
4700
  const api2 = await getAdoApiClient(params);
4695
4701
  return {
@@ -4840,7 +4846,7 @@ async function getAdoSdk(params) {
4840
4846
  sourceRefName: `refs/heads/${sourceBranchName}`,
4841
4847
  targetRefName: `refs/heads/${targetBranchName}`,
4842
4848
  title,
4843
- description: body
4849
+ description: safeBody(body, MAX_ADO_PR_BODY_LENGTH)
4844
4850
  },
4845
4851
  repo,
4846
4852
  projectName
@@ -5915,6 +5921,7 @@ var TokenExpiredErrorZ = z19.object({
5915
5921
  })
5916
5922
  });
5917
5923
  var BITBUCKET_ACCESS_TOKEN_URL = `https://${BITBUCKET_HOSTNAME}/site/oauth2/access_token`;
5924
+ var MAX_BITBUCKET_PR_BODY_LENGTH = 32768;
5918
5925
  var BitbucketParseResultZ = z19.object({
5919
5926
  organization: z19.string(),
5920
5927
  repoName: z19.string(),
@@ -6003,7 +6010,7 @@ function getBitbucketSdk(params) {
6003
6010
  type: "pullrequest",
6004
6011
  title: params2.title,
6005
6012
  summary: {
6006
- raw: params2.body
6013
+ raw: safeBody(params2.body, MAX_BITBUCKET_PR_BODY_LENGTH)
6007
6014
  },
6008
6015
  source: {
6009
6016
  branch: {
@@ -6623,6 +6630,7 @@ async function githubValidateParams(url, accessToken) {
6623
6630
  }
6624
6631
 
6625
6632
  // src/features/analysis/scm/github/github.ts
6633
+ var MAX_GH_PR_BODY_LENGTH = 65536;
6626
6634
  function getGithubSdk(params = {}) {
6627
6635
  const octokit = getOctoKit(params);
6628
6636
  return {
@@ -6948,7 +6956,7 @@ function getGithubSdk(params = {}) {
6948
6956
  title,
6949
6957
  head: newBranchName,
6950
6958
  head_repo: sourceRepo,
6951
- body,
6959
+ body: safeBody(body, MAX_GH_PR_BODY_LENGTH),
6952
6960
  base: defaultBranch
6953
6961
  });
6954
6962
  return {
@@ -6970,7 +6978,7 @@ function getGithubSdk(params = {}) {
6970
6978
  owner,
6971
6979
  repo,
6972
6980
  title: options.title,
6973
- body: options.body,
6981
+ body: safeBody(options.body, MAX_GH_PR_BODY_LENGTH),
6974
6982
  head: options.sourceBranchName,
6975
6983
  base: options.targetBranchName,
6976
6984
  draft: false,
@@ -7278,6 +7286,7 @@ var debug3 = Debug3("scm:gitlab");
7278
7286
  function removeTrailingSlash2(str) {
7279
7287
  return str.trim().replace(/\/+$/, "");
7280
7288
  }
7289
+ var MAX_GITLAB_PR_BODY_LENGTH = 1048576;
7281
7290
  function getRandomGitlabCloudAnonToken() {
7282
7291
  if (!GITLAB_API_TOKEN || typeof GITLAB_API_TOKEN !== "string") {
7283
7292
  return void 0;
@@ -7475,7 +7484,7 @@ async function createMergeRequest(options) {
7475
7484
  options.targetBranchName,
7476
7485
  options.title,
7477
7486
  {
7478
- description: options.body
7487
+ description: safeBody(options.body, MAX_GITLAB_PR_BODY_LENGTH)
7479
7488
  }
7480
7489
  );
7481
7490
  return res.iid;