mobbdev 1.0.99 → 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 +1006 -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
@@ -375,6 +378,7 @@ var IssueType_Enum = /* @__PURE__ */ ((IssueType_Enum2) => {
375
378
  IssueType_Enum2["DeprecatedFunction"] = "DEPRECATED_FUNCTION";
376
379
  IssueType_Enum2["DosStringBuilder"] = "DOS_STRING_BUILDER";
377
380
  IssueType_Enum2["DoNotRaiseException"] = "DO_NOT_RAISE_EXCEPTION";
381
+ IssueType_Enum2["DoNotThrowGenericException"] = "DO_NOT_THROW_GENERIC_EXCEPTION";
378
382
  IssueType_Enum2["DuplicatedStrings"] = "DUPLICATED_STRINGS";
379
383
  IssueType_Enum2["ErroneousStringCompare"] = "ERRONEOUS_STRING_COMPARE";
380
384
  IssueType_Enum2["ErrorCondtionWithoutAction"] = "ERROR_CONDTION_WITHOUT_ACTION";
@@ -1129,933 +1133,6 @@ function getSdk(client, withWrapper = defaultWrapper) {
1129
1133
  };
1130
1134
  }
1131
1135
 
1132
- // src/features/analysis/scm/shared/src/types/shared.ts
1133
- import { z } from "zod";
1134
- var ParsedSeverityZ = z.nativeEnum(Vulnerability_Severity_Enum).nullish().transform((i) => i ?? "low" /* Low */);
1135
- var ScmSubmitFixRequestsZ = z.array(
1136
- z.object({
1137
- scmSubmitFixRequest: z.object({
1138
- submitFixRequest: z.object({
1139
- createdByUser: z.object({
1140
- email: z.string()
1141
- }),
1142
- targetBranchName: z.string().default("")
1143
- }),
1144
- prUrl: z.string().nullable(),
1145
- prStatus: z.nativeEnum(Pr_Status_Enum).nullable(),
1146
- commitUrl: z.string().nullable(),
1147
- scmId: z.string()
1148
- })
1149
- })
1150
- );
1151
-
1152
- // src/features/analysis/scm/shared/src/types/fix.ts
1153
- var PackageInfoZ = z2.object({
1154
- name: z2.string(),
1155
- version: z2.string(),
1156
- envName: z2.string().nullable()
1157
- });
1158
- var ManifestActionRequiredZ = z2.object({
1159
- action: z2.nativeEnum(ManifestAction),
1160
- language: z2.nativeEnum(Language),
1161
- lib: PackageInfoZ,
1162
- typesLib: PackageInfoZ.nullable()
1163
- });
1164
- var ExtraContextInternalZ = z2.object({
1165
- key: z2.string(),
1166
- value: z2.string().or(z2.boolean()).or(
1167
- z2.object({
1168
- int: z2.boolean(),
1169
- integer: z2.boolean(),
1170
- string: z2.boolean(),
1171
- date: z2.boolean()
1172
- })
1173
- )
1174
- });
1175
- var FixExtraContextZ = z2.object({
1176
- fixDescription: z2.string(),
1177
- manifestActionsRequired: z2.array(ManifestActionRequiredZ),
1178
- extraContext: z2.array(ExtraContextInternalZ)
1179
- });
1180
- var PatchAndQuestionsZ = z2.object({
1181
- __typename: z2.literal("FixData"),
1182
- patch: z2.string(),
1183
- patchOriginalEncodingBase64: z2.string(),
1184
- questions: z2.array(
1185
- z2.object({
1186
- name: z2.string(),
1187
- key: z2.string(),
1188
- index: z2.number(),
1189
- defaultValue: z2.string(),
1190
- value: z2.string().nullable(),
1191
- extraContext: z2.array(ExtraContextInternalZ),
1192
- inputType: z2.nativeEnum(FixQuestionInputType),
1193
- options: z2.array(z2.string())
1194
- })
1195
- ),
1196
- extraContext: FixExtraContextZ
1197
- });
1198
- var FixRatingZ = z2.object({
1199
- voteScore: z2.number(),
1200
- fixRatingTag: z2.nativeEnum(Fix_Rating_Tag_Enum).nullable().default(null),
1201
- comment: z2.string().nullable().default(null),
1202
- updatedDate: z2.string().nullable(),
1203
- user: z2.object({
1204
- email: z2.string(),
1205
- name: z2.string()
1206
- })
1207
- });
1208
- var FixSharedStateZ = z2.object({
1209
- state: z2.nativeEnum(Fix_State_Enum),
1210
- isArchived: z2.boolean(),
1211
- scmSubmitFixRequests: ScmSubmitFixRequestsZ,
1212
- fixRatings: z2.array(FixRatingZ).default([])
1213
- }).nullish().transform(
1214
- (data) => data ? data : {
1215
- state: "Ready" /* Ready */,
1216
- isArchived: false,
1217
- scmSubmitFixRequests: [],
1218
- fixRatings: []
1219
- }
1220
- );
1221
- var FixQueryZ = z2.object({
1222
- __typename: z2.literal("fix").optional(),
1223
- id: z2.string().uuid(),
1224
- sharedState: FixSharedStateZ,
1225
- modifiedBy: z2.string().nullable(),
1226
- gitBlameLogin: z2.string().nullable(),
1227
- safeIssueLanguage: z2.string(),
1228
- safeIssueType: z2.string(),
1229
- confidence: z2.number(),
1230
- fixReportId: z2.string().uuid(),
1231
- isExpired: z2.boolean().default(false),
1232
- fixFiles: z2.array(
1233
- z2.object({
1234
- fileRepoRelativePath: z2.string()
1235
- })
1236
- ),
1237
- numberOfVulnerabilityIssues: z2.number(),
1238
- severityText: z2.nativeEnum(Vulnerability_Severity_Enum),
1239
- vulnerabilityReportIssues: z2.array(
1240
- z2.object({
1241
- vendorIssueId: z2.string(),
1242
- issueLanguage: z2.string(),
1243
- parsedSeverity: ParsedSeverityZ
1244
- })
1245
- ),
1246
- patchAndQuestions: PatchAndQuestionsZ,
1247
- effortToApplyFix: z2.nativeEnum(Effort_To_Apply_Fix_Enum).nullable()
1248
- });
1249
- var FixPartsForFixScreenZ = FixQueryZ.merge(
1250
- z2.object({
1251
- vulnerabilityReportIssues: z2.array(
1252
- z2.object({
1253
- vendorIssueId: z2.string(),
1254
- issueType: z2.string(),
1255
- issueLanguage: z2.string()
1256
- })
1257
- )
1258
- })
1259
- );
1260
-
1261
- // src/features/analysis/scm/shared/src/types/issue.ts
1262
- import { z as z4 } from "zod";
1263
-
1264
- // src/features/analysis/scm/shared/src/types/analysis.ts
1265
- import { z as z3 } from "zod";
1266
- var FixPageFixReportZ = z3.object({
1267
- id: z3.string().uuid(),
1268
- analysisUrl: z3.string(),
1269
- expirationOn: z3.string(),
1270
- createdOn: z3.string(),
1271
- state: z3.nativeEnum(Fix_Report_State_Enum),
1272
- repo: z3.object({
1273
- name: z3.string().nullable(),
1274
- originalUrl: z3.string(),
1275
- reference: z3.string(),
1276
- commitSha: z3.string(),
1277
- isKnownBranch: z3.boolean().nullable()
1278
- }),
1279
- vulnerabilityReport: z3.object({
1280
- vendor: z3.nativeEnum(Vulnerability_Report_Vendor_Enum),
1281
- vendorReportId: z3.string().uuid().nullable(),
1282
- projectId: z3.string().uuid(),
1283
- project: z3.object({
1284
- organizationId: z3.string().uuid()
1285
- }),
1286
- file: z3.object({
1287
- id: z3.string().uuid(),
1288
- path: z3.string()
1289
- }),
1290
- pending: z3.object({
1291
- aggregate: z3.object({
1292
- count: z3.number()
1293
- })
1294
- }),
1295
- supported: z3.object({
1296
- aggregate: z3.object({
1297
- count: z3.number()
1298
- })
1299
- }),
1300
- all: z3.object({
1301
- aggregate: z3.object({
1302
- count: z3.number()
1303
- })
1304
- }),
1305
- fixable: z3.object({
1306
- aggregate: z3.object({
1307
- count: z3.number()
1308
- })
1309
- }),
1310
- errors: z3.object({
1311
- aggregate: z3.object({
1312
- count: z3.number()
1313
- })
1314
- }),
1315
- vulnerabilityReportIssues: z3.object({
1316
- extraData: z3.object({
1317
- missing_files: z3.string().array().nullish(),
1318
- large_files: z3.string().array().nullish(),
1319
- error_files: z3.string().array().nullish()
1320
- })
1321
- }).array()
1322
- })
1323
- });
1324
-
1325
- // src/features/analysis/scm/shared/src/types/issue.ts
1326
- var MAX_SOURCE_CODE_FILE_SIZE_IN_BYTES = 1e5;
1327
- var CATEGORY = {
1328
- NoFix: "NoFix",
1329
- Unsupported: "Unsupported",
1330
- Irrelevant: "Irrelevant",
1331
- FalsePositive: "FalsePositive",
1332
- Fixable: "Fixable",
1333
- Filtered: "Filtered"
1334
- };
1335
- var ValidCategoriesZ = z4.union([
1336
- z4.literal(CATEGORY.NoFix),
1337
- z4.literal(CATEGORY.Unsupported),
1338
- z4.literal(CATEGORY.Irrelevant),
1339
- z4.literal(CATEGORY.FalsePositive),
1340
- z4.literal(CATEGORY.Fixable),
1341
- z4.literal(CATEGORY.Filtered)
1342
- ]);
1343
- var VulnerabilityReportIssueSharedStateZ = z4.object({
1344
- id: z4.string().uuid(),
1345
- isArchived: z4.boolean()
1346
- }).nullish();
1347
- var BaseIssuePartsZ = z4.object({
1348
- id: z4.string().uuid(),
1349
- safeIssueType: z4.string(),
1350
- safeIssueLanguage: z4.string(),
1351
- createdAt: z4.string(),
1352
- parsedSeverity: ParsedSeverityZ,
1353
- category: ValidCategoriesZ,
1354
- extraData: z4.object({
1355
- missing_files: z4.string().array().nullish(),
1356
- error_files: z4.string().array().nullish()
1357
- }),
1358
- vulnerabilityReportIssueTags: z4.array(
1359
- z4.object({
1360
- tag: z4.nativeEnum(Vulnerability_Report_Issue_Tag_Enum)
1361
- })
1362
- ),
1363
- codeNodes: z4.array(
1364
- z4.object({
1365
- path: z4.string(),
1366
- line: z4.number(),
1367
- index: z4.number()
1368
- })
1369
- ).transform((nodes) => nodes.sort((a, b) => b.index - a.index)),
1370
- sourceCodeNodes: z4.array(
1371
- z4.object({
1372
- sourceCodeFile: z4.object({
1373
- path: z4.string(),
1374
- signedFile: z4.object({
1375
- url: z4.string()
1376
- })
1377
- })
1378
- }).transform(async ({ sourceCodeFile }) => {
1379
- const { url } = sourceCodeFile.signedFile;
1380
- const sourceCodeRes = await fetch(url);
1381
- if (Number(sourceCodeRes.headers.get("Content-Length")) > MAX_SOURCE_CODE_FILE_SIZE_IN_BYTES) {
1382
- return null;
1383
- }
1384
- return {
1385
- path: sourceCodeFile.path,
1386
- fileContent: await sourceCodeRes.text()
1387
- };
1388
- })
1389
- ).transform((nodes) => nodes.filter((node) => node !== null)),
1390
- fix: FixPartsForFixScreenZ.nullish(),
1391
- vulnerabilityReportIssueNodeDiffFile: z4.object({
1392
- signedFile: z4.object({
1393
- url: z4.string()
1394
- }).transform(async ({ url }) => {
1395
- const codeDiff = await fetch(url).then((res) => res.text());
1396
- return { codeDiff };
1397
- })
1398
- }).nullish(),
1399
- sharedState: VulnerabilityReportIssueSharedStateZ
1400
- });
1401
- var FalsePositivePartsZ = z4.object({
1402
- extraContext: z4.array(z4.object({ key: z4.string(), value: z4.string() })),
1403
- fixDescription: z4.string()
1404
- });
1405
- var IssuePartsWithFixZ = BaseIssuePartsZ.merge(
1406
- z4.object({
1407
- category: z4.literal(CATEGORY.Irrelevant),
1408
- fix: FixPartsForFixScreenZ.nullish()
1409
- })
1410
- );
1411
- var IssuePartsFpZ = BaseIssuePartsZ.merge(
1412
- z4.object({
1413
- category: z4.literal(CATEGORY.FalsePositive),
1414
- fpId: z4.string().uuid(),
1415
- getFalsePositive: FalsePositivePartsZ
1416
- })
1417
- );
1418
- var GeneralIssueZ = BaseIssuePartsZ.merge(
1419
- z4.object({
1420
- category: z4.union([
1421
- z4.literal(CATEGORY.NoFix),
1422
- z4.literal(CATEGORY.Unsupported),
1423
- z4.literal(CATEGORY.Fixable),
1424
- z4.literal(CATEGORY.Filtered)
1425
- ])
1426
- })
1427
- );
1428
- var IssuePartsZ = z4.union([
1429
- IssuePartsFpZ,
1430
- IssuePartsWithFixZ,
1431
- GeneralIssueZ
1432
- ]);
1433
- var GetIssueIndexesZ = z4.object({
1434
- currentIndex: z4.number(),
1435
- totalIssues: z4.number(),
1436
- nextIssue: z4.object({
1437
- id: z4.string().uuid()
1438
- }).nullish(),
1439
- prevIssue: z4.object({
1440
- id: z4.string().uuid()
1441
- }).nullish()
1442
- });
1443
- var GetIssueScreenDataZ = z4.object({
1444
- fixReport_by_pk: FixPageFixReportZ,
1445
- vulnerability_report_issue_by_pk: IssuePartsZ,
1446
- issueIndexes: GetIssueIndexesZ
1447
- });
1448
- var IssueBucketZ = z4.enum(["fixable", "irrelevant", "remaining"]);
1449
- var mapCategoryToBucket = {
1450
- FalsePositive: "irrelevant",
1451
- Irrelevant: "irrelevant",
1452
- NoFix: "remaining",
1453
- Unsupported: "remaining",
1454
- Fixable: "fixable",
1455
- Filtered: "remaining"
1456
- };
1457
-
1458
- // src/features/analysis/scm/shared/src/types/types.ts
1459
- import { z as z7 } from "zod";
1460
-
1461
- // src/features/analysis/scm/shared/src/validations.ts
1462
- import { z as z6 } from "zod";
1463
-
1464
- // src/features/analysis/scm/shared/src/getIssueType.ts
1465
- import { z as z5 } from "zod";
1466
- var issueTypeMap = {
1467
- ["NO_LIMITS_OR_THROTTLING" /* NoLimitsOrThrottling */]: "Missing Rate Limiting",
1468
- ["SQL_Injection" /* SqlInjection */]: "SQL Injection",
1469
- ["CMDi_relative_path_command" /* CmDiRelativePathCommand */]: "Relative Path Command Injection",
1470
- ["CMDi" /* CmDi */]: "Command Injection",
1471
- ["CONFUSING_NAMING" /* ConfusingNaming */]: "Confusing Naming",
1472
- ["XXE" /* Xxe */]: "XXE",
1473
- ["XSS" /* Xss */]: "XSS",
1474
- ["PT" /* Pt */]: "Path Traversal",
1475
- ["ZIP_SLIP" /* ZipSlip */]: "Zip Slip",
1476
- ["INSECURE_RANDOMNESS" /* InsecureRandomness */]: "Insecure Randomness",
1477
- ["SSRF" /* Ssrf */]: "Server Side Request Forgery",
1478
- ["TYPE_CONFUSION" /* TypeConfusion */]: "Type Confusion",
1479
- ["REGEX_INJECTION" /* RegexInjection */]: "Regular Expression Injection",
1480
- ["INCOMPLETE_URL_SANITIZATION" /* IncompleteUrlSanitization */]: "Incomplete URL Sanitization",
1481
- ["LOCALE_DEPENDENT_COMPARISON" /* LocaleDependentComparison */]: "Locale Dependent Comparison",
1482
- ["LOG_FORGING" /* LogForging */]: "Log Forging",
1483
- ["MISSING_CHECK_AGAINST_NULL" /* MissingCheckAgainstNull */]: "Missing Check against Null",
1484
- ["PASSWORD_IN_COMMENT" /* PasswordInComment */]: "Password in Comment",
1485
- ["OVERLY_BROAD_CATCH" /* OverlyBroadCatch */]: "Poor Error Handling: Overly Broad Catch",
1486
- ["USE_OF_SYSTEM_OUTPUT_STREAM" /* UseOfSystemOutputStream */]: "Use of System.out/System.err",
1487
- ["DANGEROUS_FUNCTION_OVERFLOW" /* DangerousFunctionOverflow */]: "Use of dangerous function",
1488
- ["DOS_STRING_BUILDER" /* DosStringBuilder */]: "Denial of Service: StringBuilder",
1489
- ["OPEN_REDIRECT" /* OpenRedirect */]: "Open Redirect",
1490
- ["WEAK_XML_SCHEMA_UNBOUNDED_OCCURRENCES" /* WeakXmlSchemaUnboundedOccurrences */]: "Weak XML Schema: Unbounded Occurrences",
1491
- ["SYSTEM_INFORMATION_LEAK" /* SystemInformationLeak */]: "System Information Leak",
1492
- ["SYSTEM_INFORMATION_LEAK_EXTERNAL" /* SystemInformationLeakExternal */]: "External System Information Leak",
1493
- ["HTTP_RESPONSE_SPLITTING" /* HttpResponseSplitting */]: "HTTP response splitting",
1494
- ["HTTP_ONLY_COOKIE" /* HttpOnlyCookie */]: "Cookie is not HttpOnly",
1495
- ["INSECURE_COOKIE" /* InsecureCookie */]: "Insecure Cookie",
1496
- ["TRUST_BOUNDARY_VIOLATION" /* TrustBoundaryViolation */]: "Trust Boundary Violation",
1497
- ["NULL_DEREFERENCE" /* NullDereference */]: "Null Dereference",
1498
- ["UNSAFE_DESERIALIZATION" /* UnsafeDeserialization */]: "Unsafe deserialization",
1499
- ["INSECURE_BINDER_CONFIGURATION" /* InsecureBinderConfiguration */]: "Insecure Binder Configuration",
1500
- ["UNSAFE_TARGET_BLANK" /* UnsafeTargetBlank */]: "Unsafe use of target blank",
1501
- ["IFRAME_WITHOUT_SANDBOX" /* IframeWithoutSandbox */]: "Client use of iframe without sandbox",
1502
- ["JQUERY_DEPRECATED_SYMBOLS" /* JqueryDeprecatedSymbols */]: "jQuery deprecated symbols",
1503
- ["MISSING_ANTIFORGERY_VALIDATION" /* MissingAntiforgeryValidation */]: "Missing Anti-Forgery Validation",
1504
- ["GRAPHQL_DEPTH_LIMIT" /* GraphqlDepthLimit */]: "GraphQL Depth Limit",
1505
- ["UNCHECKED_LOOP_CONDITION" /* UncheckedLoopCondition */]: "Unchecked Loop Condition",
1506
- ["IMPROPER_RESOURCE_SHUTDOWN_OR_RELEASE" /* ImproperResourceShutdownOrRelease */]: "Improper Resource Shutdown or Release",
1507
- ["IMPROPER_EXCEPTION_HANDLING" /* ImproperExceptionHandling */]: "Improper Exception Handling",
1508
- ["DEFAULT_RIGHTS_IN_OBJ_DEFINITION" /* DefaultRightsInObjDefinition */]: "Default Definer Rights in Package or Object Definition",
1509
- ["HTML_COMMENT_IN_JSP" /* HtmlCommentInJsp */]: "HTML Comment in JSP",
1510
- ["ERROR_CONDTION_WITHOUT_ACTION" /* ErrorCondtionWithoutAction */]: "Error Condition Without Action",
1511
- ["DEPRECATED_FUNCTION" /* DeprecatedFunction */]: "Deprecated Function",
1512
- ["HARDCODED_SECRETS" /* HardcodedSecrets */]: "Hardcoded Secrets",
1513
- ["PROTOTYPE_POLLUTION" /* PrototypePollution */]: "Prototype Pollution",
1514
- ["RACE_CONDITION_FORMAT_FLAW" /* RaceConditionFormatFlaw */]: "Race Condition Format Flaw",
1515
- ["NON_FINAL_PUBLIC_STATIC_FIELD" /* NonFinalPublicStaticField */]: "Non-final Public Static Field",
1516
- ["MISSING_HSTS_HEADER" /* MissingHstsHeader */]: "Missing HSTS Header",
1517
- ["DEAD_CODE_UNUSED_FIELD" /* DeadCodeUnusedField */]: "Dead Code: Unused Field",
1518
- ["HEADER_MANIPULATION" /* HeaderManipulation */]: "Header Manipulation",
1519
- ["MISSING_EQUALS_OR_HASHCODE" /* MissingEqualsOrHashcode */]: "Missing equals or hashcode method",
1520
- ["WCF_MISCONFIGURATION_INSUFFICIENT_LOGGING" /* WcfMisconfigurationInsufficientLogging */]: "WCF Misconfiguration: Insufficient Logging",
1521
- ["WCF_MISCONFIGURATION_THROTTLING_NOT_ENABLED" /* WcfMisconfigurationThrottlingNotEnabled */]: "WCF Misconfiguration: Throttling Not Enabled",
1522
- ["USELESS_REGEXP_CHAR_ESCAPE" /* UselessRegexpCharEscape */]: "Useless regular-expression character escape",
1523
- ["INCOMPLETE_HOSTNAME_REGEX" /* IncompleteHostnameRegex */]: "Incomplete Hostname Regex",
1524
- ["OVERLY_LARGE_RANGE" /* OverlyLargeRange */]: "Regex: Overly Large Range",
1525
- ["INSUFFICIENT_LOGGING" /* InsufficientLogging */]: "Insufficient Logging of Sensitive Operations",
1526
- ["PRIVACY_VIOLATION" /* PrivacyViolation */]: "Privacy Violation",
1527
- ["INCOMPLETE_URL_SCHEME_CHECK" /* IncompleteUrlSchemeCheck */]: "Incomplete URL Scheme Check",
1528
- ["VALUE_NEVER_READ" /* ValueNeverRead */]: "Value Never Read",
1529
- ["VALUE_SHADOWING" /* ValueShadowing */]: "Value Shadowing",
1530
- ["NO_EQUIVALENCE_METHOD" /* NoEquivalenceMethod */]: "Class Does Not Implement Equivalence Method",
1531
- ["INFORMATION_EXPOSURE_VIA_HEADERS" /* InformationExposureViaHeaders */]: "Information Exposure via Headers",
1532
- ["DEBUG_ENABLED" /* DebugEnabled */]: "Debug Enabled",
1533
- ["LEFTOVER_DEBUG_CODE" /* LeftoverDebugCode */]: "Leftover Debug Code",
1534
- ["POOR_ERROR_HANDLING_EMPTY_CATCH_BLOCK" /* PoorErrorHandlingEmptyCatchBlock */]: "Poor Error Handling: Empty Catch Block",
1535
- ["ERRONEOUS_STRING_COMPARE" /* ErroneousStringCompare */]: "Erroneous String Compare",
1536
- ["UNVALIDATED_PUBLIC_METHOD_ARGUMENT" /* UnvalidatedPublicMethodArgument */]: "Unvalidated Public Method Argument",
1537
- ["AUTO_ESCAPE_FALSE" /* AutoEscapeFalse */]: "Auto-escape False",
1538
- ["MISSING_CSP_HEADER" /* MissingCspHeader */]: "Missing CSP Header",
1539
- ["HARDCODED_DOMAIN_IN_HTML" /* HardcodedDomainInHtml */]: "Hardcoded Domain in HTML",
1540
- ["HEAP_INSPECTION" /* HeapInspection */]: "Heap Inspection",
1541
- ["CLIENT_DOM_STORED_CODE_INJECTION" /* ClientDomStoredCodeInjection */]: "Client Code Injection",
1542
- ["STRING_FORMAT_MISUSE" /* StringFormatMisuse */]: "String Format Misuse",
1543
- ["NON_READONLY_FIELD" /* NonReadonlyField */]: "Non Readonly Field",
1544
- ["CSRF" /* Csrf */]: "Cross-Site Request Forgery (CSRF)",
1545
- ["WEAK_ENCRYPTION" /* WeakEncryption */]: "Weak Encryption Mechanism",
1546
- ["CODE_IN_COMMENT" /* CodeInComment */]: "Code in Comment",
1547
- ["REGEX_MISSING_TIMEOUT" /* RegexMissingTimeout */]: "Regex Missing Timeout",
1548
- ["FRAMEABLE_LOGIN_PAGE" /* FrameableLoginPage */]: "Frameable Login Page",
1549
- ["USE_OF_HARD_CODED_CRYPTOGRAPHIC_KEY" /* UseOfHardCodedCryptographicKey */]: "Use of Hardcoded Cryptographic Key",
1550
- ["MISSING_SSL_MINVERSION" /* MissingSslMinversion */]: "Missing SSL MinVersion",
1551
- ["WEBSOCKET_MISSING_ORIGIN_CHECK" /* WebsocketMissingOriginCheck */]: "Missing Websocket Origin Check",
1552
- ["DUPLICATED_STRINGS" /* DuplicatedStrings */]: "String Literals Should not Be Duplicated",
1553
- ["INSECURE_UUID_VERSION" /* InsecureUuidVersion */]: "Insecure UUID Version",
1554
- ["GH_ACTIONS_SHELL_INJECTION" /* GhActionsShellInjection */]: "GitHub Actions Shell Injection",
1555
- ["MODIFIED_DEFAULT_PARAM" /* ModifiedDefaultParam */]: "Modified Default Param",
1556
- ["UNSAFE_WEB_THREAD" /* UnsafeWebThread */]: "Unsafe Web Thread",
1557
- ["NO_VAR" /* NoVar */]: 'Prefer "let" or "const"',
1558
- ["INSECURE_TMP_FILE" /* InsecureTmpFile */]: "Insecure Temporary File",
1559
- ["RETURN_SHOULD_NOT_BE_INVARIANT" /* ReturnShouldNotBeInvariant */]: "Return Should Not Be Invariant",
1560
- ["SYSTEM_EXIT_SHOULD_RERAISE" /* SystemExitShouldReraise */]: "SystemExit Should Reraise",
1561
- ["NO_RETURN_IN_FINALLY" /* NoReturnInFinally */]: "No Return in Finally Block",
1562
- ["WILDCARD_IMPORTS" /* WildcardImports */]: "Wildcard Imports should not be used",
1563
- ["AVOID_IDENTITY_COMPARISON_CACHED_TYPES" /* AvoidIdentityComparisonCachedTypes */]: "Avoid Identity Comparison of Cached Types",
1564
- ["AVOID_BUILTIN_SHADOWING" /* AvoidBuiltinShadowing */]: "Avoid Builtin Shadowing",
1565
- ["IMPROPER_STRING_FORMATTING" /* ImproperStringFormatting */]: "Improper String Formatting",
1566
- ["TAR_SLIP" /* TarSlip */]: "Tar Slip",
1567
- ["MISSING_WHITESPACE" /* MissingWhitespace */]: "Missing Whitespace",
1568
- ["NO_PRINT_STATEMENT" /* NoPrintStatement */]: 'Python 2 "print" Statement Is Obsolete',
1569
- ["NO_OP_OVERHEAD" /* NoOpOverhead */]: "Expensive Arguments in Conditional Methods",
1570
- ["DO_NOT_RAISE_EXCEPTION" /* DoNotRaiseException */]: "Do Not Raise Exception",
1571
- ["DECLARE_VARIABLE_EXPLICITLY" /* DeclareVariableExplicitly */]: "Declare Variable Explicitly",
1572
- ["NO_NESTED_TRY" /* NoNestedTry */]: "No Nested Try",
1573
- ["UNNECESSARY_IMPORTS" /* UnnecessaryImports */]: "Unnecessary Imports",
1574
- ["REDOS" /* Redos */]: "Regular Expression Denial of Service"
1575
- };
1576
- var issueTypeZ = z5.nativeEnum(IssueType_Enum);
1577
- var getIssueTypeFriendlyString = (issueType) => {
1578
- const issueTypeZParseRes = issueTypeZ.safeParse(issueType);
1579
- if (!issueTypeZParseRes.success) {
1580
- return issueType ? issueType.replaceAll("_", " ") : "Other";
1581
- }
1582
- return issueTypeMap[issueTypeZParseRes.data];
1583
- };
1584
- function getTagTooltip(tag) {
1585
- switch (tag) {
1586
- case "FALSE_POSITIVE":
1587
- return "Issue was found to be a false positive";
1588
- case "TEST_CODE":
1589
- return "Issue found in test files, not production code";
1590
- case "VENDOR_CODE":
1591
- return "Issue is in external libraries or dependencies not owned or maintained by your team";
1592
- case "AUTOGENERATED_CODE":
1593
- return "Code created by tools or frameworks, not manually written";
1594
- case "AUXILIARY_CODE":
1595
- return "Issue found in supporting files that don't impact core functionality";
1596
- case "Filtered":
1597
- return "Issue was filtered by user in the Fix Policy";
1598
- default:
1599
- return tag;
1600
- }
1601
- }
1602
- var issueDescription = {
1603
- ["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.",
1604
- ["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.",
1605
- ["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.",
1606
- ["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**.",
1607
- ["UNFIXABLE" /* Unfixable */]: "The flagged code cannot be fixed",
1608
- ["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."
1609
- };
1610
- function replaceKeysWithValues(fixDescription, extraContext) {
1611
- let result = fixDescription;
1612
- extraContext.forEach(({ key, value }) => {
1613
- result = result.replace(`\${${key}}`, value);
1614
- });
1615
- return result;
1616
- }
1617
- function getParsedFalsePositiveMessage(data) {
1618
- const { fixDescription, extraContext } = data;
1619
- const containsTemplate = extraContext.some(
1620
- (context) => fixDescription.includes(`\${${context.key}}`)
1621
- );
1622
- const description2 = containsTemplate ? replaceKeysWithValues(fixDescription, extraContext) : fixDescription;
1623
- const contextString = containsTemplate ? null : `\`\`\`${extraContext.map(({ value }) => value).join(" ")} \`\`\``;
1624
- return { description: description2, contextString };
1625
- }
1626
-
1627
- // src/features/analysis/scm/shared/src/validations.ts
1628
- var IssueTypeSettingZ = z6.object({
1629
- autoPrEnabled: z6.boolean(),
1630
- enabled: z6.boolean(),
1631
- issueType: z6.nativeEnum(IssueType_Enum)
1632
- });
1633
- var IssueTypeSettingsZ = z6.array(IssueTypeSettingZ).transform((issueTypeSettings) => {
1634
- return Object.values(IssueType_Enum).map((issueTypeEnum) => {
1635
- const existingIssueTypeSetting = issueTypeSettings.find(
1636
- ({ issueType: dbIssueType }) => dbIssueType === issueTypeEnum
1637
- );
1638
- if (existingIssueTypeSetting) {
1639
- return existingIssueTypeSetting;
1640
- }
1641
- return {
1642
- autoPrEnabled: false,
1643
- enabled: true,
1644
- issueType: issueTypeEnum
1645
- };
1646
- }).sort((a, b) => {
1647
- return getIssueTypeFriendlyString(a.issueType).localeCompare(
1648
- getIssueTypeFriendlyString(b.issueType)
1649
- );
1650
- });
1651
- });
1652
-
1653
- // src/features/analysis/scm/shared/src/types/types.ts
1654
- var OrganizationScreenQueryParamsZ = z7.object({
1655
- organizationId: z7.string().uuid()
1656
- });
1657
- var ProjectPageQueryParamsZ = z7.object({
1658
- organizationId: z7.string().uuid(),
1659
- projectId: z7.string().uuid()
1660
- });
1661
- var AnalysisPageQueryParamsZ = ProjectPageQueryParamsZ.extend({
1662
- reportId: z7.string().uuid()
1663
- });
1664
- var FixPageQueryParamsZ = AnalysisPageQueryParamsZ.extend({
1665
- fixId: z7.string().uuid()
1666
- });
1667
- var IssuePageQueryParamsZ = AnalysisPageQueryParamsZ.extend({
1668
- issueId: z7.string().uuid()
1669
- });
1670
- var CliLoginPageQueryParamsZ = z7.object({
1671
- loginId: z7.string().uuid()
1672
- });
1673
- var AnalysisReportDigestedZ = z7.object({
1674
- id: z7.string().uuid(),
1675
- state: z7.nativeEnum(Fix_Report_State_Enum),
1676
- vulnerabilityReport: z7.object({
1677
- reportSummaryUrl: z7.string().url().nullish(),
1678
- scanDate: z7.string().nullable(),
1679
- supported: z7.object({
1680
- aggregate: z7.object({
1681
- count: z7.number()
1682
- })
1683
- }),
1684
- all: z7.object({
1685
- aggregate: z7.object({
1686
- count: z7.number()
1687
- })
1688
- }),
1689
- vendor: z7.nativeEnum(Vulnerability_Report_Vendor_Enum),
1690
- project: z7.object({
1691
- organizationId: z7.string().uuid()
1692
- })
1693
- })
1694
- });
1695
- var ReportQueryResultZ = z7.object({
1696
- fixReport_by_pk: z7.object({
1697
- id: z7.string().uuid(),
1698
- analysisUrl: z7.string(),
1699
- fixesCommitted: z7.object({
1700
- aggregate: z7.object({ count: z7.number() })
1701
- }),
1702
- fixesDownloaded: z7.object({
1703
- aggregate: z7.object({ count: z7.number() })
1704
- }),
1705
- fixesDoneCount: z7.number(),
1706
- fixesInprogressCount: z7.number(),
1707
- fixesReadyCount: z7.object({
1708
- aggregate: z7.object({ count: z7.number() })
1709
- }),
1710
- issueTypes: z7.record(z7.string(), z7.number()).nullable(),
1711
- issueLanguages: z7.record(z7.string(), z7.number()).nullable(),
1712
- fixesCountByEffort: z7.record(z7.string(), z7.number()).nullable(),
1713
- vulnerabilitySeverities: z7.record(z7.string(), z7.number()).nullable(),
1714
- createdOn: z7.string(),
1715
- expirationOn: z7.string().nullable(),
1716
- state: z7.nativeEnum(Fix_Report_State_Enum),
1717
- fixes: z7.array(
1718
- z7.object({
1719
- id: z7.string().uuid(),
1720
- safeIssueLanguage: z7.string(),
1721
- safeIssueType: z7.string(),
1722
- confidence: z7.number(),
1723
- effortToApplyFix: z7.nativeEnum(Effort_To_Apply_Fix_Enum).nullable(),
1724
- modifiedBy: z7.string().nullable(),
1725
- gitBlameLogin: z7.string().nullable(),
1726
- fixReportId: z7.string().uuid(),
1727
- filePaths: z7.array(
1728
- z7.object({
1729
- fileRepoRelativePath: z7.string()
1730
- })
1731
- ),
1732
- sharedState: FixSharedStateZ,
1733
- numberOfVulnerabilityIssues: z7.number(),
1734
- severityText: z7.nativeEnum(Vulnerability_Severity_Enum),
1735
- vulnerabilityReportIssues: z7.array(
1736
- z7.object({
1737
- id: z7.string().uuid(),
1738
- issueType: z7.string(),
1739
- issueLanguage: z7.string(),
1740
- category: z7.string()
1741
- })
1742
- )
1743
- // scmSubmitFixRequests: ScmSubmitFixRequestsZ,
1744
- })
1745
- ),
1746
- repo: z7.object({
1747
- name: z7.string().nullable(),
1748
- originalUrl: z7.string(),
1749
- reference: z7.string(),
1750
- commitSha: z7.string(),
1751
- isKnownBranch: z7.boolean().nullish().default(true)
1752
- }),
1753
- vulnerabilityReportIssuesFixedCount: z7.object({
1754
- vulnerabilityReportIssues_aggregate: z7.object({
1755
- aggregate: z7.object({ count: z7.number() })
1756
- })
1757
- }),
1758
- vulnerabilityReport: z7.object({
1759
- id: z7.string().uuid(),
1760
- reportSummaryUrl: z7.string().url().nullish(),
1761
- vendor: z7.nativeEnum(Vulnerability_Report_Vendor_Enum).nullable(),
1762
- issuesWithKnownLanguage: z7.number().nullable(),
1763
- scanDate: z7.string().nullable(),
1764
- vendorReportId: z7.string().uuid().nullable(),
1765
- projectId: z7.string().uuid(),
1766
- project: z7.object({
1767
- organizationId: z7.string().uuid()
1768
- }),
1769
- file: z7.object({
1770
- id: z7.string().uuid(),
1771
- path: z7.string()
1772
- }),
1773
- pending: z7.object({
1774
- aggregate: z7.object({
1775
- count: z7.number()
1776
- })
1777
- }),
1778
- irrelevant: z7.object({
1779
- aggregate: z7.object({
1780
- count: z7.number()
1781
- })
1782
- }),
1783
- remaining: z7.object({
1784
- aggregate: z7.object({
1785
- count: z7.number()
1786
- })
1787
- }),
1788
- digested: z7.object({
1789
- aggregate: z7.object({
1790
- count: z7.number()
1791
- })
1792
- }),
1793
- supported: z7.object({
1794
- aggregate: z7.object({
1795
- count: z7.number()
1796
- })
1797
- }),
1798
- all: z7.object({
1799
- aggregate: z7.object({
1800
- count: z7.number()
1801
- })
1802
- }),
1803
- fixable: z7.object({
1804
- aggregate: z7.object({
1805
- count: z7.number()
1806
- })
1807
- }),
1808
- errors: z7.object({
1809
- aggregate: z7.object({
1810
- count: z7.number()
1811
- })
1812
- }),
1813
- vulnerabilityReportIssues: z7.object({
1814
- id: z7.string().uuid(),
1815
- extraData: z7.object({
1816
- missing_files: z7.string().array().nullish(),
1817
- large_files: z7.string().array().nullish(),
1818
- error_files: z7.string().array().nullish()
1819
- })
1820
- }).array()
1821
- })
1822
- })
1823
- });
1824
- var ReportFixesQueryFixZ = z7.object({
1825
- id: z7.string().uuid(),
1826
- sharedState: FixSharedStateZ,
1827
- confidence: z7.number(),
1828
- gitBlameLogin: z7.string().nullable(),
1829
- effortToApplyFix: z7.nativeEnum(Effort_To_Apply_Fix_Enum).nullable(),
1830
- safeIssueLanguage: z7.string(),
1831
- safeIssueType: z7.string(),
1832
- fixReportId: z7.string().uuid(),
1833
- filePaths: z7.array(
1834
- z7.object({
1835
- fileRepoRelativePath: z7.string()
1836
- })
1837
- ),
1838
- numberOfVulnerabilityIssues: z7.number(),
1839
- severityText: z7.nativeEnum(Vulnerability_Severity_Enum),
1840
- vulnerabilityReportIssues: z7.array(
1841
- z7.object({
1842
- issueType: z7.string(),
1843
- issueLanguage: z7.string()
1844
- })
1845
- ).min(1)
1846
- });
1847
- var VulnerabilityReportIssueZ = z7.object({
1848
- id: z7.string().uuid(),
1849
- createdAt: z7.string(),
1850
- state: z7.nativeEnum(Vulnerability_Report_Issue_State_Enum),
1851
- safeIssueType: z7.string(),
1852
- safeIssueLanguage: z7.string(),
1853
- extraData: z7.object({
1854
- missing_files: z7.string().array().nullish(),
1855
- large_files: z7.string().array().nullish(),
1856
- error_files: z7.string().array().nullish()
1857
- }),
1858
- fix: ReportFixesQueryFixZ.nullable(),
1859
- falsePositive: z7.object({
1860
- id: z7.string().uuid()
1861
- }).nullable(),
1862
- parsedSeverity: ParsedSeverityZ,
1863
- severity: z7.string(),
1864
- severityValue: z7.number(),
1865
- category: z7.string(),
1866
- codeNodes: z7.array(z7.object({ path: z7.string() })),
1867
- vulnerabilityReportIssueTags: z7.array(
1868
- z7.object({
1869
- vulnerability_report_issue_tag_value: z7.string()
1870
- })
1871
- ),
1872
- sharedState: VulnerabilityReportIssueSharedStateZ
1873
- });
1874
- var GetReportIssuesQueryZ = z7.object({
1875
- fixReport: z7.object({
1876
- vulnerabilityReport: z7.object({
1877
- id: z7.string().uuid(),
1878
- lastIssueUpdatedAt: z7.string(),
1879
- vulnerabilityReportIssues_aggregate: z7.object({
1880
- aggregate: z7.object({ count: z7.number() })
1881
- }),
1882
- vulnerabilityReportIssues: z7.array(VulnerabilityReportIssueZ)
1883
- })
1884
- }).array()
1885
- }).nullish();
1886
- var FixReportByProjectZ = z7.object({
1887
- project_by_pk: z7.object({
1888
- vulnerabilityReports: z7.array(
1889
- z7.object({
1890
- fixReport: z7.object({ id: z7.string().uuid() }).nullable()
1891
- })
1892
- )
1893
- })
1894
- });
1895
- var FixScreenQueryResultZ = z7.object({
1896
- fixReport_by_pk: FixPageFixReportZ,
1897
- fix_by_pk: FixPartsForFixScreenZ,
1898
- fixesWithSameIssueType: z7.array(
1899
- z7.object({
1900
- id: z7.string().uuid(),
1901
- sharedState: z7.object({ state: z7.nativeEnum(Fix_State_Enum) }).nullable().default({ state: "Ready" /* Ready */ })
1902
- })
1903
- ),
1904
- relevantIssue: IssuePartsZ.nullish()
1905
- });
1906
- var FixPageQueryZ = z7.object({
1907
- data: FixScreenQueryResultZ
1908
- });
1909
- var GetReportFixesQueryZ = z7.object({
1910
- fixReport: z7.array(
1911
- z7.object({
1912
- fixes: z7.array(ReportFixesQueryFixZ),
1913
- vulnerabilityReportIssuesTotalCount: z7.object({
1914
- vulnerabilityReportIssues_aggregate: z7.object({
1915
- aggregate: z7.object({ count: z7.number() })
1916
- })
1917
- }),
1918
- vulnerabilityReportIssuesFixedCount: z7.object({
1919
- vulnerabilityReportIssues_aggregate: z7.object({
1920
- aggregate: z7.object({ count: z7.number() })
1921
- })
1922
- }),
1923
- vulnerabilityReportIssuesIrrelevantCount: z7.object({
1924
- vulnerabilityReportIssues_aggregate: z7.object({
1925
- aggregate: z7.object({ count: z7.number() })
1926
- })
1927
- }),
1928
- vulnerabilityReportIssuesRemainingCount: z7.object({
1929
- vulnerabilityReportIssues_aggregate: z7.object({
1930
- aggregate: z7.object({ count: z7.number() })
1931
- })
1932
- })
1933
- })
1934
- )
1935
- }).nullish();
1936
- var ProjectVulnerabilityReport = z7.object({
1937
- id: z7.string().uuid(),
1938
- name: z7.string().nullable(),
1939
- vendor: z7.nativeEnum(Vulnerability_Report_Vendor_Enum).nullable(),
1940
- fixReport: z7.object({
1941
- id: z7.string().uuid(),
1942
- createdOn: z7.string(),
1943
- vulnerabilityReportIssuesFixedCount: z7.object({
1944
- vulnerabilityReportIssues_aggregate: z7.object({
1945
- aggregate: z7.object({ count: z7.number() })
1946
- })
1947
- }),
1948
- issueTypes: z7.record(z7.string(), z7.number()).nullable(),
1949
- issueLanguages: z7.record(z7.nativeEnum(IssueLanguage_Enum), z7.number()).nullable(),
1950
- fixesCountByEffort: z7.record(z7.nativeEnum(Effort_To_Apply_Fix_Enum), z7.number()).nullable(),
1951
- vulnerabilitySeverities: z7.record(z7.nativeEnum(Vulnerability_Severity_Enum), z7.number()).nullable(),
1952
- fixesDoneCount: z7.number(),
1953
- fixesInprogressCount: z7.number(),
1954
- fixesReadyCount: z7.number(),
1955
- repo: z7.object({
1956
- originalUrl: z7.string(),
1957
- reference: z7.string(),
1958
- name: z7.string()
1959
- }),
1960
- createdByUser: z7.object({
1961
- email: z7.string()
1962
- }).nullable(),
1963
- state: z7.nativeEnum(Fix_Report_State_Enum),
1964
- expirationOn: z7.string()
1965
- })
1966
- });
1967
- var ProjectGetProjectZ = z7.object({
1968
- id: z7.string().uuid(),
1969
- name: z7.string(),
1970
- vulnerabilityReports: z7.object({
1971
- vendor: z7.nativeEnum(Vulnerability_Report_Vendor_Enum).nullable(),
1972
- fixReport: z7.object({
1973
- issueLanguages: z7.record(z7.nativeEnum(IssueLanguage_Enum), z7.number()).nullable(),
1974
- state: z7.nativeEnum(Fix_Report_State_Enum),
1975
- repo: z7.object({
1976
- originalUrl: z7.string(),
1977
- reference: z7.string()
1978
- }),
1979
- expirationOn: z7.string()
1980
- })
1981
- }).array()
1982
- });
1983
- var GetProjectsQueryZ = z7.array(ProjectGetProjectZ);
1984
- var ProjectPageQueryResultZ = z7.object({
1985
- name: z7.string(),
1986
- id: z7.string().uuid(),
1987
- isDefault: z7.boolean().default(false),
1988
- organizationId: z7.string().uuid(),
1989
- vulnerabilityReports: z7.array(ProjectVulnerabilityReport),
1990
- projectIssueTypeSettings: z7.array(
1991
- IssueTypeSettingZ.merge(z7.object({ id: z7.string() }))
1992
- )
1993
- });
1994
- var GetProjectMembersDataZ = z7.object({
1995
- project_by_pk: z7.object({
1996
- name: z7.string(),
1997
- id: z7.string(),
1998
- projectUsers: z7.array(
1999
- z7.object({
2000
- projectToRole: z7.object({
2001
- projectRole: z7.object({
2002
- type: z7.nativeEnum(Project_Role_Type_Enum)
2003
- })
2004
- }),
2005
- user: z7.object({
2006
- id: z7.string().uuid(),
2007
- picture: z7.string().optional(),
2008
- name: z7.string().nullish(),
2009
- email: z7.string().email()
2010
- })
2011
- })
2012
- )
2013
- })
2014
- });
2015
- var RepoArgsZ = z7.object({
2016
- originalUrl: z7.string().url(),
2017
- branch: z7.string(),
2018
- commitSha: z7.string()
2019
- });
2020
- var scmCloudUrl = {
2021
- GitLab: "https://gitlab.com",
2022
- GitHub: "https://github.com",
2023
- Ado: "https://dev.azure.com",
2024
- Bitbucket: "https://bitbucket.org"
2025
- };
2026
- var ScmType = /* @__PURE__ */ ((ScmType2) => {
2027
- ScmType2["GitHub"] = "GitHub";
2028
- ScmType2["GitLab"] = "GitLab";
2029
- ScmType2["Ado"] = "Ado";
2030
- ScmType2["Bitbucket"] = "Bitbucket";
2031
- return ScmType2;
2032
- })(ScmType || {});
2033
- var ConvertToSarifInputFileFormat = /* @__PURE__ */ ((ConvertToSarifInputFileFormat2) => {
2034
- ConvertToSarifInputFileFormat2["FortifyFPR"] = "FortifyFPR";
2035
- return ConvertToSarifInputFileFormat2;
2036
- })(ConvertToSarifInputFileFormat || {});
2037
-
2038
- // src/features/analysis/scm/ado/constants.ts
2039
- var DEFUALT_ADO_ORIGIN = scmCloudUrl.Ado;
2040
-
2041
- // src/features/analysis/scm/ado/utils.ts
2042
- import querystring from "querystring";
2043
- import * as api from "azure-devops-node-api";
2044
- import Debug from "debug";
2045
- import { z as z17 } from "zod";
2046
-
2047
- // src/features/analysis/scm/env.ts
2048
- import { z as z8 } from "zod";
2049
- var EnvVariablesZod = z8.object({
2050
- GITLAB_API_TOKEN: z8.string().optional(),
2051
- GITHUB_API_TOKEN: z8.string().optional(),
2052
- GIT_PROXY_HOST: z8.string().optional().default("http://tinyproxy:8888")
2053
- });
2054
- var { GITLAB_API_TOKEN, GITHUB_API_TOKEN, GIT_PROXY_HOST } = EnvVariablesZod.parse(process.env);
2055
-
2056
- // src/features/analysis/scm/shared/src/commitDescriptionMarkup.ts
2057
- import { z as z9 } from "zod";
2058
-
2059
1136
  // src/features/analysis/scm/shared/src/fixDetailsData.ts
2060
1137
  var fixDetailsData = {
2061
1138
  ["PT" /* Pt */]: {
@@ -2318,8 +1395,173 @@ var fixDetailsData = {
2318
1395
  ["DECLARE_VARIABLE_EXPLICITLY" /* DeclareVariableExplicitly */]: void 0,
2319
1396
  ["UNNECESSARY_IMPORTS" /* UnnecessaryImports */]: void 0,
2320
1397
  ["NO_NESTED_TRY" /* NoNestedTry */]: void 0,
2321
- ["REDOS" /* Redos */]: void 0
1398
+ ["REDOS" /* Redos */]: void 0,
1399
+ ["DO_NOT_THROW_GENERIC_EXCEPTION" /* DoNotThrowGenericException */]: void 0
1400
+ };
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."
2322
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
+ }
2323
1565
 
2324
1566
  // src/features/analysis/scm/shared/src/commitDescriptionMarkup.ts
2325
1567
  function capitalizeFirstLetter(str) {
@@ -2349,7 +1591,7 @@ var getCommitDescription = ({
2349
1591
  )}**.
2350
1592
 
2351
1593
  `;
2352
- const parseIssueTypeRes = z9.nativeEnum(IssueType_Enum).safeParse(issueType);
1594
+ const parseIssueTypeRes = z2.nativeEnum(IssueType_Enum).safeParse(issueType);
2353
1595
  if (issueType && parseIssueTypeRes.success) {
2354
1596
  if (irrelevantIssueWithTags?.[0]?.tag) {
2355
1597
  description2 += `
@@ -2392,7 +1634,7 @@ var getCommitIssueDescription = ({
2392
1634
  const issueTypeString = getIssueTypeFriendlyString(issueType);
2393
1635
  let description2 = `The following issues reported by ${capitalizeFirstLetter(vendor)} on this PR were found to be irrelevant to your project:
2394
1636
  `;
2395
- const parseIssueTypeRes = z9.nativeEnum(IssueType_Enum).safeParse(issueType);
1637
+ const parseIssueTypeRes = z2.nativeEnum(IssueType_Enum).safeParse(issueType);
2396
1638
  if (issueType && parseIssueTypeRes.success) {
2397
1639
  if (irrelevantIssueWithTags?.[0]?.tag) {
2398
1640
  description2 = `
@@ -2417,10 +1659,10 @@ ${staticData.issueDescription}
2417
1659
  };
2418
1660
 
2419
1661
  // src/features/analysis/scm/shared/src/guidances.ts
2420
- import { z as z12 } from "zod";
1662
+ import { z as z5 } from "zod";
2421
1663
 
2422
1664
  // src/features/analysis/scm/shared/src/storedFixData/index.ts
2423
- import { z as z10 } from "zod";
1665
+ import { z as z3 } from "zod";
2424
1666
 
2425
1667
  // src/features/analysis/scm/shared/src/storedFixData/passwordInComment.ts
2426
1668
  var passwordInComment = {
@@ -2596,8 +1838,8 @@ var vulnerabilities8 = {
2596
1838
  var xml_default = vulnerabilities8;
2597
1839
 
2598
1840
  // src/features/analysis/scm/shared/src/storedFixData/index.ts
2599
- var StoredFixDataItemZ = z10.object({
2600
- guidance: z10.function().returns(z10.string())
1841
+ var StoredFixDataItemZ = z3.object({
1842
+ guidance: z3.function().returns(z3.string())
2601
1843
  });
2602
1844
  var languages = {
2603
1845
  ["Java" /* Java */]: java_default,
@@ -2611,7 +1853,7 @@ var languages = {
2611
1853
  };
2612
1854
 
2613
1855
  // src/features/analysis/scm/shared/src/storedQuestionData/index.ts
2614
- import { z as z11 } from "zod";
1856
+ import { z as z4 } from "zod";
2615
1857
 
2616
1858
  // src/features/analysis/scm/shared/src/storedQuestionData/csharp/httpOnlyCookie.ts
2617
1859
  var httpOnlyCookie = {
@@ -3833,10 +3075,10 @@ var vulnerabilities14 = {
3833
3075
  var xml_default2 = vulnerabilities14;
3834
3076
 
3835
3077
  // src/features/analysis/scm/shared/src/storedQuestionData/index.ts
3836
- var StoredQuestionDataItemZ = z11.object({
3837
- content: z11.function().args(z11.any()).returns(z11.string()),
3838
- description: z11.function().args(z11.any()).returns(z11.string()),
3839
- 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())
3840
3082
  });
3841
3083
  var languages2 = {
3842
3084
  ["Java" /* Java */]: java_default2,
@@ -3931,47 +3173,791 @@ function getFixGuidances({
3931
3173
  const fixGuidance = storeFixResult.success ? [storeFixResult.data.guidance({ questions, ...extraContext })] : [];
3932
3174
  return libGuidances.concat(fixGuidance).filter((guidance) => !!guidance);
3933
3175
  }
3934
- var IssueTypeAndLanguageZ = z12.object({
3935
- issueType: z12.nativeEnum(IssueType_Enum),
3936
- 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
3937
3486
  });
3938
- function getGuidances(args) {
3939
- const safeIssueTypeAndLanguage = IssueTypeAndLanguageZ.safeParse({
3940
- issueType: args.issueType,
3941
- issueLanguage: args.issueLanguage
3942
- });
3943
- if (!safeIssueTypeAndLanguage.success) {
3944
- return [];
3945
- }
3946
- const { questions, fixExtraContext } = args;
3947
- const { issueType, issueLanguage } = safeIssueTypeAndLanguage.data;
3948
- const fixGuidances = getFixGuidances({
3949
- issueType,
3950
- issueLanguage,
3951
- fixExtraContext,
3952
- questions
3953
- }).map((guidance, index) => ({ guidance, key: `fixGuidance_index_${index}` }));
3954
- return questions.map((question) => {
3955
- let questionGuidance = question.guidance;
3956
- if (!questionGuidance && issueType && issueLanguage) {
3957
- const getFixInformation = curriedQuestionInformationByQuestion({
3958
- issueType,
3959
- language: issueLanguage
3960
- });
3961
- const { guidance } = getFixInformation(question);
3962
- questionGuidance = guidance({
3963
- userInputValue: question.value
3964
- });
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;
3965
3561
  }
3966
3562
  return {
3967
- ...question,
3968
- guidance: questionGuidance
3563
+ autoPrEnabled: false,
3564
+ enabled: true,
3565
+ issueType: issueTypeEnum
3969
3566
  };
3970
- }).filter(({ guidance }) => !!guidance).map(({ guidance, key }) => ({ guidance, key })).concat(fixGuidances);
3971
- }
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 || {});
3972
3958
 
3973
3959
  // src/features/analysis/scm/shared/src/urlParser/urlParser.ts
3974
- import { z as z13 } from "zod";
3960
+ import { z as z12 } from "zod";
3975
3961
  var ADO_PREFIX_PATH = "tfs";
3976
3962
  var NAME_REGEX = /[a-z0-9\-_.+]+/i;
3977
3963
  function detectAdoUrl(args) {
@@ -3988,7 +3974,7 @@ function detectAdoUrl(args) {
3988
3974
  scmType: "Ado" /* Ado */,
3989
3975
  organization,
3990
3976
  // project has single repo - repoName === projectName
3991
- projectName: z13.string().parse(projectName),
3977
+ projectName: z12.string().parse(projectName),
3992
3978
  repoName: projectName,
3993
3979
  prefixPath
3994
3980
  };
@@ -3999,7 +3985,7 @@ function detectAdoUrl(args) {
3999
3985
  return {
4000
3986
  scmType: "Ado" /* Ado */,
4001
3987
  organization,
4002
- projectName: z13.string().parse(projectName),
3988
+ projectName: z12.string().parse(projectName),
4003
3989
  repoName,
4004
3990
  prefixPath
4005
3991
  };
@@ -4013,7 +3999,7 @@ function detectAdoUrl(args) {
4013
3999
  scmType: "Ado" /* Ado */,
4014
4000
  organization,
4015
4001
  // project has only one repo - repoName === projectName
4016
- projectName: z13.string().parse(repoName),
4002
+ projectName: z12.string().parse(repoName),
4017
4003
  repoName,
4018
4004
  prefixPath
4019
4005
  };
@@ -4023,7 +4009,7 @@ function detectAdoUrl(args) {
4023
4009
  return {
4024
4010
  scmType: "Ado" /* Ado */,
4025
4011
  organization,
4026
- projectName: z13.string().parse(projectName),
4012
+ projectName: z12.string().parse(projectName),
4027
4013
  repoName,
4028
4014
  prefixPath
4029
4015
  };
@@ -4149,11 +4135,8 @@ function getIssueUrl({
4149
4135
  return `${appBaseUrl}/organization/${organizationId}/project/${projectId}/report/${analysisId}/issue/${issueId}`;
4150
4136
  }
4151
4137
 
4152
- // src/features/analysis/scm/utils/index.ts
4153
- import { z as z15 } from "zod";
4154
-
4155
4138
  // src/features/analysis/scm/types.ts
4156
- import { z as z14 } from "zod";
4139
+ import { z as z13 } from "zod";
4157
4140
  var ReferenceType = /* @__PURE__ */ ((ReferenceType2) => {
4158
4141
  ReferenceType2["BRANCH"] = "BRANCH";
4159
4142
  ReferenceType2["COMMIT"] = "COMMIT";
@@ -4185,12 +4168,19 @@ var scmTypeToScmLibScmType = {
4185
4168
  ["Ado" /* Ado */]: "ADO" /* ADO */,
4186
4169
  ["Bitbucket" /* Bitbucket */]: "BITBUCKET" /* BITBUCKET */
4187
4170
  };
4188
- var GetRefererenceResultZ = z14.object({
4189
- date: z14.date().optional(),
4190
- sha: z14.string(),
4191
- type: z14.nativeEnum(ReferenceType)
4171
+ var GetRefererenceResultZ = z13.object({
4172
+ date: z13.date().optional(),
4173
+ sha: z13.string(),
4174
+ type: z13.nativeEnum(ReferenceType)
4192
4175
  });
4193
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
+
4194
4184
  // src/features/analysis/scm/utils/index.ts
4195
4185
  function getFixUrlWithRedirect(params) {
4196
4186
  const {
@@ -4302,7 +4292,7 @@ function shouldValidateUrl(repoUrl) {
4302
4292
  return repoUrl && isUrlHasPath(repoUrl);
4303
4293
  }
4304
4294
  function isBrokerUrl(url) {
4305
- return z15.string().uuid().safeParse(new URL(url).host).success;
4295
+ return z14.string().uuid().safeParse(new URL(url).host).success;
4306
4296
  }
4307
4297
  function buildAuthorizedRepoUrl(args) {
4308
4298
  const { url, username, password } = args;
@@ -4338,7 +4328,7 @@ function getCloudScmLibTypeFromUrl(url) {
4338
4328
  return void 0;
4339
4329
  }
4340
4330
  function getScmLibTypeFromScmType(scmType) {
4341
- const parsedScmType = z15.nativeEnum(ScmType).parse(scmType);
4331
+ const parsedScmType = z14.nativeEnum(ScmType).parse(scmType);
4342
4332
  return scmTypeToScmLibScmType[parsedScmType];
4343
4333
  }
4344
4334
  function getScmConfig({
@@ -4404,6 +4394,24 @@ function getScmConfig({
4404
4394
  };
4405
4395
  }
4406
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
+
4407
4415
  // src/features/analysis/scm/ado/validation.ts
4408
4416
  import { z as z16 } from "zod";
4409
4417
  var ValidPullRequestStatusZ = z16.union([
@@ -4687,6 +4695,7 @@ async function validateAdoRepo({
4687
4695
  }
4688
4696
 
4689
4697
  // src/features/analysis/scm/ado/ado.ts
4698
+ var MAX_ADO_PR_BODY_LENGTH = 15e4;
4690
4699
  async function getAdoSdk(params) {
4691
4700
  const api2 = await getAdoApiClient(params);
4692
4701
  return {
@@ -4837,7 +4846,7 @@ async function getAdoSdk(params) {
4837
4846
  sourceRefName: `refs/heads/${sourceBranchName}`,
4838
4847
  targetRefName: `refs/heads/${targetBranchName}`,
4839
4848
  title,
4840
- description: body
4849
+ description: safeBody(body, MAX_ADO_PR_BODY_LENGTH)
4841
4850
  },
4842
4851
  repo,
4843
4852
  projectName
@@ -5912,6 +5921,7 @@ var TokenExpiredErrorZ = z19.object({
5912
5921
  })
5913
5922
  });
5914
5923
  var BITBUCKET_ACCESS_TOKEN_URL = `https://${BITBUCKET_HOSTNAME}/site/oauth2/access_token`;
5924
+ var MAX_BITBUCKET_PR_BODY_LENGTH = 32768;
5915
5925
  var BitbucketParseResultZ = z19.object({
5916
5926
  organization: z19.string(),
5917
5927
  repoName: z19.string(),
@@ -6000,7 +6010,7 @@ function getBitbucketSdk(params) {
6000
6010
  type: "pullrequest",
6001
6011
  title: params2.title,
6002
6012
  summary: {
6003
- raw: params2.body
6013
+ raw: safeBody(params2.body, MAX_BITBUCKET_PR_BODY_LENGTH)
6004
6014
  },
6005
6015
  source: {
6006
6016
  branch: {
@@ -6620,6 +6630,7 @@ async function githubValidateParams(url, accessToken) {
6620
6630
  }
6621
6631
 
6622
6632
  // src/features/analysis/scm/github/github.ts
6633
+ var MAX_GH_PR_BODY_LENGTH = 65536;
6623
6634
  function getGithubSdk(params = {}) {
6624
6635
  const octokit = getOctoKit(params);
6625
6636
  return {
@@ -6945,7 +6956,7 @@ function getGithubSdk(params = {}) {
6945
6956
  title,
6946
6957
  head: newBranchName,
6947
6958
  head_repo: sourceRepo,
6948
- body,
6959
+ body: safeBody(body, MAX_GH_PR_BODY_LENGTH),
6949
6960
  base: defaultBranch
6950
6961
  });
6951
6962
  return {
@@ -6967,7 +6978,7 @@ function getGithubSdk(params = {}) {
6967
6978
  owner,
6968
6979
  repo,
6969
6980
  title: options.title,
6970
- body: options.body,
6981
+ body: safeBody(options.body, MAX_GH_PR_BODY_LENGTH),
6971
6982
  head: options.sourceBranchName,
6972
6983
  base: options.targetBranchName,
6973
6984
  draft: false,
@@ -7275,6 +7286,7 @@ var debug3 = Debug3("scm:gitlab");
7275
7286
  function removeTrailingSlash2(str) {
7276
7287
  return str.trim().replace(/\/+$/, "");
7277
7288
  }
7289
+ var MAX_GITLAB_PR_BODY_LENGTH = 1048576;
7278
7290
  function getRandomGitlabCloudAnonToken() {
7279
7291
  if (!GITLAB_API_TOKEN || typeof GITLAB_API_TOKEN !== "string") {
7280
7292
  return void 0;
@@ -7472,7 +7484,7 @@ async function createMergeRequest(options) {
7472
7484
  options.targetBranchName,
7473
7485
  options.title,
7474
7486
  {
7475
- description: options.body
7487
+ description: safeBody(options.body, MAX_GITLAB_PR_BODY_LENGTH)
7476
7488
  }
7477
7489
  );
7478
7490
  return res.iid;