-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3039 from Infisical/feat/gcp-secret-sync
feat: gcp app connections and secret sync
- Loading branch information
Showing
94 changed files
with
1,555 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
backend/src/server/routes/v1/app-connection-routers/gcp-connection-router.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import z from "zod"; | ||
|
||
import { readLimit } from "@app/server/config/rateLimiter"; | ||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth"; | ||
import { AppConnection } from "@app/services/app-connection/app-connection-enums"; | ||
import { | ||
CreateGcpConnectionSchema, | ||
SanitizedGcpConnectionSchema, | ||
UpdateGcpConnectionSchema | ||
} from "@app/services/app-connection/gcp"; | ||
import { AuthMode } from "@app/services/auth/auth-type"; | ||
|
||
import { registerAppConnectionEndpoints } from "./app-connection-endpoints"; | ||
|
||
export const registerGcpConnectionRouter = async (server: FastifyZodProvider) => { | ||
registerAppConnectionEndpoints({ | ||
app: AppConnection.GCP, | ||
server, | ||
sanitizedResponseSchema: SanitizedGcpConnectionSchema, | ||
createSchema: CreateGcpConnectionSchema, | ||
updateSchema: UpdateGcpConnectionSchema | ||
}); | ||
|
||
// The below endpoints are not exposed and for Infisical App use | ||
server.route({ | ||
method: "GET", | ||
url: `/:connectionId/secret-manager-projects`, | ||
config: { | ||
rateLimit: readLimit | ||
}, | ||
schema: { | ||
params: z.object({ | ||
connectionId: z.string().uuid() | ||
}), | ||
response: { | ||
200: z.object({ id: z.string(), name: z.string() }).array() | ||
} | ||
}, | ||
onRequest: verifyAuth([AuthMode.JWT]), | ||
handler: async (req) => { | ||
const { connectionId } = req.params; | ||
|
||
const projects = await server.services.appConnection.gcp.listSecretManagerProjects(connectionId, req.permission); | ||
|
||
return projects; | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { AppConnection } from "@app/services/app-connection/app-connection-enums"; | ||
|
||
import { registerAwsConnectionRouter } from "./aws-connection-router"; | ||
import { registerGcpConnectionRouter } from "./gcp-connection-router"; | ||
import { registerGitHubConnectionRouter } from "./github-connection-router"; | ||
|
||
export * from "./app-connection-router"; | ||
|
||
export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server: FastifyZodProvider) => Promise<void>> = | ||
{ | ||
[AppConnection.AWS]: registerAwsConnectionRouter, | ||
[AppConnection.GitHub]: registerGitHubConnectionRouter | ||
[AppConnection.GitHub]: registerGitHubConnectionRouter, | ||
[AppConnection.GCP]: registerGcpConnectionRouter | ||
}; |
13 changes: 13 additions & 0 deletions
13
backend/src/server/routes/v1/secret-sync-routers/gcp-sync-router.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { CreateGcpSyncSchema, GcpSyncSchema, UpdateGcpSyncSchema } from "@app/services/secret-sync/gcp"; | ||
import { SecretSync } from "@app/services/secret-sync/secret-sync-enums"; | ||
|
||
import { registerSyncSecretsEndpoints } from "./secret-sync-endpoints"; | ||
|
||
export const registerGcpSyncRouter = async (server: FastifyZodProvider) => | ||
registerSyncSecretsEndpoints({ | ||
destination: SecretSync.GCPSecretManager, | ||
server, | ||
responseSchema: GcpSyncSchema, | ||
createSchema: CreateGcpSyncSchema, | ||
updateSchema: UpdateGcpSyncSchema | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import { SecretSync } from "@app/services/secret-sync/secret-sync-enums"; | ||
|
||
import { registerAwsParameterStoreSyncRouter } from "./aws-parameter-store-sync-router"; | ||
import { registerGcpSyncRouter } from "./gcp-sync-router"; | ||
import { registerGitHubSyncRouter } from "./github-sync-router"; | ||
|
||
export * from "./secret-sync-router"; | ||
|
||
export const SECRET_SYNC_REGISTER_ROUTER_MAP: Record<SecretSync, (server: FastifyZodProvider) => Promise<void>> = { | ||
[SecretSync.AWSParameterStore]: registerAwsParameterStoreSyncRouter, | ||
[SecretSync.GitHub]: registerGitHubSyncRouter | ||
[SecretSync.GitHub]: registerGitHubSyncRouter, | ||
[SecretSync.GCPSecretManager]: registerGcpSyncRouter | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export enum AppConnection { | ||
GitHub = "github", | ||
AWS = "aws" | ||
AWS = "aws", | ||
GCP = "gcp" | ||
} | ||
|
||
export enum AWSRegion { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
backend/src/services/app-connection/gcp/gcp-connection-enums.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export enum GcpConnectionMethod { | ||
ServiceAccountImpersonation = "service-account-impersonation" | ||
} |
Oops, something went wrong.