mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 18:27:36 +00:00
Rename GitHubRepositoryRegex
This commit is contained in:
+3
-3
@@ -23,8 +23,9 @@ import {
|
|||||||
import { getConfig } from "@app/lib/config/env";
|
import { getConfig } from "@app/lib/config/env";
|
||||||
import { request } from "@app/lib/config/request";
|
import { request } from "@app/lib/config/request";
|
||||||
import { titleCaseToCamelCase } from "@app/lib/fn";
|
import { titleCaseToCamelCase } from "@app/lib/fn";
|
||||||
|
import { logger } from "@app/lib/logger";
|
||||||
import { alphaNumericNanoId } from "@app/lib/nanoid";
|
import { alphaNumericNanoId } from "@app/lib/nanoid";
|
||||||
import { GitHubRepositoryRegex } from "@app/lib/regex";
|
import { BasicRepositoryRegex } from "@app/lib/regex";
|
||||||
import {
|
import {
|
||||||
getBitbucketUser,
|
getBitbucketUser,
|
||||||
listBitbucketRepositories,
|
listBitbucketRepositories,
|
||||||
@@ -38,7 +39,6 @@ import {
|
|||||||
TBitbucketDataSourceWithConnection,
|
TBitbucketDataSourceWithConnection,
|
||||||
TQueueBitbucketResourceDiffScan
|
TQueueBitbucketResourceDiffScan
|
||||||
} from "./bitbucket-secret-scanning-types";
|
} from "./bitbucket-secret-scanning-types";
|
||||||
import { logger } from "@app/lib/logger";
|
|
||||||
|
|
||||||
export const BitbucketSecretScanningFactory = () => {
|
export const BitbucketSecretScanningFactory = () => {
|
||||||
const initialize: TSecretScanningFactoryInitialize<
|
const initialize: TSecretScanningFactoryInitialize<
|
||||||
@@ -169,7 +169,7 @@ export const BitbucketSecretScanningFactory = () => {
|
|||||||
|
|
||||||
const repoPath = join(tempFolder, "repo.git");
|
const repoPath = join(tempFolder, "repo.git");
|
||||||
|
|
||||||
if (!GitHubRepositoryRegex.test(resourceName)) {
|
if (!BasicRepositoryRegex.test(resourceName)) {
|
||||||
throw new Error("Invalid Bitbucket repository name");
|
throw new Error("Invalid Bitbucket repository name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -12,7 +12,7 @@ import {
|
|||||||
GitRepositoryScanFindingDetailsSchema
|
GitRepositoryScanFindingDetailsSchema
|
||||||
} from "@app/ee/services/secret-scanning-v2/secret-scanning-v2-schemas";
|
} from "@app/ee/services/secret-scanning-v2/secret-scanning-v2-schemas";
|
||||||
import { SecretScanningDataSources } from "@app/lib/api-docs";
|
import { SecretScanningDataSources } from "@app/lib/api-docs";
|
||||||
import { GitHubRepositoryRegex } from "@app/lib/regex";
|
import { BasicRepositoryRegex } from "@app/lib/regex";
|
||||||
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||||
|
|
||||||
export const BitbucketDataSourceConfigSchema = z.object({
|
export const BitbucketDataSourceConfigSchema = z.object({
|
||||||
@@ -27,7 +27,7 @@ export const BitbucketDataSourceConfigSchema = z.object({
|
|||||||
.string()
|
.string()
|
||||||
.min(1)
|
.min(1)
|
||||||
.max(256)
|
.max(256)
|
||||||
.refine((value) => value === "*" || GitHubRepositoryRegex.test(value), "Invalid repository name format")
|
.refine((value) => value === "*" || BasicRepositoryRegex.test(value), "Invalid repository name format")
|
||||||
)
|
)
|
||||||
.nonempty("One or more repositories required")
|
.nonempty("One or more repositories required")
|
||||||
.max(100, "Cannot configure more than 100 repositories")
|
.max(100, "Cannot configure more than 100 repositories")
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import {
|
|||||||
import { getConfig } from "@app/lib/config/env";
|
import { getConfig } from "@app/lib/config/env";
|
||||||
import { BadRequestError } from "@app/lib/errors";
|
import { BadRequestError } from "@app/lib/errors";
|
||||||
import { titleCaseToCamelCase } from "@app/lib/fn";
|
import { titleCaseToCamelCase } from "@app/lib/fn";
|
||||||
import { GitHubRepositoryRegex } from "@app/lib/regex";
|
import { BasicRepositoryRegex } from "@app/lib/regex";
|
||||||
import { listGitHubRadarRepositories, TGitHubRadarConnection } from "@app/services/app-connection/github-radar";
|
import { listGitHubRadarRepositories, TGitHubRadarConnection } from "@app/services/app-connection/github-radar";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -119,7 +119,7 @@ export const GitHubSecretScanningFactory = () => {
|
|||||||
|
|
||||||
const repoPath = join(tempFolder, "repo.git");
|
const repoPath = join(tempFolder, "repo.git");
|
||||||
|
|
||||||
if (!GitHubRepositoryRegex.test(resourceName)) {
|
if (!BasicRepositoryRegex.test(resourceName)) {
|
||||||
throw new Error("Invalid GitHub repository name");
|
throw new Error("Invalid GitHub repository name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
GitRepositoryScanFindingDetailsSchema
|
GitRepositoryScanFindingDetailsSchema
|
||||||
} from "@app/ee/services/secret-scanning-v2/secret-scanning-v2-schemas";
|
} from "@app/ee/services/secret-scanning-v2/secret-scanning-v2-schemas";
|
||||||
import { SecretScanningDataSources } from "@app/lib/api-docs";
|
import { SecretScanningDataSources } from "@app/lib/api-docs";
|
||||||
import { GitHubRepositoryRegex } from "@app/lib/regex";
|
import { BasicRepositoryRegex } from "@app/lib/regex";
|
||||||
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||||
|
|
||||||
export const GitHubDataSourceConfigSchema = z.object({
|
export const GitHubDataSourceConfigSchema = z.object({
|
||||||
@@ -22,7 +22,7 @@ export const GitHubDataSourceConfigSchema = z.object({
|
|||||||
.string()
|
.string()
|
||||||
.min(1)
|
.min(1)
|
||||||
.max(256)
|
.max(256)
|
||||||
.refine((value) => value === "*" || GitHubRepositoryRegex.test(value), "Invalid repository name format")
|
.refine((value) => value === "*" || BasicRepositoryRegex.test(value), "Invalid repository name format")
|
||||||
)
|
)
|
||||||
.nonempty("One or more repositories required")
|
.nonempty("One or more repositories required")
|
||||||
.max(100, "Cannot configure more than 100 repositories")
|
.max(100, "Cannot configure more than 100 repositories")
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ export const UserPrincipalNameRegex = new RE2(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9._-]
|
|||||||
|
|
||||||
export const LdapUrlRegex = new RE2(/^ldaps?:\/\//);
|
export const LdapUrlRegex = new RE2(/^ldaps?:\/\//);
|
||||||
|
|
||||||
export const GitHubRepositoryRegex = new RE2(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/);
|
export const BasicRepositoryRegex = new RE2(/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/);
|
||||||
|
|||||||
Reference in New Issue
Block a user