feature: gitlab secret scanning

This commit is contained in:
Scott Wilson
2025-07-28 15:03:23 -07:00
parent 7d1bc86702
commit f2b0e4ae37
68 changed files with 1711 additions and 94 deletions
@@ -137,7 +137,7 @@ const CreateForm = ({ app, onComplete }: CreateFormProps) => {
return <RenderConnectionForm onSubmit={onSubmit} />;
case AppConnection.Flyio:
return <FlyioConnectionForm onSubmit={onSubmit} />;
case AppConnection.Gitlab:
case AppConnection.GitLab:
return <GitLabConnectionForm onSubmit={onSubmit} />;
case AppConnection.Cloudflare:
return <CloudflareConnectionForm onSubmit={onSubmit} />;
@@ -245,7 +245,7 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {
return <RenderConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.Flyio:
return <FlyioConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.Gitlab:
case AppConnection.GitLab:
return <GitLabConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.Cloudflare:
return <CloudflareConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
@@ -38,7 +38,7 @@ type Props = {
const formSchema = z.discriminatedUnion("method", [
genericAppConnectionFieldsSchema.extend({
app: z.literal(AppConnection.Gitlab),
app: z.literal(AppConnection.GitLab),
method: z.literal(GitLabConnectionMethod.AccessToken),
credentials: z.object({
accessToken: z.string().min(1, "Access token is required"),
@@ -54,7 +54,7 @@ const formSchema = z.discriminatedUnion("method", [
})
}),
genericAppConnectionFieldsSchema.extend({
app: z.literal(AppConnection.Gitlab),
app: z.literal(AppConnection.GitLab),
method: z.literal(GitLabConnectionMethod.OAuth),
credentials: z.object({
code: z.string().min(1, "Code is required"),
@@ -79,7 +79,7 @@ export const GitLabConnectionForm = ({ appConnection, onSubmit: formSubmit }: Pr
const {
option: { oauthClientId },
isLoading
} = useGetAppConnectionOption(AppConnection.Gitlab);
} = useGetAppConnectionOption(AppConnection.GitLab);
const form = useForm<FormData>({
resolver: zodResolver(formSchema),
@@ -88,7 +88,7 @@ export const GitLabConnectionForm = ({ appConnection, onSubmit: formSubmit }: Pr
? { ...appConnection, credentials: { code: "custom" } }
: (appConnection ??
({
app: AppConnection.Gitlab,
app: AppConnection.GitLab,
method: GitLabConnectionMethod.AccessToken,
credentials: {
accessToken: "",
@@ -207,7 +207,7 @@ export const GitLabConnectionForm = ({ appConnection, onSubmit: formSubmit }: Pr
render={({ field: { value, onChange }, fieldState: { error } }) => (
<FormControl
tooltipText={`The method you would like to use to connect with ${
APP_CONNECTION_MAP[AppConnection.Gitlab].name
APP_CONNECTION_MAP[AppConnection.GitLab].name
}. This field cannot be changed after creation.`}
errorText={
!isLoading && isMissingConfig && selectedMethod === GitLabConnectionMethod.OAuth
@@ -65,7 +65,7 @@ type AzureDevOpsFormData = BaseFormData &
type FormDataMap = {
[AppConnection.GitHub]: GithubFormData & { app: AppConnection.GitHub };
[AppConnection.GitHubRadar]: GithubRadarFormData & { app: AppConnection.GitHubRadar };
[AppConnection.Gitlab]: GitLabFormData & { app: AppConnection.Gitlab };
[AppConnection.GitLab]: GitLabFormData & { app: AppConnection.GitLab };
[AppConnection.AzureKeyVault]: AzureKeyVaultFormData & { app: AppConnection.AzureKeyVault };
[AppConnection.AzureAppConfiguration]: AzureAppConfigurationFormData & {
app: AppConnection.AzureAppConfiguration;
@@ -81,7 +81,7 @@ type FormDataMap = {
const formDataStorageFieldMap: Partial<Record<AppConnection, string>> = {
[AppConnection.GitHub]: "githubConnectionFormData",
[AppConnection.GitHubRadar]: "githubRadarConnectionFormData",
[AppConnection.Gitlab]: "gitlabConnectionFormData",
[AppConnection.GitLab]: "gitlabConnectionFormData",
[AppConnection.AzureKeyVault]: "azureKeyVaultConnectionFormData",
[AppConnection.AzureAppConfiguration]: "azureAppConfigurationConnectionFormData",
[AppConnection.AzureClientSecrets]: "azureClientSecretsConnectionFormData",
@@ -141,17 +141,17 @@ export const OAuthCallbackPage = () => {
};
const handleGitlab = useCallback(async () => {
const formData = getFormData(AppConnection.Gitlab);
const formData = getFormData(AppConnection.GitLab);
if (formData === null) return null;
clearState(AppConnection.Gitlab);
clearState(AppConnection.GitLab);
const { connectionId, name, description, returnUrl, isUpdate } = formData;
try {
if (isUpdate && connectionId) {
await updateAppConnection.mutateAsync({
app: AppConnection.Gitlab,
app: AppConnection.GitLab,
connectionId,
credentials: {
code: code as string
@@ -159,7 +159,7 @@ export const OAuthCallbackPage = () => {
});
} else {
await createAppConnection.mutateAsync({
app: AppConnection.Gitlab,
app: AppConnection.GitLab,
name,
description,
method: GitLabConnectionMethod.OAuth,
@@ -521,7 +521,7 @@ export const OAuthCallbackPage = () => {
data = await handleGithub();
} else if (appConnection === AppConnection.GitHubRadar) {
data = await handleGithubRadar();
} else if (appConnection === AppConnection.Gitlab) {
} else if (appConnection === AppConnection.GitLab) {
data = await handleGitlab();
} else if (appConnection === AppConnection.AzureKeyVault) {
data = await handleAzureKeyVault();