mobbdev 0.0.183 → 0.0.185
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +727 -614
- package/package.json +5 -4
package/dist/index.mjs
CHANGED
|
@@ -37,7 +37,7 @@ import { fileURLToPath } from "node:url";
|
|
|
37
37
|
import chalk from "chalk";
|
|
38
38
|
import Debug from "debug";
|
|
39
39
|
import * as dotenv from "dotenv";
|
|
40
|
-
import { z as
|
|
40
|
+
import { z as z4 } from "zod";
|
|
41
41
|
|
|
42
42
|
// src/features/analysis/scm/generates/client_generates.ts
|
|
43
43
|
var FixQuestionInputType = /* @__PURE__ */ ((FixQuestionInputType2) => {
|
|
@@ -651,467 +651,589 @@ function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
651
651
|
}
|
|
652
652
|
|
|
653
653
|
// src/features/analysis/scm/shared/src/types.ts
|
|
654
|
+
import { z as z3 } from "zod";
|
|
655
|
+
|
|
656
|
+
// src/features/analysis/scm/shared/src/validations.ts
|
|
657
|
+
import { z as z2 } from "zod";
|
|
658
|
+
|
|
659
|
+
// src/features/analysis/scm/shared/src/getIssueType.ts
|
|
654
660
|
import { z } from "zod";
|
|
655
|
-
var
|
|
656
|
-
|
|
661
|
+
var issueTypeMap = {
|
|
662
|
+
["NO_LIMITS_OR_THROTTLING" /* NoLimitsOrThrottling */]: "Missing Rate Limiting",
|
|
663
|
+
["SQL_Injection" /* SqlInjection */]: "SQL Injection",
|
|
664
|
+
["CMDi_relative_path_command" /* CmDiRelativePathCommand */]: "Relative Path Command Injection",
|
|
665
|
+
["CMDi" /* CmDi */]: "Command Injection",
|
|
666
|
+
["CONFUSING_NAMING" /* ConfusingNaming */]: "Confusing Naming",
|
|
667
|
+
["XXE" /* Xxe */]: "XXE",
|
|
668
|
+
["XSS" /* Xss */]: "XSS",
|
|
669
|
+
["PT" /* Pt */]: "Path Traversal",
|
|
670
|
+
["ZIP_SLIP" /* ZipSlip */]: "Zip Slip",
|
|
671
|
+
["INSECURE_RANDOMNESS" /* InsecureRandomness */]: "Insecure Randomness",
|
|
672
|
+
["SSRF" /* Ssrf */]: "Server Side Request Forgery",
|
|
673
|
+
["TYPE_CONFUSION" /* TypeConfusion */]: "Type Confusion",
|
|
674
|
+
["REGEX_INJECTION" /* RegexInjection */]: "Regular Expression Injection",
|
|
675
|
+
["INCOMPLETE_URL_SANITIZATION" /* IncompleteUrlSanitization */]: "Incomplete URL Sanitization",
|
|
676
|
+
["LOCALE_DEPENDENT_COMPARISON" /* LocaleDependentComparison */]: "Locale Dependent Comparison",
|
|
677
|
+
["LOG_FORGING" /* LogForging */]: "Log Forging",
|
|
678
|
+
["MISSING_CHECK_AGAINST_NULL" /* MissingCheckAgainstNull */]: "Missing Check against Null",
|
|
679
|
+
["PASSWORD_IN_COMMENT" /* PasswordInComment */]: "Password in Comment",
|
|
680
|
+
["OVERLY_BROAD_CATCH" /* OverlyBroadCatch */]: "Poor Error Handling: Overly Broad Catch",
|
|
681
|
+
["USE_OF_SYSTEM_OUTPUT_STREAM" /* UseOfSystemOutputStream */]: "Use of System.out/System.err",
|
|
682
|
+
["DANGEROUS_FUNCTION_OVERFLOW" /* DangerousFunctionOverflow */]: "Use of dangerous function",
|
|
683
|
+
["DOS_STRING_BUILDER" /* DosStringBuilder */]: "Denial of Service: StringBuilder",
|
|
684
|
+
["OPEN_REDIRECT" /* OpenRedirect */]: "Open Redirect",
|
|
685
|
+
["WEAK_XML_SCHEMA_UNBOUNDED_OCCURRENCES" /* WeakXmlSchemaUnboundedOccurrences */]: "Weak XML Schema: Unbounded Occurrences",
|
|
686
|
+
["SYSTEM_INFORMATION_LEAK" /* SystemInformationLeak */]: "System Information Leak",
|
|
687
|
+
["SYSTEM_INFORMATION_LEAK_EXTERNAL" /* SystemInformationLeakExternal */]: "External System Information Leak",
|
|
688
|
+
["HTTP_RESPONSE_SPLITTING" /* HttpResponseSplitting */]: "HTTP response splitting",
|
|
689
|
+
["HTTP_ONLY_COOKIE" /* HttpOnlyCookie */]: "Cookie is not HttpOnly",
|
|
690
|
+
["INSECURE_COOKIE" /* InsecureCookie */]: "Insecure Cookie",
|
|
691
|
+
["TRUST_BOUNDARY_VIOLATION" /* TrustBoundaryViolation */]: "Trust Boundary Violation",
|
|
692
|
+
["NULL_DEREFERENCE" /* NullDereference */]: "Null Dereference",
|
|
693
|
+
["UNSAFE_DESERIALIZATION" /* UnsafeDeserialization */]: "Unsafe deserialization",
|
|
694
|
+
["INSECURE_BINDER_CONFIGURATION" /* InsecureBinderConfiguration */]: "Insecure Binder Configuration",
|
|
695
|
+
["UNSAFE_TARGET_BLANK" /* UnsafeTargetBlank */]: "Unsafe use of target blank",
|
|
696
|
+
["IFRAME_WITHOUT_SANDBOX" /* IframeWithoutSandbox */]: "Client use of iframe without sandbox",
|
|
697
|
+
["JQUERY_DEPRECATED_SYMBOLS" /* JqueryDeprecatedSymbols */]: "jQuery deprecated symbols",
|
|
698
|
+
["MISSING_ANTIFORGERY_VALIDATION" /* MissingAntiforgeryValidation */]: "Missing Anti-Forgery Validation",
|
|
699
|
+
["GRAPHQL_DEPTH_LIMIT" /* GraphqlDepthLimit */]: "GraphQL Depth Limit",
|
|
700
|
+
["UNCHECKED_LOOP_CONDITION" /* UncheckedLoopCondition */]: "Unchecked Loop Condition",
|
|
701
|
+
["IMPROPER_RESOURCE_SHUTDOWN_OR_RELEASE" /* ImproperResourceShutdownOrRelease */]: "Improper Resource Shutdown or Release",
|
|
702
|
+
["IMPROPER_EXCEPTION_HANDLING" /* ImproperExceptionHandling */]: "Improper Exception Handling",
|
|
703
|
+
["DEFAULT_RIGHTS_IN_OBJ_DEFINITION" /* DefaultRightsInObjDefinition */]: "Default Definer Rights in Package or Object Definition",
|
|
704
|
+
["HTML_COMMENT_IN_JSP" /* HtmlCommentInJsp */]: "HTML Comment in JSP",
|
|
705
|
+
["ERROR_CONDTION_WITHOUT_ACTION" /* ErrorCondtionWithoutAction */]: "Error Condition Without Action",
|
|
706
|
+
["DEPRECATED_FUNCTION" /* DeprecatedFunction */]: "Deprecated Function",
|
|
707
|
+
["HARDCODED_SECRETS" /* HardcodedSecrets */]: "Hardcoded Secrets",
|
|
708
|
+
["PROTOTYPE_POLLUTION" /* PrototypePollution */]: "Prototype Pollution",
|
|
709
|
+
["RACE_CONDITION_FORMAT_FLAW" /* RaceConditionFormatFlaw */]: "Race Condition Format Flaw",
|
|
710
|
+
["NON_FINAL_PUBLIC_STATIC_FIELD" /* NonFinalPublicStaticField */]: "Non-final Public Static Field",
|
|
711
|
+
["MISSING_HSTS_HEADER" /* MissingHstsHeader */]: "Missing HSTS Header",
|
|
712
|
+
["DEAD_CODE_UNUSED_FIELD" /* DeadCodeUnusedField */]: "Dead Code: Unused Field",
|
|
713
|
+
["HEADER_MANIPULATION" /* HeaderManipulation */]: "Header Manipulation",
|
|
714
|
+
["MISSING_EQUALS_OR_HASHCODE" /* MissingEqualsOrHashcode */]: "Missing equals or hashcode method",
|
|
715
|
+
["WCF_MISCONFIGURATION_INSUFFICIENT_LOGGING" /* WcfMisconfigurationInsufficientLogging */]: "WCF Misconfiguration: Insufficient Logging",
|
|
716
|
+
["WCF_MISCONFIGURATION_THROTTLING_NOT_ENABLED" /* WcfMisconfigurationThrottlingNotEnabled */]: "WCF Misconfiguration: Throttling Not Enabled",
|
|
717
|
+
["USELESS_REGEXP_CHAR_ESCAPE" /* UselessRegexpCharEscape */]: "Useless regular-expression character escape",
|
|
718
|
+
["INCOMPLETE_HOSTNAME_REGEX" /* IncompleteHostnameRegex */]: "Incomplete Hostname Regex",
|
|
719
|
+
["OVERLY_LARGE_RANGE" /* OverlyLargeRange */]: "Regex: Overly Large Range",
|
|
720
|
+
["INSUFFICIENT_LOGGING" /* InsufficientLogging */]: "Insufficient Logging of Sensitive Operations",
|
|
721
|
+
["PRIVACY_VIOLATION" /* PrivacyViolation */]: "Privacy Violation",
|
|
722
|
+
["INCOMPLETE_URL_SCHEME_CHECK" /* IncompleteUrlSchemeCheck */]: "Incomplete URL Scheme Check",
|
|
723
|
+
["VALUE_NEVER_READ" /* ValueNeverRead */]: "Value Never Read",
|
|
724
|
+
["VALUE_SHADOWING" /* ValueShadowing */]: "Value Shadowing",
|
|
725
|
+
["NO_EQUIVALENCE_METHOD" /* NoEquivalenceMethod */]: "Class Does Not Implement Equivalence Method",
|
|
726
|
+
["INFORMATION_EXPOSURE_VIA_HEADERS" /* InformationExposureViaHeaders */]: "Information Exposure via Headers",
|
|
727
|
+
["DEBUG_ENABLED" /* DebugEnabled */]: "Debug Enabled",
|
|
728
|
+
["LEFTOVER_DEBUG_CODE" /* LeftoverDebugCode */]: "Leftover Debug Code",
|
|
729
|
+
["POOR_ERROR_HANDLING_EMPTY_CATCH_BLOCK" /* PoorErrorHandlingEmptyCatchBlock */]: "Poor Error Handling: Empty Catch Block",
|
|
730
|
+
["ERRONEOUS_STRING_COMPARE" /* ErroneousStringCompare */]: "Erroneous String Compare",
|
|
731
|
+
["UNVALIDATED_PUBLIC_METHOD_ARGUMENT" /* UnvalidatedPublicMethodArgument */]: "Unvalidated Public Method Argument",
|
|
732
|
+
["AUTO_ESCAPE_FALSE" /* AutoEscapeFalse */]: "Auto-escape False",
|
|
733
|
+
["MISSING_CSP_HEADER" /* MissingCspHeader */]: "Missing CSP Header",
|
|
734
|
+
["HARDCODED_DOMAIN_IN_HTML" /* HardcodedDomainInHtml */]: "Hardcoded Domain in HTML",
|
|
735
|
+
["HEAP_INSPECTION" /* HeapInspection */]: "Heap Inspection"
|
|
736
|
+
};
|
|
737
|
+
var issueTypeZ = z.nativeEnum(IssueType_Enum);
|
|
738
|
+
var getIssueTypeFriendlyString = (issueType) => {
|
|
739
|
+
const issueTypeZParseRes = issueTypeZ.safeParse(issueType);
|
|
740
|
+
if (!issueTypeZParseRes.success) {
|
|
741
|
+
return issueType ? issueType.replaceAll("_", " ") : "Other";
|
|
742
|
+
}
|
|
743
|
+
return issueTypeMap[issueTypeZParseRes.data];
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
// src/features/analysis/scm/shared/src/validations.ts
|
|
747
|
+
var IssueTypeSettingZ = z2.object({
|
|
748
|
+
autoPrEnabled: z2.boolean(),
|
|
749
|
+
enabled: z2.boolean(),
|
|
750
|
+
issueType: z2.nativeEnum(IssueType_Enum)
|
|
657
751
|
});
|
|
658
|
-
var
|
|
659
|
-
|
|
660
|
-
|
|
752
|
+
var IssueTypeSettingsZ = z2.array(IssueTypeSettingZ).transform((issueTypeSettings) => {
|
|
753
|
+
return Object.values(IssueType_Enum).map((issueTypeEnum) => {
|
|
754
|
+
const existingIssueTypeSetting = issueTypeSettings.find(
|
|
755
|
+
({ issueType: dbIssueType }) => dbIssueType === issueTypeEnum
|
|
756
|
+
);
|
|
757
|
+
if (existingIssueTypeSetting) {
|
|
758
|
+
return existingIssueTypeSetting;
|
|
759
|
+
}
|
|
760
|
+
return {
|
|
761
|
+
autoPrEnabled: false,
|
|
762
|
+
enabled: true,
|
|
763
|
+
issueType: issueTypeEnum
|
|
764
|
+
};
|
|
765
|
+
}).sort((a, b) => {
|
|
766
|
+
return getIssueTypeFriendlyString(a.issueType).localeCompare(
|
|
767
|
+
getIssueTypeFriendlyString(b.issueType)
|
|
768
|
+
);
|
|
769
|
+
});
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
// src/features/analysis/scm/shared/src/types.ts
|
|
773
|
+
var OrganizationScreenQueryParamsZ = z3.object({
|
|
774
|
+
organizationId: z3.string().uuid()
|
|
775
|
+
});
|
|
776
|
+
var ProjectPageQueryParamsZ = z3.object({
|
|
777
|
+
organizationId: z3.string().uuid(),
|
|
778
|
+
projectId: z3.string().uuid()
|
|
661
779
|
});
|
|
662
780
|
var AnalysisPageQueryParamsZ = ProjectPageQueryParamsZ.extend({
|
|
663
|
-
reportId:
|
|
781
|
+
reportId: z3.string().uuid()
|
|
664
782
|
});
|
|
665
783
|
var FixPageQueryParamsZ = AnalysisPageQueryParamsZ.extend({
|
|
666
|
-
fixId:
|
|
784
|
+
fixId: z3.string().uuid()
|
|
667
785
|
});
|
|
668
|
-
var CliLoginPageQueryParamsZ =
|
|
669
|
-
loginId:
|
|
786
|
+
var CliLoginPageQueryParamsZ = z3.object({
|
|
787
|
+
loginId: z3.string().uuid()
|
|
670
788
|
});
|
|
671
|
-
var ScmSubmitFixRequestsZ =
|
|
672
|
-
|
|
673
|
-
scmSubmitFixRequest:
|
|
674
|
-
submitFixRequest:
|
|
675
|
-
createdByUser:
|
|
676
|
-
email:
|
|
789
|
+
var ScmSubmitFixRequestsZ = z3.array(
|
|
790
|
+
z3.object({
|
|
791
|
+
scmSubmitFixRequest: z3.object({
|
|
792
|
+
submitFixRequest: z3.object({
|
|
793
|
+
createdByUser: z3.object({
|
|
794
|
+
email: z3.string()
|
|
677
795
|
})
|
|
678
796
|
}),
|
|
679
|
-
prUrl:
|
|
680
|
-
|
|
797
|
+
prUrl: z3.string().nullable(),
|
|
798
|
+
commitUrl: z3.string().nullable(),
|
|
799
|
+
scmId: z3.string()
|
|
681
800
|
})
|
|
682
801
|
})
|
|
683
802
|
);
|
|
684
|
-
var AnalysisReportDigestedZ =
|
|
685
|
-
id:
|
|
686
|
-
state:
|
|
687
|
-
vulnerabilityReport:
|
|
688
|
-
reportSummaryUrl:
|
|
689
|
-
scanDate:
|
|
690
|
-
supported:
|
|
691
|
-
aggregate:
|
|
692
|
-
count:
|
|
803
|
+
var AnalysisReportDigestedZ = z3.object({
|
|
804
|
+
id: z3.string().uuid(),
|
|
805
|
+
state: z3.nativeEnum(Fix_Report_State_Enum),
|
|
806
|
+
vulnerabilityReport: z3.object({
|
|
807
|
+
reportSummaryUrl: z3.string().url().nullish(),
|
|
808
|
+
scanDate: z3.string().nullable(),
|
|
809
|
+
supported: z3.object({
|
|
810
|
+
aggregate: z3.object({
|
|
811
|
+
count: z3.number()
|
|
693
812
|
})
|
|
694
813
|
}),
|
|
695
|
-
all:
|
|
696
|
-
aggregate:
|
|
697
|
-
count:
|
|
814
|
+
all: z3.object({
|
|
815
|
+
aggregate: z3.object({
|
|
816
|
+
count: z3.number()
|
|
698
817
|
})
|
|
699
818
|
}),
|
|
700
|
-
vendor:
|
|
701
|
-
project:
|
|
702
|
-
organizationId:
|
|
819
|
+
vendor: z3.nativeEnum(Vulnerability_Report_Vendor_Enum),
|
|
820
|
+
project: z3.object({
|
|
821
|
+
organizationId: z3.string().uuid()
|
|
703
822
|
})
|
|
704
823
|
})
|
|
705
824
|
});
|
|
706
|
-
var FixRatingZ =
|
|
707
|
-
voteScore:
|
|
708
|
-
fixRatingTag:
|
|
709
|
-
comment:
|
|
710
|
-
updatedDate:
|
|
711
|
-
user:
|
|
712
|
-
email:
|
|
713
|
-
name:
|
|
825
|
+
var FixRatingZ = z3.object({
|
|
826
|
+
voteScore: z3.number(),
|
|
827
|
+
fixRatingTag: z3.nativeEnum(Fix_Rating_Tag_Enum).nullable().default(null),
|
|
828
|
+
comment: z3.string().nullable().default(null),
|
|
829
|
+
updatedDate: z3.string().nullable(),
|
|
830
|
+
user: z3.object({
|
|
831
|
+
email: z3.string(),
|
|
832
|
+
name: z3.string()
|
|
714
833
|
})
|
|
715
834
|
});
|
|
716
|
-
var ReportQueryResultZ =
|
|
717
|
-
fixReport_by_pk:
|
|
718
|
-
id:
|
|
719
|
-
fixesCommitted:
|
|
720
|
-
aggregate:
|
|
835
|
+
var ReportQueryResultZ = z3.object({
|
|
836
|
+
fixReport_by_pk: z3.object({
|
|
837
|
+
id: z3.string().uuid(),
|
|
838
|
+
fixesCommitted: z3.object({
|
|
839
|
+
aggregate: z3.object({ count: z3.number() })
|
|
721
840
|
}),
|
|
722
|
-
fixesDownloaded:
|
|
723
|
-
aggregate:
|
|
841
|
+
fixesDownloaded: z3.object({
|
|
842
|
+
aggregate: z3.object({ count: z3.number() })
|
|
724
843
|
}),
|
|
725
|
-
fixesReadyCount:
|
|
726
|
-
issueTypes:
|
|
727
|
-
issueLanguages:
|
|
728
|
-
fixesCountByEffort:
|
|
729
|
-
vulnerabilitySeverities:
|
|
730
|
-
createdOn:
|
|
731
|
-
expirationOn:
|
|
732
|
-
state:
|
|
733
|
-
fixes_aggregate:
|
|
734
|
-
aggregate:
|
|
735
|
-
count:
|
|
844
|
+
fixesReadyCount: z3.number(),
|
|
845
|
+
issueTypes: z3.record(z3.string(), z3.number()).nullable(),
|
|
846
|
+
issueLanguages: z3.record(z3.string(), z3.number()).nullable(),
|
|
847
|
+
fixesCountByEffort: z3.record(z3.string(), z3.number()).nullable(),
|
|
848
|
+
vulnerabilitySeverities: z3.record(z3.string(), z3.number()).nullable(),
|
|
849
|
+
createdOn: z3.string(),
|
|
850
|
+
expirationOn: z3.string().nullable(),
|
|
851
|
+
state: z3.nativeEnum(Fix_Report_State_Enum),
|
|
852
|
+
fixes_aggregate: z3.object({
|
|
853
|
+
aggregate: z3.object({
|
|
854
|
+
count: z3.number()
|
|
736
855
|
})
|
|
737
856
|
}),
|
|
738
|
-
fixes:
|
|
739
|
-
|
|
740
|
-
id:
|
|
741
|
-
safeIssueLanguage:
|
|
742
|
-
safeIssueType:
|
|
743
|
-
confidence:
|
|
744
|
-
effortToApplyFix:
|
|
745
|
-
modifiedBy:
|
|
746
|
-
gitBlameLogin:
|
|
747
|
-
fixReportId:
|
|
748
|
-
vulnerabilitySeverity:
|
|
749
|
-
filePaths:
|
|
750
|
-
|
|
751
|
-
fileRepoRelativePath:
|
|
857
|
+
fixes: z3.array(
|
|
858
|
+
z3.object({
|
|
859
|
+
id: z3.string().uuid(),
|
|
860
|
+
safeIssueLanguage: z3.string(),
|
|
861
|
+
safeIssueType: z3.string(),
|
|
862
|
+
confidence: z3.number(),
|
|
863
|
+
effortToApplyFix: z3.nativeEnum(Effort_To_Apply_Fix_Enum).nullable(),
|
|
864
|
+
modifiedBy: z3.string().nullable(),
|
|
865
|
+
gitBlameLogin: z3.string().nullable(),
|
|
866
|
+
fixReportId: z3.string().uuid(),
|
|
867
|
+
vulnerabilitySeverity: z3.nativeEnum(Vulnerability_Severity_Enum).nullable().transform((i) => i ?? "low" /* Low */),
|
|
868
|
+
filePaths: z3.array(
|
|
869
|
+
z3.object({
|
|
870
|
+
fileRepoRelativePath: z3.string()
|
|
752
871
|
})
|
|
753
872
|
),
|
|
754
|
-
state:
|
|
755
|
-
numberOfVulnerabilityIssues:
|
|
756
|
-
vulnerabilityReportIssues:
|
|
757
|
-
|
|
758
|
-
issueType:
|
|
759
|
-
issueLanguage:
|
|
873
|
+
state: z3.nativeEnum(Fix_State_Enum),
|
|
874
|
+
numberOfVulnerabilityIssues: z3.number(),
|
|
875
|
+
vulnerabilityReportIssues: z3.array(
|
|
876
|
+
z3.object({
|
|
877
|
+
issueType: z3.string(),
|
|
878
|
+
issueLanguage: z3.string()
|
|
760
879
|
})
|
|
761
880
|
),
|
|
762
881
|
scmSubmitFixRequests: ScmSubmitFixRequestsZ,
|
|
763
|
-
isArchived:
|
|
764
|
-
fixRatings:
|
|
882
|
+
isArchived: z3.boolean().nullable(),
|
|
883
|
+
fixRatings: z3.array(FixRatingZ).default([])
|
|
765
884
|
})
|
|
766
885
|
),
|
|
767
|
-
repo:
|
|
768
|
-
name:
|
|
769
|
-
originalUrl:
|
|
770
|
-
reference:
|
|
771
|
-
commitSha:
|
|
772
|
-
isKnownBranch:
|
|
886
|
+
repo: z3.object({
|
|
887
|
+
name: z3.string().nullable(),
|
|
888
|
+
originalUrl: z3.string(),
|
|
889
|
+
reference: z3.string(),
|
|
890
|
+
commitSha: z3.string(),
|
|
891
|
+
isKnownBranch: z3.boolean().nullish().default(true)
|
|
773
892
|
}),
|
|
774
|
-
vulnerabilityReport:
|
|
775
|
-
reportSummaryUrl:
|
|
776
|
-
vendor:
|
|
777
|
-
issuesWithKnownLanguage:
|
|
778
|
-
scanDate:
|
|
779
|
-
vendorReportId:
|
|
780
|
-
projectId:
|
|
781
|
-
project:
|
|
782
|
-
organizationId:
|
|
893
|
+
vulnerabilityReport: z3.object({
|
|
894
|
+
reportSummaryUrl: z3.string().url().nullish(),
|
|
895
|
+
vendor: z3.nativeEnum(Vulnerability_Report_Vendor_Enum).nullable(),
|
|
896
|
+
issuesWithKnownLanguage: z3.number().nullable(),
|
|
897
|
+
scanDate: z3.string().nullable(),
|
|
898
|
+
vendorReportId: z3.string().uuid().nullable(),
|
|
899
|
+
projectId: z3.string().uuid(),
|
|
900
|
+
project: z3.object({
|
|
901
|
+
organizationId: z3.string().uuid()
|
|
783
902
|
}),
|
|
784
|
-
file:
|
|
785
|
-
id:
|
|
786
|
-
path:
|
|
903
|
+
file: z3.object({
|
|
904
|
+
id: z3.string().uuid(),
|
|
905
|
+
path: z3.string()
|
|
787
906
|
}),
|
|
788
|
-
pending:
|
|
789
|
-
aggregate:
|
|
790
|
-
count:
|
|
907
|
+
pending: z3.object({
|
|
908
|
+
aggregate: z3.object({
|
|
909
|
+
count: z3.number()
|
|
791
910
|
})
|
|
792
911
|
}),
|
|
793
|
-
supported:
|
|
794
|
-
aggregate:
|
|
795
|
-
count:
|
|
912
|
+
supported: z3.object({
|
|
913
|
+
aggregate: z3.object({
|
|
914
|
+
count: z3.number()
|
|
796
915
|
})
|
|
797
916
|
}),
|
|
798
|
-
digested:
|
|
799
|
-
aggregate:
|
|
800
|
-
count:
|
|
917
|
+
digested: z3.object({
|
|
918
|
+
aggregate: z3.object({
|
|
919
|
+
count: z3.number()
|
|
801
920
|
})
|
|
802
921
|
}),
|
|
803
|
-
all:
|
|
804
|
-
aggregate:
|
|
805
|
-
count:
|
|
922
|
+
all: z3.object({
|
|
923
|
+
aggregate: z3.object({
|
|
924
|
+
count: z3.number()
|
|
806
925
|
})
|
|
807
926
|
}),
|
|
808
|
-
fixable:
|
|
809
|
-
aggregate:
|
|
810
|
-
count:
|
|
927
|
+
fixable: z3.object({
|
|
928
|
+
aggregate: z3.object({
|
|
929
|
+
count: z3.number()
|
|
811
930
|
})
|
|
812
931
|
}),
|
|
813
|
-
errors:
|
|
814
|
-
aggregate:
|
|
815
|
-
count:
|
|
932
|
+
errors: z3.object({
|
|
933
|
+
aggregate: z3.object({
|
|
934
|
+
count: z3.number()
|
|
816
935
|
})
|
|
817
936
|
}),
|
|
818
|
-
vulnerabilityReportIssues:
|
|
819
|
-
extraData:
|
|
820
|
-
missing_files:
|
|
821
|
-
large_files:
|
|
822
|
-
error_files:
|
|
937
|
+
vulnerabilityReportIssues: z3.object({
|
|
938
|
+
extraData: z3.object({
|
|
939
|
+
missing_files: z3.string().array().nullish(),
|
|
940
|
+
large_files: z3.string().array().nullish(),
|
|
941
|
+
error_files: z3.string().array().nullish()
|
|
823
942
|
})
|
|
824
943
|
}).array()
|
|
825
944
|
})
|
|
826
945
|
})
|
|
827
946
|
});
|
|
828
|
-
var ReportFixesQueryZ =
|
|
829
|
-
|
|
830
|
-
id:
|
|
831
|
-
state:
|
|
832
|
-
isArchived:
|
|
833
|
-
confidence:
|
|
834
|
-
gitBlameLogin:
|
|
835
|
-
effortToApplyFix:
|
|
836
|
-
safeIssueLanguage:
|
|
837
|
-
safeIssueType:
|
|
838
|
-
vulnerabilitySeverity:
|
|
839
|
-
fixReportId:
|
|
840
|
-
filePaths:
|
|
841
|
-
|
|
842
|
-
fileRepoRelativePath:
|
|
947
|
+
var ReportFixesQueryZ = z3.array(
|
|
948
|
+
z3.object({
|
|
949
|
+
id: z3.string().uuid(),
|
|
950
|
+
state: z3.nativeEnum(Fix_State_Enum),
|
|
951
|
+
isArchived: z3.boolean().nullable(),
|
|
952
|
+
confidence: z3.number(),
|
|
953
|
+
gitBlameLogin: z3.string().nullable(),
|
|
954
|
+
effortToApplyFix: z3.nativeEnum(Effort_To_Apply_Fix_Enum).nullable(),
|
|
955
|
+
safeIssueLanguage: z3.string(),
|
|
956
|
+
safeIssueType: z3.string(),
|
|
957
|
+
vulnerabilitySeverity: z3.nativeEnum(Vulnerability_Severity_Enum).nullable().transform((i) => i ?? "low" /* Low */),
|
|
958
|
+
fixReportId: z3.string().uuid(),
|
|
959
|
+
filePaths: z3.array(
|
|
960
|
+
z3.object({
|
|
961
|
+
fileRepoRelativePath: z3.string()
|
|
843
962
|
})
|
|
844
963
|
),
|
|
845
|
-
numberOfVulnerabilityIssues:
|
|
846
|
-
vulnerabilityReportIssues:
|
|
847
|
-
|
|
848
|
-
issueType:
|
|
849
|
-
issueLanguage:
|
|
964
|
+
numberOfVulnerabilityIssues: z3.number(),
|
|
965
|
+
vulnerabilityReportIssues: z3.array(
|
|
966
|
+
z3.object({
|
|
967
|
+
issueType: z3.string(),
|
|
968
|
+
issueLanguage: z3.string()
|
|
850
969
|
})
|
|
851
970
|
),
|
|
852
971
|
scmSubmitFixRequests: ScmSubmitFixRequestsZ,
|
|
853
|
-
fixRatings:
|
|
972
|
+
fixRatings: z3.array(FixRatingZ).default([])
|
|
854
973
|
})
|
|
855
974
|
);
|
|
856
|
-
var ExtraContextInternalZ =
|
|
857
|
-
key:
|
|
858
|
-
value:
|
|
859
|
-
|
|
860
|
-
int:
|
|
861
|
-
integer:
|
|
862
|
-
string:
|
|
863
|
-
date:
|
|
975
|
+
var ExtraContextInternalZ = z3.object({
|
|
976
|
+
key: z3.string(),
|
|
977
|
+
value: z3.string().or(z3.boolean()).or(
|
|
978
|
+
z3.object({
|
|
979
|
+
int: z3.boolean(),
|
|
980
|
+
integer: z3.boolean(),
|
|
981
|
+
string: z3.boolean(),
|
|
982
|
+
date: z3.boolean()
|
|
864
983
|
})
|
|
865
984
|
)
|
|
866
985
|
});
|
|
867
|
-
var PackageInfoZ =
|
|
868
|
-
name:
|
|
869
|
-
version:
|
|
870
|
-
envName:
|
|
986
|
+
var PackageInfoZ = z3.object({
|
|
987
|
+
name: z3.string(),
|
|
988
|
+
version: z3.string(),
|
|
989
|
+
envName: z3.string().nullable()
|
|
871
990
|
});
|
|
872
|
-
var ManifestActionRequiredZ =
|
|
873
|
-
action:
|
|
874
|
-
language:
|
|
991
|
+
var ManifestActionRequiredZ = z3.object({
|
|
992
|
+
action: z3.nativeEnum(ManifestAction),
|
|
993
|
+
language: z3.nativeEnum(Language),
|
|
875
994
|
lib: PackageInfoZ,
|
|
876
995
|
typesLib: PackageInfoZ.nullable()
|
|
877
996
|
});
|
|
878
|
-
var FixExtraContextZ =
|
|
879
|
-
fixDescription:
|
|
880
|
-
manifestActionsRequired:
|
|
881
|
-
extraContext:
|
|
997
|
+
var FixExtraContextZ = z3.object({
|
|
998
|
+
fixDescription: z3.string(),
|
|
999
|
+
manifestActionsRequired: z3.array(ManifestActionRequiredZ),
|
|
1000
|
+
extraContext: z3.array(ExtraContextInternalZ)
|
|
882
1001
|
});
|
|
883
|
-
var PatchAndQuestionsZ =
|
|
884
|
-
__typename:
|
|
885
|
-
patch:
|
|
886
|
-
questions:
|
|
887
|
-
|
|
888
|
-
name:
|
|
889
|
-
key:
|
|
890
|
-
index:
|
|
891
|
-
defaultValue:
|
|
892
|
-
value:
|
|
893
|
-
extraContext:
|
|
894
|
-
inputType:
|
|
895
|
-
options:
|
|
1002
|
+
var PatchAndQuestionsZ = z3.object({
|
|
1003
|
+
__typename: z3.literal("FixData"),
|
|
1004
|
+
patch: z3.string(),
|
|
1005
|
+
questions: z3.array(
|
|
1006
|
+
z3.object({
|
|
1007
|
+
name: z3.string(),
|
|
1008
|
+
key: z3.string(),
|
|
1009
|
+
index: z3.number(),
|
|
1010
|
+
defaultValue: z3.string(),
|
|
1011
|
+
value: z3.string().nullable(),
|
|
1012
|
+
extraContext: z3.array(ExtraContextInternalZ),
|
|
1013
|
+
inputType: z3.nativeEnum(FixQuestionInputType),
|
|
1014
|
+
options: z3.array(z3.string())
|
|
896
1015
|
})
|
|
897
1016
|
),
|
|
898
1017
|
extraContext: FixExtraContextZ
|
|
899
1018
|
});
|
|
900
|
-
var FixQueryZ =
|
|
901
|
-
__typename:
|
|
902
|
-
id:
|
|
903
|
-
state:
|
|
904
|
-
modifiedBy:
|
|
905
|
-
gitBlameLogin:
|
|
906
|
-
safeIssueLanguage:
|
|
907
|
-
safeIssueType:
|
|
908
|
-
confidence:
|
|
909
|
-
fixReportId:
|
|
910
|
-
isExpired:
|
|
911
|
-
isArchived:
|
|
1019
|
+
var FixQueryZ = z3.object({
|
|
1020
|
+
__typename: z3.literal("fix").optional(),
|
|
1021
|
+
id: z3.string().uuid(),
|
|
1022
|
+
state: z3.nativeEnum(Fix_State_Enum),
|
|
1023
|
+
modifiedBy: z3.string().nullable(),
|
|
1024
|
+
gitBlameLogin: z3.string().nullable(),
|
|
1025
|
+
safeIssueLanguage: z3.string(),
|
|
1026
|
+
safeIssueType: z3.string(),
|
|
1027
|
+
confidence: z3.number(),
|
|
1028
|
+
fixReportId: z3.string().uuid(),
|
|
1029
|
+
isExpired: z3.boolean().default(false),
|
|
1030
|
+
isArchived: z3.boolean().nullable(),
|
|
912
1031
|
// TODO: remove nullish once the data on the backend is ready
|
|
913
|
-
vulnerabilitySeverity:
|
|
914
|
-
fixFiles:
|
|
915
|
-
|
|
916
|
-
fileRepoRelativePath:
|
|
1032
|
+
vulnerabilitySeverity: z3.nativeEnum(Vulnerability_Severity_Enum).nullable().transform((i) => i ?? "low" /* Low */),
|
|
1033
|
+
fixFiles: z3.array(
|
|
1034
|
+
z3.object({
|
|
1035
|
+
fileRepoRelativePath: z3.string()
|
|
917
1036
|
})
|
|
918
1037
|
),
|
|
919
|
-
numberOfVulnerabilityIssues:
|
|
920
|
-
vulnerabilityReportIssues:
|
|
921
|
-
|
|
922
|
-
vendorIssueId:
|
|
923
|
-
issueLanguage:
|
|
1038
|
+
numberOfVulnerabilityIssues: z3.number(),
|
|
1039
|
+
vulnerabilityReportIssues: z3.array(
|
|
1040
|
+
z3.object({
|
|
1041
|
+
vendorIssueId: z3.string(),
|
|
1042
|
+
issueLanguage: z3.string()
|
|
924
1043
|
})
|
|
925
1044
|
),
|
|
926
1045
|
patchAndQuestions: PatchAndQuestionsZ,
|
|
927
1046
|
scmSubmitFixRequests: ScmSubmitFixRequestsZ,
|
|
928
|
-
effortToApplyFix:
|
|
929
|
-
fixRatings:
|
|
1047
|
+
effortToApplyFix: z3.nativeEnum(Effort_To_Apply_Fix_Enum).nullable(),
|
|
1048
|
+
fixRatings: z3.array(FixRatingZ).default([])
|
|
930
1049
|
});
|
|
931
|
-
var FixScreenQueryResultZ =
|
|
932
|
-
fixReport_by_pk:
|
|
933
|
-
id:
|
|
934
|
-
expirationOn:
|
|
935
|
-
createdOn:
|
|
936
|
-
state:
|
|
937
|
-
fixes_aggregate:
|
|
938
|
-
aggregate:
|
|
939
|
-
count:
|
|
1050
|
+
var FixScreenQueryResultZ = z3.object({
|
|
1051
|
+
fixReport_by_pk: z3.object({
|
|
1052
|
+
id: z3.string().uuid(),
|
|
1053
|
+
expirationOn: z3.string(),
|
|
1054
|
+
createdOn: z3.string(),
|
|
1055
|
+
state: z3.nativeEnum(Fix_Report_State_Enum),
|
|
1056
|
+
fixes_aggregate: z3.object({
|
|
1057
|
+
aggregate: z3.object({
|
|
1058
|
+
count: z3.number()
|
|
940
1059
|
})
|
|
941
1060
|
}),
|
|
942
|
-
repo:
|
|
943
|
-
name:
|
|
944
|
-
originalUrl:
|
|
945
|
-
reference:
|
|
946
|
-
commitSha:
|
|
1061
|
+
repo: z3.object({
|
|
1062
|
+
name: z3.string().nullable(),
|
|
1063
|
+
originalUrl: z3.string(),
|
|
1064
|
+
reference: z3.string(),
|
|
1065
|
+
commitSha: z3.string()
|
|
947
1066
|
}),
|
|
948
|
-
vulnerabilityReport:
|
|
949
|
-
vendor:
|
|
950
|
-
vendorReportId:
|
|
951
|
-
projectId:
|
|
952
|
-
project:
|
|
953
|
-
organizationId:
|
|
1067
|
+
vulnerabilityReport: z3.object({
|
|
1068
|
+
vendor: z3.nativeEnum(Vulnerability_Report_Vendor_Enum),
|
|
1069
|
+
vendorReportId: z3.string().uuid().nullable(),
|
|
1070
|
+
projectId: z3.string().uuid(),
|
|
1071
|
+
project: z3.object({
|
|
1072
|
+
organizationId: z3.string().uuid()
|
|
954
1073
|
}),
|
|
955
|
-
file:
|
|
956
|
-
id:
|
|
957
|
-
path:
|
|
1074
|
+
file: z3.object({
|
|
1075
|
+
id: z3.string().uuid(),
|
|
1076
|
+
path: z3.string()
|
|
958
1077
|
}),
|
|
959
|
-
pending:
|
|
960
|
-
aggregate:
|
|
961
|
-
count:
|
|
1078
|
+
pending: z3.object({
|
|
1079
|
+
aggregate: z3.object({
|
|
1080
|
+
count: z3.number()
|
|
962
1081
|
})
|
|
963
1082
|
}),
|
|
964
|
-
supported:
|
|
965
|
-
aggregate:
|
|
966
|
-
count:
|
|
1083
|
+
supported: z3.object({
|
|
1084
|
+
aggregate: z3.object({
|
|
1085
|
+
count: z3.number()
|
|
967
1086
|
})
|
|
968
1087
|
}),
|
|
969
|
-
all:
|
|
970
|
-
aggregate:
|
|
971
|
-
count:
|
|
1088
|
+
all: z3.object({
|
|
1089
|
+
aggregate: z3.object({
|
|
1090
|
+
count: z3.number()
|
|
972
1091
|
})
|
|
973
1092
|
}),
|
|
974
|
-
fixable:
|
|
975
|
-
aggregate:
|
|
976
|
-
count:
|
|
1093
|
+
fixable: z3.object({
|
|
1094
|
+
aggregate: z3.object({
|
|
1095
|
+
count: z3.number()
|
|
977
1096
|
})
|
|
978
1097
|
}),
|
|
979
|
-
errors:
|
|
980
|
-
aggregate:
|
|
981
|
-
count:
|
|
1098
|
+
errors: z3.object({
|
|
1099
|
+
aggregate: z3.object({
|
|
1100
|
+
count: z3.number()
|
|
982
1101
|
})
|
|
983
1102
|
}),
|
|
984
|
-
vulnerabilityReportIssues:
|
|
985
|
-
extraData:
|
|
986
|
-
missing_files:
|
|
987
|
-
large_files:
|
|
988
|
-
error_files:
|
|
1103
|
+
vulnerabilityReportIssues: z3.object({
|
|
1104
|
+
extraData: z3.object({
|
|
1105
|
+
missing_files: z3.string().array().nullish(),
|
|
1106
|
+
large_files: z3.string().array().nullish(),
|
|
1107
|
+
error_files: z3.string().array().nullish()
|
|
989
1108
|
})
|
|
990
1109
|
}).array()
|
|
991
1110
|
})
|
|
992
1111
|
}),
|
|
993
1112
|
fix_by_pk: FixQueryZ.merge(
|
|
994
|
-
|
|
995
|
-
vulnerabilityReportIssues:
|
|
996
|
-
|
|
997
|
-
vendorIssueId:
|
|
998
|
-
issueType:
|
|
999
|
-
issueLanguage:
|
|
1113
|
+
z3.object({
|
|
1114
|
+
vulnerabilityReportIssues: z3.array(
|
|
1115
|
+
z3.object({
|
|
1116
|
+
vendorIssueId: z3.string(),
|
|
1117
|
+
issueType: z3.string(),
|
|
1118
|
+
issueLanguage: z3.string()
|
|
1000
1119
|
})
|
|
1001
1120
|
)
|
|
1002
1121
|
})
|
|
1003
1122
|
),
|
|
1004
|
-
fixesWithSameIssueType:
|
|
1005
|
-
fix:
|
|
1123
|
+
fixesWithSameIssueType: z3.object({
|
|
1124
|
+
fix: z3.array(z3.object({ id: z3.string().uuid() }))
|
|
1006
1125
|
})
|
|
1007
1126
|
});
|
|
1008
|
-
var FixReportByProjectZ =
|
|
1009
|
-
project_by_pk:
|
|
1010
|
-
vulnerabilityReports:
|
|
1011
|
-
|
|
1012
|
-
fixReport:
|
|
1127
|
+
var FixReportByProjectZ = z3.object({
|
|
1128
|
+
project_by_pk: z3.object({
|
|
1129
|
+
vulnerabilityReports: z3.array(
|
|
1130
|
+
z3.object({
|
|
1131
|
+
fixReport: z3.object({ id: z3.string().uuid() }).nullable()
|
|
1013
1132
|
})
|
|
1014
1133
|
)
|
|
1015
1134
|
})
|
|
1016
1135
|
});
|
|
1017
|
-
var FixPageQueryZ =
|
|
1136
|
+
var FixPageQueryZ = z3.object({
|
|
1018
1137
|
data: FixScreenQueryResultZ
|
|
1019
1138
|
});
|
|
1020
|
-
var GetReportFixesQueryZ =
|
|
1021
|
-
fixReport:
|
|
1139
|
+
var GetReportFixesQueryZ = z3.object({
|
|
1140
|
+
fixReport: z3.object({
|
|
1022
1141
|
fixes: ReportFixesQueryZ,
|
|
1023
|
-
vulnerabilityReport:
|
|
1024
|
-
vulnerabilityReportIssues_aggregate:
|
|
1025
|
-
aggregate:
|
|
1142
|
+
vulnerabilityReport: z3.object({
|
|
1143
|
+
vulnerabilityReportIssues_aggregate: z3.object({
|
|
1144
|
+
aggregate: z3.object({ count: z3.number() })
|
|
1026
1145
|
})
|
|
1027
1146
|
})
|
|
1028
1147
|
}).array()
|
|
1029
1148
|
}).nullish();
|
|
1030
|
-
var ProjectVulnerabilityReport =
|
|
1031
|
-
id:
|
|
1032
|
-
name:
|
|
1033
|
-
vendor:
|
|
1034
|
-
fixReport:
|
|
1035
|
-
id:
|
|
1036
|
-
createdOn:
|
|
1037
|
-
fixes_aggregate:
|
|
1038
|
-
aggregate:
|
|
1039
|
-
count:
|
|
1149
|
+
var ProjectVulnerabilityReport = z3.object({
|
|
1150
|
+
id: z3.string().uuid(),
|
|
1151
|
+
name: z3.string().nullable(),
|
|
1152
|
+
vendor: z3.nativeEnum(Vulnerability_Report_Vendor_Enum).nullable(),
|
|
1153
|
+
fixReport: z3.object({
|
|
1154
|
+
id: z3.string().uuid(),
|
|
1155
|
+
createdOn: z3.string(),
|
|
1156
|
+
fixes_aggregate: z3.object({
|
|
1157
|
+
aggregate: z3.object({
|
|
1158
|
+
count: z3.number()
|
|
1040
1159
|
})
|
|
1041
1160
|
}),
|
|
1042
|
-
issueTypes:
|
|
1043
|
-
issueLanguages:
|
|
1044
|
-
fixesCountByEffort:
|
|
1045
|
-
vulnerabilitySeverities:
|
|
1046
|
-
fixesDoneCount:
|
|
1047
|
-
fixesInprogressCount:
|
|
1048
|
-
fixesReadyCount:
|
|
1049
|
-
repo:
|
|
1050
|
-
originalUrl:
|
|
1051
|
-
reference:
|
|
1052
|
-
name:
|
|
1161
|
+
issueTypes: z3.record(z3.string(), z3.number()).nullable(),
|
|
1162
|
+
issueLanguages: z3.record(z3.nativeEnum(IssueLanguage_Enum), z3.number()).nullable(),
|
|
1163
|
+
fixesCountByEffort: z3.record(z3.nativeEnum(Effort_To_Apply_Fix_Enum), z3.number()).nullable(),
|
|
1164
|
+
vulnerabilitySeverities: z3.record(z3.nativeEnum(Vulnerability_Severity_Enum), z3.number()).nullable(),
|
|
1165
|
+
fixesDoneCount: z3.number(),
|
|
1166
|
+
fixesInprogressCount: z3.number(),
|
|
1167
|
+
fixesReadyCount: z3.number(),
|
|
1168
|
+
repo: z3.object({
|
|
1169
|
+
originalUrl: z3.string(),
|
|
1170
|
+
reference: z3.string(),
|
|
1171
|
+
name: z3.string()
|
|
1053
1172
|
}),
|
|
1054
|
-
createdByUser:
|
|
1055
|
-
email:
|
|
1173
|
+
createdByUser: z3.object({
|
|
1174
|
+
email: z3.string()
|
|
1056
1175
|
}).nullable(),
|
|
1057
|
-
state:
|
|
1058
|
-
expirationOn:
|
|
1176
|
+
state: z3.nativeEnum(Fix_Report_State_Enum),
|
|
1177
|
+
expirationOn: z3.string()
|
|
1059
1178
|
})
|
|
1060
1179
|
});
|
|
1061
|
-
var ProjectGetProjectZ =
|
|
1062
|
-
id:
|
|
1063
|
-
name:
|
|
1064
|
-
vulnerabilityReports:
|
|
1065
|
-
vendor:
|
|
1066
|
-
fixReport:
|
|
1067
|
-
issueLanguages:
|
|
1068
|
-
state:
|
|
1069
|
-
fixes_aggregate:
|
|
1070
|
-
aggregate:
|
|
1071
|
-
count:
|
|
1180
|
+
var ProjectGetProjectZ = z3.object({
|
|
1181
|
+
id: z3.string().uuid(),
|
|
1182
|
+
name: z3.string(),
|
|
1183
|
+
vulnerabilityReports: z3.object({
|
|
1184
|
+
vendor: z3.nativeEnum(Vulnerability_Report_Vendor_Enum).nullable(),
|
|
1185
|
+
fixReport: z3.object({
|
|
1186
|
+
issueLanguages: z3.record(z3.nativeEnum(IssueLanguage_Enum), z3.number()).nullable(),
|
|
1187
|
+
state: z3.nativeEnum(Fix_Report_State_Enum),
|
|
1188
|
+
fixes_aggregate: z3.object({
|
|
1189
|
+
aggregate: z3.object({
|
|
1190
|
+
count: z3.number()
|
|
1072
1191
|
})
|
|
1073
1192
|
}),
|
|
1074
|
-
repo:
|
|
1075
|
-
originalUrl:
|
|
1076
|
-
reference:
|
|
1193
|
+
repo: z3.object({
|
|
1194
|
+
originalUrl: z3.string(),
|
|
1195
|
+
reference: z3.string()
|
|
1077
1196
|
}),
|
|
1078
|
-
expirationOn:
|
|
1197
|
+
expirationOn: z3.string()
|
|
1079
1198
|
})
|
|
1080
1199
|
}).array()
|
|
1081
1200
|
});
|
|
1082
|
-
var GetProjectsQueryZ =
|
|
1083
|
-
var ProjectPageQueryResultZ =
|
|
1084
|
-
name:
|
|
1085
|
-
id:
|
|
1086
|
-
isDefault:
|
|
1087
|
-
organizationId:
|
|
1088
|
-
vulnerabilityReports:
|
|
1201
|
+
var GetProjectsQueryZ = z3.array(ProjectGetProjectZ);
|
|
1202
|
+
var ProjectPageQueryResultZ = z3.object({
|
|
1203
|
+
name: z3.string(),
|
|
1204
|
+
id: z3.string().uuid(),
|
|
1205
|
+
isDefault: z3.boolean().default(false),
|
|
1206
|
+
organizationId: z3.string().uuid(),
|
|
1207
|
+
vulnerabilityReports: z3.array(ProjectVulnerabilityReport),
|
|
1208
|
+
projectIssueTypeSettings: z3.array(
|
|
1209
|
+
IssueTypeSettingZ.merge(z3.object({ id: z3.string() }))
|
|
1210
|
+
)
|
|
1089
1211
|
});
|
|
1090
|
-
var GetProjectMembersDataZ =
|
|
1091
|
-
project_by_pk:
|
|
1092
|
-
name:
|
|
1093
|
-
id:
|
|
1094
|
-
projectUsers:
|
|
1095
|
-
|
|
1096
|
-
projectToRole:
|
|
1097
|
-
projectRole:
|
|
1098
|
-
type:
|
|
1212
|
+
var GetProjectMembersDataZ = z3.object({
|
|
1213
|
+
project_by_pk: z3.object({
|
|
1214
|
+
name: z3.string(),
|
|
1215
|
+
id: z3.string(),
|
|
1216
|
+
projectUsers: z3.array(
|
|
1217
|
+
z3.object({
|
|
1218
|
+
projectToRole: z3.object({
|
|
1219
|
+
projectRole: z3.object({
|
|
1220
|
+
type: z3.nativeEnum(Project_Role_Type_Enum)
|
|
1099
1221
|
})
|
|
1100
1222
|
}),
|
|
1101
|
-
user:
|
|
1102
|
-
id:
|
|
1103
|
-
picture:
|
|
1104
|
-
name:
|
|
1105
|
-
email:
|
|
1223
|
+
user: z3.object({
|
|
1224
|
+
id: z3.string().uuid(),
|
|
1225
|
+
picture: z3.string().optional(),
|
|
1226
|
+
name: z3.string().nullish(),
|
|
1227
|
+
email: z3.string().email()
|
|
1106
1228
|
})
|
|
1107
1229
|
})
|
|
1108
1230
|
)
|
|
1109
1231
|
})
|
|
1110
1232
|
});
|
|
1111
|
-
var RepoArgs =
|
|
1112
|
-
originalUrl:
|
|
1113
|
-
branch:
|
|
1114
|
-
commitSha:
|
|
1233
|
+
var RepoArgs = z3.object({
|
|
1234
|
+
originalUrl: z3.string().url(),
|
|
1235
|
+
branch: z3.string(),
|
|
1236
|
+
commitSha: z3.string()
|
|
1115
1237
|
});
|
|
1116
1238
|
var scmCloudUrl = {
|
|
1117
1239
|
GitLab: "https://gitlab.com",
|
|
@@ -1151,12 +1273,12 @@ var scannerToVulnerability_Report_Vendor_Enum = {
|
|
|
1151
1273
|
[SCANNERS.Codeql]: "codeql" /* Codeql */,
|
|
1152
1274
|
[SCANNERS.Fortify]: "fortify" /* Fortify */
|
|
1153
1275
|
};
|
|
1154
|
-
var SupportedScannersZ =
|
|
1155
|
-
var envVariablesSchema =
|
|
1156
|
-
WEB_APP_URL:
|
|
1157
|
-
API_URL:
|
|
1158
|
-
HASURA_ACCESS_KEY:
|
|
1159
|
-
LOCAL_GRAPHQL_ENDPOINT:
|
|
1276
|
+
var SupportedScannersZ = z4.enum([SCANNERS.Checkmarx, SCANNERS.Snyk]);
|
|
1277
|
+
var envVariablesSchema = z4.object({
|
|
1278
|
+
WEB_APP_URL: z4.string(),
|
|
1279
|
+
API_URL: z4.string(),
|
|
1280
|
+
HASURA_ACCESS_KEY: z4.string(),
|
|
1281
|
+
LOCAL_GRAPHQL_ENDPOINT: z4.string()
|
|
1160
1282
|
}).required();
|
|
1161
1283
|
var envVariables = envVariablesSchema.parse(process.env);
|
|
1162
1284
|
debug("config %o", envVariables);
|
|
@@ -1294,7 +1416,7 @@ import fetch4 from "node-fetch";
|
|
|
1294
1416
|
import open2 from "open";
|
|
1295
1417
|
import semver from "semver";
|
|
1296
1418
|
import tmp2 from "tmp";
|
|
1297
|
-
import { z as
|
|
1419
|
+
import { z as z22 } from "zod";
|
|
1298
1420
|
|
|
1299
1421
|
// src/features/analysis/add_fix_comments_for_pr/add_fix_comments_for_pr.ts
|
|
1300
1422
|
import Debug7 from "debug";
|
|
@@ -1306,29 +1428,33 @@ var DEFUALT_ADO_ORIGIN = scmCloudUrl.Ado;
|
|
|
1306
1428
|
import querystring3 from "node:querystring";
|
|
1307
1429
|
import * as api from "azure-devops-node-api";
|
|
1308
1430
|
import Debug3 from "debug";
|
|
1309
|
-
import { z as
|
|
1431
|
+
import { z as z18 } from "zod";
|
|
1310
1432
|
|
|
1311
1433
|
// src/features/analysis/scm/env.ts
|
|
1312
|
-
import { z as
|
|
1313
|
-
var EnvVariablesZod =
|
|
1314
|
-
GITLAB_API_TOKEN:
|
|
1315
|
-
GITHUB_API_TOKEN:
|
|
1316
|
-
GIT_PROXY_HOST:
|
|
1434
|
+
import { z as z5 } from "zod";
|
|
1435
|
+
var EnvVariablesZod = z5.object({
|
|
1436
|
+
GITLAB_API_TOKEN: z5.string().optional(),
|
|
1437
|
+
GITHUB_API_TOKEN: z5.string().optional(),
|
|
1438
|
+
GIT_PROXY_HOST: z5.string()
|
|
1317
1439
|
});
|
|
1318
1440
|
var { GITLAB_API_TOKEN, GITHUB_API_TOKEN, GIT_PROXY_HOST } = EnvVariablesZod.parse(process.env);
|
|
1319
1441
|
|
|
1320
1442
|
// src/features/analysis/scm/scm.ts
|
|
1321
|
-
import { z as
|
|
1443
|
+
import { z as z16 } from "zod";
|
|
1322
1444
|
|
|
1323
1445
|
// src/features/analysis/scm/bitbucket/bitbucket.ts
|
|
1324
1446
|
import querystring from "node:querystring";
|
|
1325
1447
|
import bitbucketPkg from "bitbucket";
|
|
1326
1448
|
import * as bitbucketPkgNode from "bitbucket";
|
|
1327
1449
|
import Debug2 from "debug";
|
|
1328
|
-
import { z as
|
|
1450
|
+
import { z as z12 } from "zod";
|
|
1451
|
+
|
|
1452
|
+
// src/features/analysis/scm/constants.ts
|
|
1453
|
+
var MOBB_ICON_IMG = "https://app.mobb.ai/gh-action/Logo_Rounded_Icon.svg";
|
|
1454
|
+
var MAX_BRANCHES_FETCH = 100;
|
|
1329
1455
|
|
|
1330
1456
|
// src/features/analysis/scm/shared/src/commitDescriptionMarkup.ts
|
|
1331
|
-
import { z as
|
|
1457
|
+
import { z as z6 } from "zod";
|
|
1332
1458
|
|
|
1333
1459
|
// src/features/analysis/scm/shared/src/fixDetailsData.ts
|
|
1334
1460
|
var fixDetailsData = {
|
|
@@ -1555,93 +1681,6 @@ var fixDetailsData = {
|
|
|
1555
1681
|
}
|
|
1556
1682
|
};
|
|
1557
1683
|
|
|
1558
|
-
// src/features/analysis/scm/shared/src/getIssueType.ts
|
|
1559
|
-
import { z as z4 } from "zod";
|
|
1560
|
-
var issueTypeMap = {
|
|
1561
|
-
["NO_LIMITS_OR_THROTTLING" /* NoLimitsOrThrottling */]: "Missing Rate Limiting",
|
|
1562
|
-
["SQL_Injection" /* SqlInjection */]: "SQL Injection",
|
|
1563
|
-
["CMDi_relative_path_command" /* CmDiRelativePathCommand */]: "Relative Path Command Injection",
|
|
1564
|
-
["CMDi" /* CmDi */]: "Command Injection",
|
|
1565
|
-
["CONFUSING_NAMING" /* ConfusingNaming */]: "Confusing Naming",
|
|
1566
|
-
["XXE" /* Xxe */]: "XXE",
|
|
1567
|
-
["XSS" /* Xss */]: "XSS",
|
|
1568
|
-
["PT" /* Pt */]: "Path Traversal",
|
|
1569
|
-
["ZIP_SLIP" /* ZipSlip */]: "Zip Slip",
|
|
1570
|
-
["INSECURE_RANDOMNESS" /* InsecureRandomness */]: "Insecure Randomness",
|
|
1571
|
-
["SSRF" /* Ssrf */]: "Server Side Request Forgery",
|
|
1572
|
-
["TYPE_CONFUSION" /* TypeConfusion */]: "Type Confusion",
|
|
1573
|
-
["REGEX_INJECTION" /* RegexInjection */]: "Regular Expression Injection",
|
|
1574
|
-
["INCOMPLETE_URL_SANITIZATION" /* IncompleteUrlSanitization */]: "Incomplete URL Sanitization",
|
|
1575
|
-
["LOCALE_DEPENDENT_COMPARISON" /* LocaleDependentComparison */]: "Locale Dependent Comparison",
|
|
1576
|
-
["LOG_FORGING" /* LogForging */]: "Log Forging",
|
|
1577
|
-
["MISSING_CHECK_AGAINST_NULL" /* MissingCheckAgainstNull */]: "Missing Check against Null",
|
|
1578
|
-
["PASSWORD_IN_COMMENT" /* PasswordInComment */]: "Password in Comment",
|
|
1579
|
-
["OVERLY_BROAD_CATCH" /* OverlyBroadCatch */]: "Poor Error Handling: Overly Broad Catch",
|
|
1580
|
-
["USE_OF_SYSTEM_OUTPUT_STREAM" /* UseOfSystemOutputStream */]: "Use of System.out/System.err",
|
|
1581
|
-
["DANGEROUS_FUNCTION_OVERFLOW" /* DangerousFunctionOverflow */]: "Use of dangerous function",
|
|
1582
|
-
["DOS_STRING_BUILDER" /* DosStringBuilder */]: "Denial of Service: StringBuilder",
|
|
1583
|
-
["OPEN_REDIRECT" /* OpenRedirect */]: "Open Redirect",
|
|
1584
|
-
["WEAK_XML_SCHEMA_UNBOUNDED_OCCURRENCES" /* WeakXmlSchemaUnboundedOccurrences */]: "Weak XML Schema: Unbounded Occurrences",
|
|
1585
|
-
["SYSTEM_INFORMATION_LEAK" /* SystemInformationLeak */]: "System Information Leak",
|
|
1586
|
-
["SYSTEM_INFORMATION_LEAK_EXTERNAL" /* SystemInformationLeakExternal */]: "External System Information Leak",
|
|
1587
|
-
["HTTP_RESPONSE_SPLITTING" /* HttpResponseSplitting */]: "HTTP response splitting",
|
|
1588
|
-
["HTTP_ONLY_COOKIE" /* HttpOnlyCookie */]: "Cookie is not HttpOnly",
|
|
1589
|
-
["INSECURE_COOKIE" /* InsecureCookie */]: "Insecure Cookie",
|
|
1590
|
-
["TRUST_BOUNDARY_VIOLATION" /* TrustBoundaryViolation */]: "Trust Boundary Violation",
|
|
1591
|
-
["NULL_DEREFERENCE" /* NullDereference */]: "Null Dereference",
|
|
1592
|
-
["UNSAFE_DESERIALIZATION" /* UnsafeDeserialization */]: "Unsafe deserialization",
|
|
1593
|
-
["INSECURE_BINDER_CONFIGURATION" /* InsecureBinderConfiguration */]: "Insecure Binder Configuration",
|
|
1594
|
-
["UNSAFE_TARGET_BLANK" /* UnsafeTargetBlank */]: "Unsafe use of target blank",
|
|
1595
|
-
["IFRAME_WITHOUT_SANDBOX" /* IframeWithoutSandbox */]: "Client use of iframe without sandbox",
|
|
1596
|
-
["JQUERY_DEPRECATED_SYMBOLS" /* JqueryDeprecatedSymbols */]: "jQuery deprecated symbols",
|
|
1597
|
-
["MISSING_ANTIFORGERY_VALIDATION" /* MissingAntiforgeryValidation */]: "Missing Anti-Forgery Validation",
|
|
1598
|
-
["GRAPHQL_DEPTH_LIMIT" /* GraphqlDepthLimit */]: "GraphQL Depth Limit",
|
|
1599
|
-
["UNCHECKED_LOOP_CONDITION" /* UncheckedLoopCondition */]: "Unchecked Loop Condition",
|
|
1600
|
-
["IMPROPER_RESOURCE_SHUTDOWN_OR_RELEASE" /* ImproperResourceShutdownOrRelease */]: "Improper Resource Shutdown or Release",
|
|
1601
|
-
["IMPROPER_EXCEPTION_HANDLING" /* ImproperExceptionHandling */]: "Improper Exception Handling",
|
|
1602
|
-
["DEFAULT_RIGHTS_IN_OBJ_DEFINITION" /* DefaultRightsInObjDefinition */]: "Default Definer Rights in Package or Object Definition",
|
|
1603
|
-
["HTML_COMMENT_IN_JSP" /* HtmlCommentInJsp */]: "HTML Comment in JSP",
|
|
1604
|
-
["ERROR_CONDTION_WITHOUT_ACTION" /* ErrorCondtionWithoutAction */]: "Error Condition Without Action",
|
|
1605
|
-
["DEPRECATED_FUNCTION" /* DeprecatedFunction */]: "Deprecated Function",
|
|
1606
|
-
["HARDCODED_SECRETS" /* HardcodedSecrets */]: "Hardcoded Secrets",
|
|
1607
|
-
["PROTOTYPE_POLLUTION" /* PrototypePollution */]: "Prototype Pollution",
|
|
1608
|
-
["RACE_CONDITION_FORMAT_FLAW" /* RaceConditionFormatFlaw */]: "Race Condition Format Flaw",
|
|
1609
|
-
["NON_FINAL_PUBLIC_STATIC_FIELD" /* NonFinalPublicStaticField */]: "Non-final Public Static Field",
|
|
1610
|
-
["MISSING_HSTS_HEADER" /* MissingHstsHeader */]: "Missing HSTS Header",
|
|
1611
|
-
["DEAD_CODE_UNUSED_FIELD" /* DeadCodeUnusedField */]: "Dead Code: Unused Field",
|
|
1612
|
-
["HEADER_MANIPULATION" /* HeaderManipulation */]: "Header Manipulation",
|
|
1613
|
-
["MISSING_EQUALS_OR_HASHCODE" /* MissingEqualsOrHashcode */]: "Missing equals or hashcode method",
|
|
1614
|
-
["WCF_MISCONFIGURATION_INSUFFICIENT_LOGGING" /* WcfMisconfigurationInsufficientLogging */]: "WCF Misconfiguration: Insufficient Logging",
|
|
1615
|
-
["WCF_MISCONFIGURATION_THROTTLING_NOT_ENABLED" /* WcfMisconfigurationThrottlingNotEnabled */]: "WCF Misconfiguration: Throttling Not Enabled",
|
|
1616
|
-
["USELESS_REGEXP_CHAR_ESCAPE" /* UselessRegexpCharEscape */]: "Useless regular-expression character escape",
|
|
1617
|
-
["INCOMPLETE_HOSTNAME_REGEX" /* IncompleteHostnameRegex */]: "Incomplete Hostname Regex",
|
|
1618
|
-
["OVERLY_LARGE_RANGE" /* OverlyLargeRange */]: "Regex: Overly Large Range",
|
|
1619
|
-
["INSUFFICIENT_LOGGING" /* InsufficientLogging */]: "Insufficient Logging of Sensitive Operations",
|
|
1620
|
-
["PRIVACY_VIOLATION" /* PrivacyViolation */]: "Privacy Violation",
|
|
1621
|
-
["INCOMPLETE_URL_SCHEME_CHECK" /* IncompleteUrlSchemeCheck */]: "Incomplete URL Scheme Check",
|
|
1622
|
-
["VALUE_NEVER_READ" /* ValueNeverRead */]: "Value Never Read",
|
|
1623
|
-
["VALUE_SHADOWING" /* ValueShadowing */]: "Value Shadowing",
|
|
1624
|
-
["NO_EQUIVALENCE_METHOD" /* NoEquivalenceMethod */]: "Class Does Not Implement Equivalence Method",
|
|
1625
|
-
["INFORMATION_EXPOSURE_VIA_HEADERS" /* InformationExposureViaHeaders */]: "Information Exposure via Headers",
|
|
1626
|
-
["DEBUG_ENABLED" /* DebugEnabled */]: "Debug Enabled",
|
|
1627
|
-
["LEFTOVER_DEBUG_CODE" /* LeftoverDebugCode */]: "Leftover Debug Code",
|
|
1628
|
-
["POOR_ERROR_HANDLING_EMPTY_CATCH_BLOCK" /* PoorErrorHandlingEmptyCatchBlock */]: "Poor Error Handling: Empty Catch Block",
|
|
1629
|
-
["ERRONEOUS_STRING_COMPARE" /* ErroneousStringCompare */]: "Erroneous String Compare",
|
|
1630
|
-
["UNVALIDATED_PUBLIC_METHOD_ARGUMENT" /* UnvalidatedPublicMethodArgument */]: "Unvalidated Public Method Argument",
|
|
1631
|
-
["AUTO_ESCAPE_FALSE" /* AutoEscapeFalse */]: "Auto-escape False",
|
|
1632
|
-
["MISSING_CSP_HEADER" /* MissingCspHeader */]: "Missing CSP Header",
|
|
1633
|
-
["HARDCODED_DOMAIN_IN_HTML" /* HardcodedDomainInHtml */]: "Hardcoded Domain in HTML",
|
|
1634
|
-
["HEAP_INSPECTION" /* HeapInspection */]: "Heap Inspection"
|
|
1635
|
-
};
|
|
1636
|
-
var issueTypeZ = z4.nativeEnum(IssueType_Enum);
|
|
1637
|
-
var getIssueTypeFriendlyString = (issueType) => {
|
|
1638
|
-
const issueTypeZParseRes = issueTypeZ.safeParse(issueType);
|
|
1639
|
-
if (!issueTypeZParseRes.success) {
|
|
1640
|
-
return issueType ? issueType.replaceAll("_", " ") : "Other";
|
|
1641
|
-
}
|
|
1642
|
-
return issueTypeMap[issueTypeZParseRes.data];
|
|
1643
|
-
};
|
|
1644
|
-
|
|
1645
1684
|
// src/features/analysis/scm/shared/src/commitDescriptionMarkup.ts
|
|
1646
1685
|
function capitalizeFirstLetter(str) {
|
|
1647
1686
|
return str?.length ? str[0].toUpperCase() + str.slice(1) : "";
|
|
@@ -1659,7 +1698,7 @@ var getCommitDescription = ({
|
|
|
1659
1698
|
guidances,
|
|
1660
1699
|
fixUrl
|
|
1661
1700
|
}) => {
|
|
1662
|
-
const parseIssueTypeRes =
|
|
1701
|
+
const parseIssueTypeRes = z6.nativeEnum(IssueType_Enum).safeParse(issueType);
|
|
1663
1702
|
if (!parseIssueTypeRes.success) {
|
|
1664
1703
|
return "";
|
|
1665
1704
|
}
|
|
@@ -1690,10 +1729,10 @@ ${guidances.map(({ guidance }) => `## Additional actions required
|
|
|
1690
1729
|
};
|
|
1691
1730
|
|
|
1692
1731
|
// src/features/analysis/scm/shared/src/guidances.ts
|
|
1693
|
-
import { z as
|
|
1732
|
+
import { z as z9 } from "zod";
|
|
1694
1733
|
|
|
1695
1734
|
// src/features/analysis/scm/shared/src/storedFixData/index.ts
|
|
1696
|
-
import { z as
|
|
1735
|
+
import { z as z7 } from "zod";
|
|
1697
1736
|
|
|
1698
1737
|
// src/features/analysis/scm/shared/src/storedFixData/passwordInComment.ts
|
|
1699
1738
|
var passwordInComment = {
|
|
@@ -1848,8 +1887,8 @@ var vulnerabilities6 = {
|
|
|
1848
1887
|
var xml_default = vulnerabilities6;
|
|
1849
1888
|
|
|
1850
1889
|
// src/features/analysis/scm/shared/src/storedFixData/index.ts
|
|
1851
|
-
var StoredFixDataItemZ =
|
|
1852
|
-
guidance:
|
|
1890
|
+
var StoredFixDataItemZ = z7.object({
|
|
1891
|
+
guidance: z7.function().returns(z7.string())
|
|
1853
1892
|
});
|
|
1854
1893
|
var languages = {
|
|
1855
1894
|
["Java" /* Java */]: java_default,
|
|
@@ -1861,7 +1900,7 @@ var languages = {
|
|
|
1861
1900
|
};
|
|
1862
1901
|
|
|
1863
1902
|
// src/features/analysis/scm/shared/src/storedQuestionData/index.ts
|
|
1864
|
-
import { z as
|
|
1903
|
+
import { z as z8 } from "zod";
|
|
1865
1904
|
|
|
1866
1905
|
// src/features/analysis/scm/shared/src/storedQuestionData/csharp/httpOnlyCookie.ts
|
|
1867
1906
|
var httpOnlyCookie = {
|
|
@@ -2927,10 +2966,10 @@ var vulnerabilities10 = {
|
|
|
2927
2966
|
var xml_default2 = vulnerabilities10;
|
|
2928
2967
|
|
|
2929
2968
|
// src/features/analysis/scm/shared/src/storedQuestionData/index.ts
|
|
2930
|
-
var StoredQuestionDataItemZ =
|
|
2931
|
-
content:
|
|
2932
|
-
description:
|
|
2933
|
-
guidance:
|
|
2969
|
+
var StoredQuestionDataItemZ = z8.object({
|
|
2970
|
+
content: z8.function().args(z8.any()).returns(z8.string()),
|
|
2971
|
+
description: z8.function().args(z8.any()).returns(z8.string()),
|
|
2972
|
+
guidance: z8.function().args(z8.any()).returns(z8.string())
|
|
2934
2973
|
});
|
|
2935
2974
|
var languages2 = {
|
|
2936
2975
|
["Java" /* Java */]: java_default2,
|
|
@@ -3023,9 +3062,9 @@ function getFixGuidances({
|
|
|
3023
3062
|
const fixGuidance = storeFixResult.success ? [storeFixResult.data.guidance({ questions, ...extraContext })] : [];
|
|
3024
3063
|
return libGuidances.concat(fixGuidance).filter((guidance) => !!guidance);
|
|
3025
3064
|
}
|
|
3026
|
-
var IssueTypeAndLanguageZ =
|
|
3027
|
-
issueType:
|
|
3028
|
-
issueLanguage:
|
|
3065
|
+
var IssueTypeAndLanguageZ = z9.object({
|
|
3066
|
+
issueType: z9.nativeEnum(IssueType_Enum),
|
|
3067
|
+
issueLanguage: z9.nativeEnum(IssueLanguage_Enum)
|
|
3029
3068
|
});
|
|
3030
3069
|
function getGuidances(args) {
|
|
3031
3070
|
const safeIssueTypeAndLanguage = IssueTypeAndLanguageZ.safeParse({
|
|
@@ -3063,7 +3102,7 @@ function getGuidances(args) {
|
|
|
3063
3102
|
}
|
|
3064
3103
|
|
|
3065
3104
|
// src/features/analysis/scm/shared/src/urlParser/urlParser.ts
|
|
3066
|
-
import { z as
|
|
3105
|
+
import { z as z10 } from "zod";
|
|
3067
3106
|
function detectAdoUrl(args) {
|
|
3068
3107
|
const { pathname, hostname, scmType } = args;
|
|
3069
3108
|
const hostnameParts = hostname.split(".");
|
|
@@ -3078,7 +3117,7 @@ function detectAdoUrl(args) {
|
|
|
3078
3117
|
scmType: "Ado" /* Ado */,
|
|
3079
3118
|
organization,
|
|
3080
3119
|
// project has single repo - repoName === projectName
|
|
3081
|
-
projectName:
|
|
3120
|
+
projectName: z10.string().parse(projectName),
|
|
3082
3121
|
repoName: projectName,
|
|
3083
3122
|
prefixPath
|
|
3084
3123
|
};
|
|
@@ -3089,7 +3128,7 @@ function detectAdoUrl(args) {
|
|
|
3089
3128
|
return {
|
|
3090
3129
|
scmType: "Ado" /* Ado */,
|
|
3091
3130
|
organization,
|
|
3092
|
-
projectName:
|
|
3131
|
+
projectName: z10.string().parse(projectName),
|
|
3093
3132
|
repoName,
|
|
3094
3133
|
prefixPath
|
|
3095
3134
|
};
|
|
@@ -3103,7 +3142,7 @@ function detectAdoUrl(args) {
|
|
|
3103
3142
|
scmType: "Ado" /* Ado */,
|
|
3104
3143
|
organization,
|
|
3105
3144
|
// project has only one repo - repoName === projectName
|
|
3106
|
-
projectName:
|
|
3145
|
+
projectName: z10.string().parse(repoName),
|
|
3107
3146
|
repoName,
|
|
3108
3147
|
prefixPath
|
|
3109
3148
|
};
|
|
@@ -3113,7 +3152,7 @@ function detectAdoUrl(args) {
|
|
|
3113
3152
|
return {
|
|
3114
3153
|
scmType: "Ado" /* Ado */,
|
|
3115
3154
|
organization,
|
|
3116
|
-
projectName:
|
|
3155
|
+
projectName: z10.string().parse(projectName),
|
|
3117
3156
|
repoName,
|
|
3118
3157
|
prefixPath
|
|
3119
3158
|
};
|
|
@@ -3337,30 +3376,30 @@ var sanityRepoURL = (scmURL) => {
|
|
|
3337
3376
|
};
|
|
3338
3377
|
|
|
3339
3378
|
// src/features/analysis/scm/bitbucket/validation.ts
|
|
3340
|
-
import { z as
|
|
3341
|
-
var BitbucketAuthResultZ =
|
|
3342
|
-
access_token:
|
|
3343
|
-
token_type:
|
|
3344
|
-
refresh_token:
|
|
3379
|
+
import { z as z11 } from "zod";
|
|
3380
|
+
var BitbucketAuthResultZ = z11.object({
|
|
3381
|
+
access_token: z11.string(),
|
|
3382
|
+
token_type: z11.string(),
|
|
3383
|
+
refresh_token: z11.string()
|
|
3345
3384
|
});
|
|
3346
3385
|
|
|
3347
3386
|
// src/features/analysis/scm/bitbucket/bitbucket.ts
|
|
3348
3387
|
var debug2 = Debug2("scm:bitbucket");
|
|
3349
3388
|
var BITBUCKET_HOSTNAME = "bitbucket.org";
|
|
3350
|
-
var TokenExpiredErrorZ =
|
|
3351
|
-
status:
|
|
3352
|
-
error:
|
|
3353
|
-
type:
|
|
3354
|
-
error:
|
|
3355
|
-
message:
|
|
3389
|
+
var TokenExpiredErrorZ = z12.object({
|
|
3390
|
+
status: z12.number(),
|
|
3391
|
+
error: z12.object({
|
|
3392
|
+
type: z12.string(),
|
|
3393
|
+
error: z12.object({
|
|
3394
|
+
message: z12.string()
|
|
3356
3395
|
})
|
|
3357
3396
|
})
|
|
3358
3397
|
});
|
|
3359
3398
|
var BITBUCKET_ACCESS_TOKEN_URL = `https://${BITBUCKET_HOSTNAME}/site/oauth2/access_token`;
|
|
3360
|
-
var BitbucketParseResultZ =
|
|
3361
|
-
organization:
|
|
3362
|
-
repoName:
|
|
3363
|
-
hostname:
|
|
3399
|
+
var BitbucketParseResultZ = z12.object({
|
|
3400
|
+
organization: z12.string(),
|
|
3401
|
+
repoName: z12.string(),
|
|
3402
|
+
hostname: z12.literal(BITBUCKET_HOSTNAME)
|
|
3364
3403
|
});
|
|
3365
3404
|
function parseBitbucketOrganizationAndRepo(bitbucketUrl) {
|
|
3366
3405
|
const parsedGitHubUrl = normalizeUrl(bitbucketUrl);
|
|
@@ -3413,12 +3452,14 @@ function getBitbucketSdk(params) {
|
|
|
3413
3452
|
);
|
|
3414
3453
|
const res = await bitbucketClient.refs.listBranches({
|
|
3415
3454
|
repo_slug: repoSlug,
|
|
3416
|
-
workspace
|
|
3455
|
+
workspace,
|
|
3456
|
+
pagelen: MAX_BRANCHES_FETCH,
|
|
3457
|
+
sort: "-target.date"
|
|
3417
3458
|
});
|
|
3418
3459
|
if (!res.data.values) {
|
|
3419
3460
|
return [];
|
|
3420
3461
|
}
|
|
3421
|
-
return res.data.values.filter((branch) => !!branch.name).map((branch) =>
|
|
3462
|
+
return res.data.values.filter((branch) => !!branch.name).map((branch) => z12.string().parse(branch.name));
|
|
3422
3463
|
},
|
|
3423
3464
|
async getIsUserCollaborator(params2) {
|
|
3424
3465
|
const { repoUrl } = params2;
|
|
@@ -3533,7 +3574,7 @@ function getBitbucketSdk(params) {
|
|
|
3533
3574
|
return GetRefererenceResultZ.parse({
|
|
3534
3575
|
sha: tagRes.data.target?.hash,
|
|
3535
3576
|
type: "TAG" /* TAG */,
|
|
3536
|
-
date: new Date(
|
|
3577
|
+
date: new Date(z12.string().parse(tagRes.data.target?.date))
|
|
3537
3578
|
});
|
|
3538
3579
|
},
|
|
3539
3580
|
async getBranchRef(params2) {
|
|
@@ -3541,7 +3582,7 @@ function getBitbucketSdk(params) {
|
|
|
3541
3582
|
return GetRefererenceResultZ.parse({
|
|
3542
3583
|
sha: getBranchRes.target?.hash,
|
|
3543
3584
|
type: "BRANCH" /* BRANCH */,
|
|
3544
|
-
date: new Date(
|
|
3585
|
+
date: new Date(z12.string().parse(getBranchRes.target?.date))
|
|
3545
3586
|
});
|
|
3546
3587
|
},
|
|
3547
3588
|
async getCommitRef(params2) {
|
|
@@ -3549,13 +3590,13 @@ function getBitbucketSdk(params) {
|
|
|
3549
3590
|
return GetRefererenceResultZ.parse({
|
|
3550
3591
|
sha: getCommitRes.hash,
|
|
3551
3592
|
type: "COMMIT" /* COMMIT */,
|
|
3552
|
-
date: new Date(
|
|
3593
|
+
date: new Date(z12.string().parse(getCommitRes.date))
|
|
3553
3594
|
});
|
|
3554
3595
|
},
|
|
3555
3596
|
async getDownloadUrl({ url, sha }) {
|
|
3556
3597
|
this.getReferenceData({ ref: sha, url });
|
|
3557
3598
|
const repoRes = await this.getRepo({ repoUrl: url });
|
|
3558
|
-
const parsedRepoUrl =
|
|
3599
|
+
const parsedRepoUrl = z12.string().url().parse(repoRes.links?.html?.href);
|
|
3559
3600
|
return `${parsedRepoUrl}/get/${sha}.zip`;
|
|
3560
3601
|
},
|
|
3561
3602
|
async getPullRequest(params2) {
|
|
@@ -3598,7 +3639,7 @@ async function validateBitbucketParams(params) {
|
|
|
3598
3639
|
}
|
|
3599
3640
|
async function getUsersworkspacesSlugs(bitbucketClient) {
|
|
3600
3641
|
const res = await bitbucketClient.workspaces.getWorkspaces({});
|
|
3601
|
-
return res.data.values?.map((v) =>
|
|
3642
|
+
return res.data.values?.map((v) => z12.string().parse(v.slug));
|
|
3602
3643
|
}
|
|
3603
3644
|
async function getllUsersrepositories(bitbucketClient) {
|
|
3604
3645
|
const userWorspacesSlugs = await getUsersworkspacesSlugs(bitbucketClient);
|
|
@@ -4098,7 +4139,7 @@ function getGithubSdk(params = {}) {
|
|
|
4098
4139
|
return octokit.rest.repos.listBranches({
|
|
4099
4140
|
owner,
|
|
4100
4141
|
repo,
|
|
4101
|
-
per_page:
|
|
4142
|
+
per_page: MAX_BRANCHES_FETCH,
|
|
4102
4143
|
page: 1
|
|
4103
4144
|
});
|
|
4104
4145
|
},
|
|
@@ -4145,11 +4186,11 @@ import {
|
|
|
4145
4186
|
} from "undici";
|
|
4146
4187
|
|
|
4147
4188
|
// src/features/analysis/scm/gitlab/types.ts
|
|
4148
|
-
import { z as
|
|
4149
|
-
var GitlabAuthResultZ =
|
|
4150
|
-
access_token:
|
|
4151
|
-
token_type:
|
|
4152
|
-
refresh_token:
|
|
4189
|
+
import { z as z13 } from "zod";
|
|
4190
|
+
var GitlabAuthResultZ = z13.object({
|
|
4191
|
+
access_token: z13.string(),
|
|
4192
|
+
token_type: z13.string(),
|
|
4193
|
+
refresh_token: z13.string()
|
|
4153
4194
|
});
|
|
4154
4195
|
|
|
4155
4196
|
// src/features/analysis/scm/gitlab/gitlab.ts
|
|
@@ -4157,7 +4198,6 @@ function removeTrailingSlash(str) {
|
|
|
4157
4198
|
return str.trim().replace(/\/+$/, "");
|
|
4158
4199
|
}
|
|
4159
4200
|
function getGitBeaker(options) {
|
|
4160
|
-
console.log("getGitBeaker starting");
|
|
4161
4201
|
const token = options?.gitlabAuthToken ?? GITLAB_API_TOKEN ?? "";
|
|
4162
4202
|
const url = options.url;
|
|
4163
4203
|
const host = url ? new URL(url).origin : "https://gitlab.com";
|
|
@@ -4301,10 +4341,7 @@ async function getGitlabBranchList({
|
|
|
4301
4341
|
const api2 = getGitBeaker({ url: repoUrl, gitlabAuthToken: accessToken });
|
|
4302
4342
|
try {
|
|
4303
4343
|
const res = await api2.Branches.all(projectPath, {
|
|
4304
|
-
perPage:
|
|
4305
|
-
pagination: "keyset",
|
|
4306
|
-
orderBy: "updated_at",
|
|
4307
|
-
sort: "dec"
|
|
4344
|
+
perPage: MAX_BRANCHES_FETCH
|
|
4308
4345
|
});
|
|
4309
4346
|
return res.map((branch) => branch.name);
|
|
4310
4347
|
} catch (e) {
|
|
@@ -4340,6 +4377,18 @@ async function getGitlabMergeRequest({
|
|
|
4340
4377
|
});
|
|
4341
4378
|
return await api2.MergeRequests.show(projectPath, prNumber);
|
|
4342
4379
|
}
|
|
4380
|
+
async function getGitlabCommitUrl({
|
|
4381
|
+
url,
|
|
4382
|
+
commitSha,
|
|
4383
|
+
accessToken
|
|
4384
|
+
}) {
|
|
4385
|
+
const { projectPath } = parseGitlabOwnerAndRepo(url);
|
|
4386
|
+
const api2 = getGitBeaker({
|
|
4387
|
+
url,
|
|
4388
|
+
gitlabAuthToken: accessToken
|
|
4389
|
+
});
|
|
4390
|
+
return await api2.Commits.show(projectPath, commitSha);
|
|
4391
|
+
}
|
|
4343
4392
|
async function getGitlabRepoDefaultBranch(repoUrl, options) {
|
|
4344
4393
|
const api2 = getGitBeaker({
|
|
4345
4394
|
url: repoUrl,
|
|
@@ -4485,80 +4534,97 @@ import parseDiff from "parse-diff";
|
|
|
4485
4534
|
import path3 from "path";
|
|
4486
4535
|
import { simpleGit } from "simple-git";
|
|
4487
4536
|
import tmp from "tmp";
|
|
4488
|
-
import { z as
|
|
4537
|
+
import { z as z15 } from "zod";
|
|
4489
4538
|
|
|
4490
4539
|
// src/features/analysis/scm/scmSubmit/types.ts
|
|
4491
|
-
import { z as
|
|
4492
|
-
var BaseSubmitToScmMessageZ =
|
|
4493
|
-
submitFixRequestId:
|
|
4494
|
-
fixes:
|
|
4495
|
-
|
|
4496
|
-
fixId:
|
|
4497
|
-
patches:
|
|
4540
|
+
import { z as z14 } from "zod";
|
|
4541
|
+
var BaseSubmitToScmMessageZ = z14.object({
|
|
4542
|
+
submitFixRequestId: z14.string().uuid(),
|
|
4543
|
+
fixes: z14.array(
|
|
4544
|
+
z14.object({
|
|
4545
|
+
fixId: z14.string().uuid(),
|
|
4546
|
+
patches: z14.array(z14.string())
|
|
4498
4547
|
})
|
|
4499
4548
|
),
|
|
4500
|
-
commitHash:
|
|
4501
|
-
repoUrl:
|
|
4502
|
-
mobbUserEmail:
|
|
4503
|
-
extraHeaders:
|
|
4549
|
+
commitHash: z14.string(),
|
|
4550
|
+
repoUrl: z14.string(),
|
|
4551
|
+
mobbUserEmail: z14.string(),
|
|
4552
|
+
extraHeaders: z14.record(z14.string(), z14.string()).default({})
|
|
4504
4553
|
});
|
|
4505
4554
|
var submitToScmMessageType = {
|
|
4506
4555
|
commitToSameBranch: "commitToSameBranch",
|
|
4507
4556
|
submitFixesForDifferentBranch: "submitFixesForDifferentBranch"
|
|
4508
4557
|
};
|
|
4509
4558
|
var CommitToSameBranchParamsZ = BaseSubmitToScmMessageZ.merge(
|
|
4510
|
-
|
|
4511
|
-
type:
|
|
4512
|
-
branch:
|
|
4513
|
-
commitMessage:
|
|
4514
|
-
commitDescription:
|
|
4515
|
-
githubCommentId:
|
|
4559
|
+
z14.object({
|
|
4560
|
+
type: z14.literal(submitToScmMessageType.commitToSameBranch),
|
|
4561
|
+
branch: z14.string(),
|
|
4562
|
+
commitMessage: z14.string(),
|
|
4563
|
+
commitDescription: z14.string().nullish(),
|
|
4564
|
+
githubCommentId: z14.number().nullish()
|
|
4516
4565
|
})
|
|
4517
4566
|
);
|
|
4518
|
-
var SubmitFixesToDifferentBranchParamsZ =
|
|
4519
|
-
type:
|
|
4520
|
-
submitBranch:
|
|
4521
|
-
baseBranch:
|
|
4567
|
+
var SubmitFixesToDifferentBranchParamsZ = z14.object({
|
|
4568
|
+
type: z14.literal(submitToScmMessageType.submitFixesForDifferentBranch),
|
|
4569
|
+
submitBranch: z14.string(),
|
|
4570
|
+
baseBranch: z14.string()
|
|
4522
4571
|
}).merge(BaseSubmitToScmMessageZ);
|
|
4523
|
-
var SubmitFixesMessageZ =
|
|
4572
|
+
var SubmitFixesMessageZ = z14.union([
|
|
4524
4573
|
CommitToSameBranchParamsZ,
|
|
4525
4574
|
SubmitFixesToDifferentBranchParamsZ
|
|
4526
4575
|
]);
|
|
4527
|
-
var FixResponseArrayZ =
|
|
4528
|
-
|
|
4529
|
-
fixId:
|
|
4576
|
+
var FixResponseArrayZ = z14.array(
|
|
4577
|
+
z14.object({
|
|
4578
|
+
fixId: z14.string().uuid()
|
|
4530
4579
|
})
|
|
4531
4580
|
);
|
|
4532
|
-
var SubmitFixesBaseResponseMessageZ =
|
|
4533
|
-
mobbUserEmail:
|
|
4534
|
-
submitFixRequestId:
|
|
4535
|
-
submitBranches:
|
|
4536
|
-
|
|
4537
|
-
branchName:
|
|
4581
|
+
var SubmitFixesBaseResponseMessageZ = z14.object({
|
|
4582
|
+
mobbUserEmail: z14.string(),
|
|
4583
|
+
submitFixRequestId: z14.string().uuid(),
|
|
4584
|
+
submitBranches: z14.array(
|
|
4585
|
+
z14.object({
|
|
4586
|
+
branchName: z14.string(),
|
|
4538
4587
|
fixes: FixResponseArrayZ
|
|
4539
4588
|
})
|
|
4540
4589
|
),
|
|
4541
|
-
error:
|
|
4542
|
-
type:
|
|
4590
|
+
error: z14.object({
|
|
4591
|
+
type: z14.enum([
|
|
4543
4592
|
"InitialRepoAccessError",
|
|
4544
4593
|
"PushBranchError",
|
|
4545
4594
|
"UnknownError"
|
|
4546
4595
|
]),
|
|
4547
|
-
info:
|
|
4548
|
-
message:
|
|
4549
|
-
pushBranchName:
|
|
4596
|
+
info: z14.object({
|
|
4597
|
+
message: z14.string(),
|
|
4598
|
+
pushBranchName: z14.string().optional()
|
|
4550
4599
|
})
|
|
4551
4600
|
}).optional()
|
|
4552
4601
|
});
|
|
4553
|
-
var
|
|
4554
|
-
|
|
4555
|
-
|
|
4602
|
+
var authorSchemaZ = z14.object({
|
|
4603
|
+
email: z14.string(),
|
|
4604
|
+
name: z14.string()
|
|
4605
|
+
}).nullable();
|
|
4606
|
+
var summarySchemaZ = z14.object({
|
|
4607
|
+
changes: z14.number(),
|
|
4608
|
+
insertions: z14.number(),
|
|
4609
|
+
deletions: z14.number()
|
|
4610
|
+
});
|
|
4611
|
+
var GitCommitZ = z14.object({
|
|
4612
|
+
author: authorSchemaZ,
|
|
4613
|
+
branch: z14.string(),
|
|
4614
|
+
commit: z14.string(),
|
|
4615
|
+
root: z14.boolean(),
|
|
4616
|
+
summary: summarySchemaZ
|
|
4617
|
+
}).nullable();
|
|
4618
|
+
var SubmitFixesToSameBranchResponseMessageZ = z14.object({
|
|
4619
|
+
type: z14.literal(submitToScmMessageType.commitToSameBranch),
|
|
4620
|
+
githubCommentId: z14.number().nullish(),
|
|
4621
|
+
commit: GitCommitZ
|
|
4556
4622
|
}).merge(SubmitFixesBaseResponseMessageZ);
|
|
4557
|
-
var SubmitFixesToDifferentBranchResponseMessageZ =
|
|
4558
|
-
type:
|
|
4559
|
-
githubCommentId:
|
|
4623
|
+
var SubmitFixesToDifferentBranchResponseMessageZ = z14.object({
|
|
4624
|
+
type: z14.literal(submitToScmMessageType.submitFixesForDifferentBranch),
|
|
4625
|
+
githubCommentId: z14.number().optional()
|
|
4560
4626
|
}).merge(SubmitFixesBaseResponseMessageZ);
|
|
4561
|
-
var SubmitFixesResponseMessageZ =
|
|
4627
|
+
var SubmitFixesResponseMessageZ = z14.discriminatedUnion("type", [
|
|
4562
4628
|
SubmitFixesToSameBranchResponseMessageZ,
|
|
4563
4629
|
SubmitFixesToDifferentBranchResponseMessageZ
|
|
4564
4630
|
]);
|
|
@@ -4576,21 +4642,21 @@ var isValidBranchName = async (branchName) => {
|
|
|
4576
4642
|
return false;
|
|
4577
4643
|
}
|
|
4578
4644
|
};
|
|
4579
|
-
var FixesZ =
|
|
4580
|
-
|
|
4581
|
-
fixId:
|
|
4582
|
-
patches:
|
|
4645
|
+
var FixesZ = z15.array(
|
|
4646
|
+
z15.object({
|
|
4647
|
+
fixId: z15.string(),
|
|
4648
|
+
patches: z15.array(z15.string())
|
|
4583
4649
|
})
|
|
4584
4650
|
).nonempty();
|
|
4585
4651
|
|
|
4586
4652
|
// src/features/analysis/scm/scm.ts
|
|
4587
4653
|
function isBrokerUrl(url) {
|
|
4588
|
-
return
|
|
4654
|
+
return z16.string().uuid().safeParse(new URL(url).host).success;
|
|
4589
4655
|
}
|
|
4590
|
-
var GetRefererenceResultZ =
|
|
4591
|
-
date:
|
|
4592
|
-
sha:
|
|
4593
|
-
type:
|
|
4656
|
+
var GetRefererenceResultZ = z16.object({
|
|
4657
|
+
date: z16.date().optional(),
|
|
4658
|
+
sha: z16.string(),
|
|
4659
|
+
type: z16.nativeEnum(ReferenceType)
|
|
4594
4660
|
});
|
|
4595
4661
|
function getCloudScmLibTypeFromUrl(url) {
|
|
4596
4662
|
if (!url) {
|
|
@@ -4631,7 +4697,7 @@ var scmTypeToScmLibScmType = {
|
|
|
4631
4697
|
["Bitbucket" /* Bitbucket */]: "BITBUCKET" /* BITBUCKET */
|
|
4632
4698
|
};
|
|
4633
4699
|
function getScmLibTypeFromScmType(scmType) {
|
|
4634
|
-
const parsedScmType =
|
|
4700
|
+
const parsedScmType = z16.nativeEnum(ScmType).parse(scmType);
|
|
4635
4701
|
return scmTypeToScmLibScmType[parsedScmType];
|
|
4636
4702
|
}
|
|
4637
4703
|
function getScmConfig({
|
|
@@ -4845,7 +4911,7 @@ var SCMLib = class {
|
|
|
4845
4911
|
if (e instanceof InvalidRepoUrlError && url) {
|
|
4846
4912
|
throw new RepoNoTokenAccessError(
|
|
4847
4913
|
"no access to repo",
|
|
4848
|
-
scmLibScmTypeToScmType[
|
|
4914
|
+
scmLibScmTypeToScmType[z16.nativeEnum(ScmLibScmType).parse(scmType)]
|
|
4849
4915
|
);
|
|
4850
4916
|
}
|
|
4851
4917
|
console.error(`error validating scm: ${scmType} `, e);
|
|
@@ -5015,6 +5081,14 @@ var AdoSCMLib = class extends SCMLib {
|
|
|
5015
5081
|
prNumber
|
|
5016
5082
|
});
|
|
5017
5083
|
}
|
|
5084
|
+
async getCommitUrl(commitId) {
|
|
5085
|
+
this._validateUrl();
|
|
5086
|
+
const adoSdk = await this.getAdoSdk();
|
|
5087
|
+
return adoSdk.getAdoCommitUrl({
|
|
5088
|
+
url: this.url,
|
|
5089
|
+
commitId
|
|
5090
|
+
});
|
|
5091
|
+
}
|
|
5018
5092
|
};
|
|
5019
5093
|
var GitlabSCMLib = class extends SCMLib {
|
|
5020
5094
|
async createSubmitRequest(params) {
|
|
@@ -5152,6 +5226,15 @@ var GitlabSCMLib = class extends SCMLib {
|
|
|
5152
5226
|
});
|
|
5153
5227
|
return res.web_url;
|
|
5154
5228
|
}
|
|
5229
|
+
async getCommitUrl(commitId) {
|
|
5230
|
+
this._validateAccessTokenAndUrl();
|
|
5231
|
+
const res = await getGitlabCommitUrl({
|
|
5232
|
+
url: this.url,
|
|
5233
|
+
commitSha: commitId,
|
|
5234
|
+
accessToken: this.accessToken
|
|
5235
|
+
});
|
|
5236
|
+
return res.web_url;
|
|
5237
|
+
}
|
|
5155
5238
|
};
|
|
5156
5239
|
var GithubSCMLib = class extends SCMLib {
|
|
5157
5240
|
// we don't always need a url, what's important is that we have an access token
|
|
@@ -5253,7 +5336,7 @@ var GithubSCMLib = class extends SCMLib {
|
|
|
5253
5336
|
owner,
|
|
5254
5337
|
repo
|
|
5255
5338
|
});
|
|
5256
|
-
return
|
|
5339
|
+
return z16.string().parse(prRes.data);
|
|
5257
5340
|
}
|
|
5258
5341
|
async getRepoList(_scmOrg) {
|
|
5259
5342
|
this._validateAccessToken();
|
|
@@ -5344,6 +5427,16 @@ var GithubSCMLib = class extends SCMLib {
|
|
|
5344
5427
|
});
|
|
5345
5428
|
return getPrRes.data.html_url;
|
|
5346
5429
|
}
|
|
5430
|
+
async getCommitUrl(commitId) {
|
|
5431
|
+
this._validateAccessTokenAndUrl();
|
|
5432
|
+
const { owner, repo } = parseGithubOwnerAndRepo(this.url);
|
|
5433
|
+
const getCommitRes = await this.githubSdk.getCommit({
|
|
5434
|
+
owner,
|
|
5435
|
+
repo,
|
|
5436
|
+
commitSha: commitId
|
|
5437
|
+
});
|
|
5438
|
+
return getCommitRes.data.html_url;
|
|
5439
|
+
}
|
|
5347
5440
|
async postGeneralPrComment(params) {
|
|
5348
5441
|
const { prNumber, body } = params;
|
|
5349
5442
|
this._validateAccessTokenAndUrl();
|
|
@@ -5438,13 +5531,17 @@ var StubSCMLib = class extends SCMLib {
|
|
|
5438
5531
|
console.error("getPr() not implemented");
|
|
5439
5532
|
throw new Error("getPr() not implemented");
|
|
5440
5533
|
}
|
|
5534
|
+
async getCommitUrl(_commitId) {
|
|
5535
|
+
console.error("getCommitUrl() not implemented");
|
|
5536
|
+
throw new Error("getCommitUrl() not implemented");
|
|
5537
|
+
}
|
|
5441
5538
|
_getUsernameForAuthUrl() {
|
|
5442
5539
|
throw new Error("Method not implemented.");
|
|
5443
5540
|
}
|
|
5444
5541
|
};
|
|
5445
5542
|
function getUserAndPassword(token) {
|
|
5446
5543
|
const [username, password] = token.split(":");
|
|
5447
|
-
const safePasswordAndUsername =
|
|
5544
|
+
const safePasswordAndUsername = z16.object({ username: z16.string(), password: z16.string() }).parse({ username, password });
|
|
5448
5545
|
return {
|
|
5449
5546
|
username: safePasswordAndUsername.username,
|
|
5450
5547
|
password: safePasswordAndUsername.password
|
|
@@ -5480,7 +5577,7 @@ var BitbucketSCMLib = class extends SCMLib {
|
|
|
5480
5577
|
return { username, password, authType };
|
|
5481
5578
|
}
|
|
5482
5579
|
case "token": {
|
|
5483
|
-
return { authType, token:
|
|
5580
|
+
return { authType, token: z16.string().parse(this.accessToken) };
|
|
5484
5581
|
}
|
|
5485
5582
|
case "public":
|
|
5486
5583
|
return { authType };
|
|
@@ -5492,7 +5589,7 @@ var BitbucketSCMLib = class extends SCMLib {
|
|
|
5492
5589
|
...params,
|
|
5493
5590
|
repoUrl: this.url
|
|
5494
5591
|
});
|
|
5495
|
-
return String(
|
|
5592
|
+
return String(z16.number().parse(pullRequestRes.id));
|
|
5496
5593
|
}
|
|
5497
5594
|
async validateParams() {
|
|
5498
5595
|
return validateBitbucketParams({
|
|
@@ -5564,7 +5661,7 @@ var BitbucketSCMLib = class extends SCMLib {
|
|
|
5564
5661
|
async getUsername() {
|
|
5565
5662
|
this._validateAccessToken();
|
|
5566
5663
|
const res = await this.bitbucketSdk.getUser();
|
|
5567
|
-
return
|
|
5664
|
+
return z16.string().parse(res.username);
|
|
5568
5665
|
}
|
|
5569
5666
|
async getSubmitRequestStatus(_scmSubmitRequestId) {
|
|
5570
5667
|
this._validateAccessTokenAndUrl();
|
|
@@ -5593,7 +5690,7 @@ var BitbucketSCMLib = class extends SCMLib {
|
|
|
5593
5690
|
async getRepoDefaultBranch() {
|
|
5594
5691
|
this._validateUrl();
|
|
5595
5692
|
const repoRes = await this.bitbucketSdk.getRepo({ repoUrl: this.url });
|
|
5596
|
-
return
|
|
5693
|
+
return z16.string().parse(repoRes.mainbranch?.name);
|
|
5597
5694
|
}
|
|
5598
5695
|
getPrUrl(prNumber) {
|
|
5599
5696
|
this._validateUrl();
|
|
@@ -5602,39 +5699,46 @@ var BitbucketSCMLib = class extends SCMLib {
|
|
|
5602
5699
|
`https://bitbucket.org/${workspace}/${repoSlug}/pull-requests/${prNumber}`
|
|
5603
5700
|
);
|
|
5604
5701
|
}
|
|
5702
|
+
getCommitUrl(commitId) {
|
|
5703
|
+
this._validateUrl();
|
|
5704
|
+
const { repoSlug, workspace } = parseBitbucketOrganizationAndRepo(this.url);
|
|
5705
|
+
return Promise.resolve(
|
|
5706
|
+
`https://bitbucket.org/${workspace}/${repoSlug}/commits/${commitId}`
|
|
5707
|
+
);
|
|
5708
|
+
}
|
|
5605
5709
|
};
|
|
5606
5710
|
|
|
5607
5711
|
// src/features/analysis/scm/ado/validation.ts
|
|
5608
|
-
import { z as
|
|
5609
|
-
var ValidPullRequestStatusZ =
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5712
|
+
import { z as z17 } from "zod";
|
|
5713
|
+
var ValidPullRequestStatusZ = z17.union([
|
|
5714
|
+
z17.literal(1 /* Active */),
|
|
5715
|
+
z17.literal(2 /* Abandoned */),
|
|
5716
|
+
z17.literal(3 /* Completed */)
|
|
5613
5717
|
]);
|
|
5614
|
-
var AdoAuthResultZ =
|
|
5615
|
-
access_token:
|
|
5616
|
-
token_type:
|
|
5617
|
-
refresh_token:
|
|
5718
|
+
var AdoAuthResultZ = z17.object({
|
|
5719
|
+
access_token: z17.string().min(1),
|
|
5720
|
+
token_type: z17.string().min(1),
|
|
5721
|
+
refresh_token: z17.string().min(1)
|
|
5618
5722
|
});
|
|
5619
5723
|
var AdoAuthResultWithOrgsZ = AdoAuthResultZ.extend({
|
|
5620
|
-
scmOrgs:
|
|
5724
|
+
scmOrgs: z17.array(z17.string())
|
|
5621
5725
|
});
|
|
5622
|
-
var profileZ =
|
|
5623
|
-
displayName:
|
|
5624
|
-
publicAlias:
|
|
5625
|
-
emailAddress:
|
|
5626
|
-
coreRevision:
|
|
5627
|
-
timeStamp:
|
|
5628
|
-
id:
|
|
5629
|
-
revision:
|
|
5726
|
+
var profileZ = z17.object({
|
|
5727
|
+
displayName: z17.string(),
|
|
5728
|
+
publicAlias: z17.string().min(1),
|
|
5729
|
+
emailAddress: z17.string(),
|
|
5730
|
+
coreRevision: z17.number(),
|
|
5731
|
+
timeStamp: z17.string(),
|
|
5732
|
+
id: z17.string(),
|
|
5733
|
+
revision: z17.number()
|
|
5630
5734
|
});
|
|
5631
|
-
var accountsZ =
|
|
5632
|
-
count:
|
|
5633
|
-
value:
|
|
5634
|
-
|
|
5635
|
-
accountId:
|
|
5636
|
-
accountUri:
|
|
5637
|
-
accountName:
|
|
5735
|
+
var accountsZ = z17.object({
|
|
5736
|
+
count: z17.number(),
|
|
5737
|
+
value: z17.array(
|
|
5738
|
+
z17.object({
|
|
5739
|
+
accountId: z17.string(),
|
|
5740
|
+
accountUri: z17.string(),
|
|
5741
|
+
accountName: z17.string()
|
|
5638
5742
|
})
|
|
5639
5743
|
)
|
|
5640
5744
|
});
|
|
@@ -5719,7 +5823,7 @@ async function getAdoConnectData({
|
|
|
5719
5823
|
oauthToken: adoTokenInfo.accessToken
|
|
5720
5824
|
});
|
|
5721
5825
|
return {
|
|
5722
|
-
org:
|
|
5826
|
+
org: z18.string().parse(org),
|
|
5723
5827
|
origin: DEFUALT_ADO_ORIGIN
|
|
5724
5828
|
};
|
|
5725
5829
|
}
|
|
@@ -5805,7 +5909,7 @@ async function getAdoClientParams(params) {
|
|
|
5805
5909
|
return {
|
|
5806
5910
|
tokenType: "PAT" /* PAT */,
|
|
5807
5911
|
accessToken: adoTokenInfo.accessToken,
|
|
5808
|
-
patTokenOrg:
|
|
5912
|
+
patTokenOrg: z18.string().parse(tokenOrg).toLowerCase(),
|
|
5809
5913
|
origin: origin2,
|
|
5810
5914
|
orgName: org.toLowerCase()
|
|
5811
5915
|
};
|
|
@@ -5938,6 +6042,18 @@ async function getAdoSdk(params) {
|
|
|
5938
6042
|
);
|
|
5939
6043
|
return `${getRepositoryRes.webUrl}/pullrequest/${prNumber}`;
|
|
5940
6044
|
},
|
|
6045
|
+
async getAdoCommitUrl({
|
|
6046
|
+
url,
|
|
6047
|
+
commitId
|
|
6048
|
+
}) {
|
|
6049
|
+
const { repo, projectName } = parseAdoOwnerAndRepo(url);
|
|
6050
|
+
const git = await api2.getGitApi();
|
|
6051
|
+
const getRepositoryRes = await git.getRepository(
|
|
6052
|
+
decodeURI(repo),
|
|
6053
|
+
projectName ? decodeURI(projectName) : void 0
|
|
6054
|
+
);
|
|
6055
|
+
return `${getRepositoryRes.webUrl}/commit/${commitId}`;
|
|
6056
|
+
},
|
|
5941
6057
|
getAdoDownloadUrl({
|
|
5942
6058
|
repoUrl,
|
|
5943
6059
|
branch
|
|
@@ -5960,9 +6076,9 @@ async function getAdoSdk(params) {
|
|
|
5960
6076
|
return new URL(`${path9}?${params2}`, origin2).toString();
|
|
5961
6077
|
},
|
|
5962
6078
|
async getAdoBranchList({ repoUrl }) {
|
|
5963
|
-
const { repo, projectName } = parseAdoOwnerAndRepo(repoUrl);
|
|
5964
|
-
const git = await api2.getGitApi();
|
|
5965
6079
|
try {
|
|
6080
|
+
const { repo, projectName } = parseAdoOwnerAndRepo(repoUrl);
|
|
6081
|
+
const git = await api2.getGitApi();
|
|
5966
6082
|
const res = await git.getBranches(repo, projectName);
|
|
5967
6083
|
res.sort((a, b) => {
|
|
5968
6084
|
if (!a.commit?.committer?.date || !b.commit?.committer?.date) {
|
|
@@ -5976,7 +6092,7 @@ async function getAdoSdk(params) {
|
|
|
5976
6092
|
}
|
|
5977
6093
|
acc.push(branch.name);
|
|
5978
6094
|
return acc;
|
|
5979
|
-
}, []);
|
|
6095
|
+
}, []).slice(0, MAX_BRANCHES_FETCH);
|
|
5980
6096
|
} catch (e) {
|
|
5981
6097
|
return [];
|
|
5982
6098
|
}
|
|
@@ -6172,13 +6288,10 @@ async function getAdoRepoList({
|
|
|
6172
6288
|
return repos;
|
|
6173
6289
|
}
|
|
6174
6290
|
|
|
6175
|
-
// src/features/analysis/scm/constants.ts
|
|
6176
|
-
var MOBB_ICON_IMG = "https://app.mobb.ai/gh-action/Logo_Rounded_Icon.svg";
|
|
6177
|
-
|
|
6178
6291
|
// src/features/analysis/add_fix_comments_for_pr/utils/utils.ts
|
|
6179
6292
|
import Debug6 from "debug";
|
|
6180
6293
|
import parseDiff2 from "parse-diff";
|
|
6181
|
-
import { z as
|
|
6294
|
+
import { z as z20 } from "zod";
|
|
6182
6295
|
|
|
6183
6296
|
// src/features/analysis/utils/by_key.ts
|
|
6184
6297
|
function keyBy(array, keyBy2) {
|
|
@@ -6249,7 +6362,7 @@ var scannerToFriendlyString = {
|
|
|
6249
6362
|
|
|
6250
6363
|
// src/features/analysis/add_fix_comments_for_pr/utils/buildCommentBody.ts
|
|
6251
6364
|
import Debug5 from "debug";
|
|
6252
|
-
import { z as
|
|
6365
|
+
import { z as z19 } from "zod";
|
|
6253
6366
|
var debug5 = Debug5("mobbdev:handle-finished-analysis");
|
|
6254
6367
|
var getCommitFixButton = (commitUrl) => `<a href="${commitUrl}"><img src=${COMMIT_FIX_SVG}></a>`;
|
|
6255
6368
|
function buildCommentBody({
|
|
@@ -6283,11 +6396,11 @@ function buildCommentBody({
|
|
|
6283
6396
|
});
|
|
6284
6397
|
const issueType = getIssueTypeFriendlyString(fix.safeIssueType);
|
|
6285
6398
|
const title = `# ${MobbIconMarkdown} ${issueType} fix is ready`;
|
|
6286
|
-
const validFixParseRes =
|
|
6399
|
+
const validFixParseRes = z19.object({
|
|
6287
6400
|
patchAndQuestions: PatchAndQuestionsZ,
|
|
6288
|
-
vulnerabilitySeverity:
|
|
6289
|
-
safeIssueLanguage:
|
|
6290
|
-
safeIssueType:
|
|
6401
|
+
vulnerabilitySeverity: z19.nativeEnum(Vulnerability_Severity_Enum),
|
|
6402
|
+
safeIssueLanguage: z19.nativeEnum(IssueLanguage_Enum),
|
|
6403
|
+
safeIssueType: z19.nativeEnum(IssueType_Enum)
|
|
6291
6404
|
}).safeParse(fix);
|
|
6292
6405
|
if (!validFixParseRes.success) {
|
|
6293
6406
|
debug5(
|
|
@@ -6460,7 +6573,7 @@ async function getRelevantVulenrabilitiesFromDiff(params) {
|
|
|
6460
6573
|
});
|
|
6461
6574
|
const lineAddedRanges = calculateRanges(fileNumbers);
|
|
6462
6575
|
const fileFilter = {
|
|
6463
|
-
path:
|
|
6576
|
+
path: z20.string().parse(file.to),
|
|
6464
6577
|
ranges: lineAddedRanges.map(([startLine, endLine]) => ({
|
|
6465
6578
|
endLine,
|
|
6466
6579
|
startLine
|
|
@@ -6805,30 +6918,30 @@ function subscribe(query, variables, callback, wsClientOptions) {
|
|
|
6805
6918
|
}
|
|
6806
6919
|
|
|
6807
6920
|
// src/features/analysis/graphql/types.ts
|
|
6808
|
-
import { z as
|
|
6809
|
-
var VulnerabilityReportIssueCodeNodeZ =
|
|
6810
|
-
vulnerabilityReportIssueId:
|
|
6811
|
-
path:
|
|
6812
|
-
startLine:
|
|
6813
|
-
vulnerabilityReportIssue:
|
|
6814
|
-
fixId:
|
|
6921
|
+
import { z as z21 } from "zod";
|
|
6922
|
+
var VulnerabilityReportIssueCodeNodeZ = z21.object({
|
|
6923
|
+
vulnerabilityReportIssueId: z21.string(),
|
|
6924
|
+
path: z21.string(),
|
|
6925
|
+
startLine: z21.number(),
|
|
6926
|
+
vulnerabilityReportIssue: z21.object({
|
|
6927
|
+
fixId: z21.string()
|
|
6815
6928
|
})
|
|
6816
6929
|
});
|
|
6817
|
-
var GetVulByNodesMetadataZ =
|
|
6818
|
-
vulnerabilityReportIssueCodeNodes:
|
|
6819
|
-
nonFixablePrVuls:
|
|
6820
|
-
aggregate:
|
|
6821
|
-
count:
|
|
6930
|
+
var GetVulByNodesMetadataZ = z21.object({
|
|
6931
|
+
vulnerabilityReportIssueCodeNodes: z21.array(VulnerabilityReportIssueCodeNodeZ),
|
|
6932
|
+
nonFixablePrVuls: z21.object({
|
|
6933
|
+
aggregate: z21.object({
|
|
6934
|
+
count: z21.number()
|
|
6822
6935
|
})
|
|
6823
6936
|
}),
|
|
6824
|
-
fixablePrVuls:
|
|
6825
|
-
aggregate:
|
|
6826
|
-
count:
|
|
6937
|
+
fixablePrVuls: z21.object({
|
|
6938
|
+
aggregate: z21.object({
|
|
6939
|
+
count: z21.number()
|
|
6827
6940
|
})
|
|
6828
6941
|
}),
|
|
6829
|
-
totalScanVulnerabilities:
|
|
6830
|
-
aggregate:
|
|
6831
|
-
count:
|
|
6942
|
+
totalScanVulnerabilities: z21.object({
|
|
6943
|
+
aggregate: z21.object({
|
|
6944
|
+
count: z21.number()
|
|
6832
6945
|
})
|
|
6833
6946
|
})
|
|
6834
6947
|
});
|
|
@@ -7842,7 +7955,7 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
7842
7955
|
spinner: mobbSpinner,
|
|
7843
7956
|
submitVulnerabilityReportVariables: {
|
|
7844
7957
|
fixReportId: reportUploadInfo.fixReportId,
|
|
7845
|
-
repoUrl:
|
|
7958
|
+
repoUrl: z22.string().parse(repo),
|
|
7846
7959
|
reference,
|
|
7847
7960
|
projectId,
|
|
7848
7961
|
vulnerabilityReportFileName: "report.json",
|
|
@@ -8081,9 +8194,9 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
8081
8194
|
}
|
|
8082
8195
|
});
|
|
8083
8196
|
if (command === "review") {
|
|
8084
|
-
const params2 =
|
|
8085
|
-
repo:
|
|
8086
|
-
githubActionToken:
|
|
8197
|
+
const params2 = z22.object({
|
|
8198
|
+
repo: z22.string().url(),
|
|
8199
|
+
githubActionToken: z22.string()
|
|
8087
8200
|
}).parse({ repo, githubActionToken });
|
|
8088
8201
|
const scm = await SCMLib.init(
|
|
8089
8202
|
{
|
|
@@ -8105,7 +8218,7 @@ async function _scan(params, { skipPrompts = false } = {}) {
|
|
|
8105
8218
|
analysisId,
|
|
8106
8219
|
gqlClient,
|
|
8107
8220
|
scm,
|
|
8108
|
-
scanner:
|
|
8221
|
+
scanner: z22.nativeEnum(SCANNERS).parse(scanner)
|
|
8109
8222
|
});
|
|
8110
8223
|
},
|
|
8111
8224
|
callbackStates: ["Finished" /* Finished */]
|
|
@@ -8332,7 +8445,7 @@ var scmTokenOption = {
|
|
|
8332
8445
|
// src/args/validation.ts
|
|
8333
8446
|
import chalk6 from "chalk";
|
|
8334
8447
|
import path8 from "path";
|
|
8335
|
-
import { z as
|
|
8448
|
+
import { z as z23 } from "zod";
|
|
8336
8449
|
function throwRepoUrlErrorMessage({
|
|
8337
8450
|
error,
|
|
8338
8451
|
repoUrl,
|
|
@@ -8349,13 +8462,13 @@ Example:
|
|
|
8349
8462
|
)}`;
|
|
8350
8463
|
throw new CliError(formattedErrorMessage);
|
|
8351
8464
|
}
|
|
8352
|
-
var UrlZ =
|
|
8465
|
+
var UrlZ = z23.string({
|
|
8353
8466
|
invalid_type_error: `is not a valid ${Object.values(ScmType).join("/ ")} URL`
|
|
8354
8467
|
}).refine((data) => !!sanityRepoURL(data), {
|
|
8355
8468
|
message: `is not a valid ${Object.values(ScmType).join(" / ")} URL`
|
|
8356
8469
|
});
|
|
8357
8470
|
function validateOrganizationId(organizationId) {
|
|
8358
|
-
const orgIdValidation =
|
|
8471
|
+
const orgIdValidation = z23.string().uuid().nullish().safeParse(organizationId);
|
|
8359
8472
|
if (!orgIdValidation.success) {
|
|
8360
8473
|
throw new CliError(`organizationId: ${organizationId} is not a valid UUID`);
|
|
8361
8474
|
}
|
|
@@ -8563,13 +8676,6 @@ var parseArgs = async (args) => {
|
|
|
8563
8676
|
)} ${chalk9.dim("[options]")}
|
|
8564
8677
|
`
|
|
8565
8678
|
).version(false).command(
|
|
8566
|
-
mobbCliCommand.addScmToken,
|
|
8567
|
-
chalk9.bold(
|
|
8568
|
-
"Add your SCM (Github, Gitlab, Azure DevOps) token to Mobb to enable automated fixes."
|
|
8569
|
-
),
|
|
8570
|
-
addScmTokenBuilder,
|
|
8571
|
-
addScmTokenHandler
|
|
8572
|
-
).command(
|
|
8573
8679
|
mobbCliCommand.scan,
|
|
8574
8680
|
chalk9.bold(
|
|
8575
8681
|
"Scan your code for vulnerabilities, get automated fixes right away."
|
|
@@ -8586,10 +8692,17 @@ var parseArgs = async (args) => {
|
|
|
8586
8692
|
).command(
|
|
8587
8693
|
mobbCliCommand.review,
|
|
8588
8694
|
chalk9.bold(
|
|
8589
|
-
"
|
|
8695
|
+
"Mobb will review your github pull requests and provide comments with fixes "
|
|
8590
8696
|
),
|
|
8591
8697
|
reviewBuilder,
|
|
8592
8698
|
reviewHandler
|
|
8699
|
+
).command(
|
|
8700
|
+
mobbCliCommand.addScmToken,
|
|
8701
|
+
chalk9.bold(
|
|
8702
|
+
"Add your SCM (Github, Gitlab, Azure DevOps) token to Mobb to enable automated fixes."
|
|
8703
|
+
),
|
|
8704
|
+
addScmTokenBuilder,
|
|
8705
|
+
addScmTokenHandler
|
|
8593
8706
|
).example(
|
|
8594
8707
|
"$0 scan -r https://github.com/WebGoat/WebGoat",
|
|
8595
8708
|
"Scan an existing repository"
|