mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 14:26:38 +00:00
improvements: address feedback
This commit is contained in:
@@ -42,7 +42,9 @@ export const GitHubSecretScanningFactory = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (existingDataSource)
|
if (existingDataSource)
|
||||||
throw new BadRequestError({ message: "A Data Source already exists for this GitHub Radar Connection" });
|
throw new BadRequestError({
|
||||||
|
message: `A Data Source already exists for this GitHub Radar Connection in the Project with ID "${existingDataSource.projectId}"`
|
||||||
|
});
|
||||||
|
|
||||||
return callback({
|
return callback({
|
||||||
externalId
|
externalId
|
||||||
|
|||||||
@@ -17,9 +17,15 @@ import { AppConnection } from "@app/services/app-connection/app-connection-enums
|
|||||||
|
|
||||||
export const GitHubDataSourceConfigSchema = z.object({
|
export const GitHubDataSourceConfigSchema = z.object({
|
||||||
includeRepos: z
|
includeRepos: z
|
||||||
.array(z.string().regex(GitHubRepositoryRegex, "Invalid repository name format").min(1).max(256))
|
.array(
|
||||||
|
z
|
||||||
|
.string()
|
||||||
|
.min(1)
|
||||||
|
.max(256)
|
||||||
|
.refine((value) => value === "*" || GitHubRepositoryRegex.test(value), "Invalid repository name format")
|
||||||
|
)
|
||||||
.nonempty("One or more repositories required")
|
.nonempty("One or more repositories required")
|
||||||
.max(25)
|
.max(100, "Cannot configure more than 100 repositories")
|
||||||
.default(["*"])
|
.default(["*"])
|
||||||
.describe(SecretScanningDataSources.CONFIG.GITHUB.includeRepos)
|
.describe(SecretScanningDataSources.CONFIG.GITHUB.includeRepos)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export const convertPatchLineToFileLineNumber = (patch: string, patchLineNumber:
|
|||||||
currentPatchLine += 1;
|
currentPatchLine += 1;
|
||||||
|
|
||||||
// Hunk header: @@ -a,b +c,d @@
|
// Hunk header: @@ -a,b +c,d @@
|
||||||
const hunkHeaderMatch = line.match(HunkHeaderRegex);
|
const hunkHeaderMatch = HunkHeaderRegex.match(line);
|
||||||
if (hunkHeaderMatch) {
|
if (hunkHeaderMatch) {
|
||||||
const startLine = parseInt(hunkHeaderMatch[1], 10);
|
const startLine = parseInt(hunkHeaderMatch[1], 10);
|
||||||
currentNewLine = startLine;
|
currentNewLine = startLine;
|
||||||
|
|||||||
@@ -13,7 +13,12 @@ import { LdapConnectionMethod, LdapProvider } from "./ldap-connection-enums";
|
|||||||
|
|
||||||
export const LdapConnectionSimpleBindCredentialsSchema = z.object({
|
export const LdapConnectionSimpleBindCredentialsSchema = z.object({
|
||||||
provider: z.nativeEnum(LdapProvider).describe(AppConnections.CREDENTIALS.LDAP.provider),
|
provider: z.nativeEnum(LdapProvider).describe(AppConnections.CREDENTIALS.LDAP.provider),
|
||||||
url: z.string().trim().min(1, "URL required").regex(LdapUrlRegex).describe(AppConnections.CREDENTIALS.LDAP.url),
|
url: z
|
||||||
|
.string()
|
||||||
|
.trim()
|
||||||
|
.min(1, "URL required")
|
||||||
|
.refine((value) => LdapUrlRegex.test(value), "Invalid LDAP URL")
|
||||||
|
.describe(AppConnections.CREDENTIALS.LDAP.url),
|
||||||
dn: z
|
dn: z
|
||||||
.string()
|
.string()
|
||||||
.trim()
|
.trim()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const GitHubDataSourceSchema = z
|
|||||||
.string()
|
.string()
|
||||||
.array()
|
.array()
|
||||||
.min(1, "One or more repositories required")
|
.min(1, "One or more repositories required")
|
||||||
.max(25, "Cannot configure more than 25 repositories")
|
.max(100, "Cannot configure more than 100 repositories")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.merge(BaseSecretScanningDataSourceSchema({ isConnectionRequired: true }));
|
.merge(BaseSecretScanningDataSourceSchema({ isConnectionRequired: true }));
|
||||||
|
|||||||
Reference in New Issue
Block a user