feat: increased identity gcp auth cred limit from 255 to respective limits

This commit is contained in:
=
2025-02-05 10:38:10 +05:30
parent 7adc103ed2
commit 7aecaad050
3 changed files with 45 additions and 9 deletions
@@ -0,0 +1,36 @@
import { Knex } from "knex";
import { TableName } from "../schemas";
export async function up(knex: Knex): Promise<void> {
const hasTable = await knex.schema.hasTable(TableName.IdentityGcpAuth);
const hasAllowedProjectsColumn = await knex.schema.hasColumn(TableName.IdentityGcpAuth, "allowedProjects");
const hasAllowedServiceAccountsColumn = await knex.schema.hasColumn(
TableName.IdentityGcpAuth,
"allowedServiceAccounts"
);
const hasAllowedZones = await knex.schema.hasColumn(TableName.IdentityGcpAuth, "allowedZones");
if (hasTable) {
await knex.schema.alterTable(TableName.IdentityGcpAuth, (t) => {
if (hasAllowedProjectsColumn) t.string("allowedProjects", 2500).alter();
if (hasAllowedServiceAccountsColumn) t.string("allowedServiceAccounts", 5000).alter();
if (hasAllowedZones) t.string("allowedZones", 2500).alter();
});
}
}
export async function down(knex: Knex): Promise<void> {
const hasTable = await knex.schema.hasTable(TableName.IdentityGcpAuth);
const hasAllowedProjectsColumn = await knex.schema.hasColumn(TableName.IdentityGcpAuth, "allowedProjects");
const hasAllowedServiceAccountsColumn = await knex.schema.hasColumn(
TableName.IdentityGcpAuth,
"allowedServiceAccounts"
);
const hasAllowedZones = await knex.schema.hasColumn(TableName.IdentityGcpAuth, "allowedZones");
if (hasTable) {
await knex.schema.alterTable(TableName.IdentityGcpAuth, (t) => {
if (hasAllowedProjectsColumn) t.string("allowedProjects").alter();
if (hasAllowedServiceAccountsColumn) t.string("allowedServiceAccounts").alter();
if (hasAllowedZones) t.string("allowedZones").alter();
});
}
}
+3 -3
View File
@@ -17,9 +17,9 @@ export const IdentityGcpAuthsSchema = z.object({
updatedAt: z.date(), updatedAt: z.date(),
identityId: z.string().uuid(), identityId: z.string().uuid(),
type: z.string(), type: z.string(),
allowedServiceAccounts: z.string(), allowedServiceAccounts: z.string().nullable().optional(),
allowedProjects: z.string(), allowedProjects: z.string().nullable().optional(),
allowedZones: z.string() allowedZones: z.string().nullable().optional()
}); });
export type TIdentityGcpAuths = z.infer<typeof IdentityGcpAuthsSchema>; export type TIdentityGcpAuths = z.infer<typeof IdentityGcpAuthsSchema>;
@@ -762,9 +762,9 @@ interface AddIdentityGcpAuthEvent {
metadata: { metadata: {
identityId: string; identityId: string;
type: string; type: string;
allowedServiceAccounts: string; allowedServiceAccounts?: string | null;
allowedProjects: string; allowedProjects?: string | null;
allowedZones: string; allowedZones?: string | null;
accessTokenTTL: number; accessTokenTTL: number;
accessTokenMaxTTL: number; accessTokenMaxTTL: number;
accessTokenNumUsesLimit: number; accessTokenNumUsesLimit: number;
@@ -784,9 +784,9 @@ interface UpdateIdentityGcpAuthEvent {
metadata: { metadata: {
identityId: string; identityId: string;
type?: string; type?: string;
allowedServiceAccounts?: string; allowedServiceAccounts?: string | null;
allowedProjects?: string; allowedProjects?: string | null;
allowedZones?: string; allowedZones?: string | null;
accessTokenTTL?: number; accessTokenTTL?: number;
accessTokenMaxTTL?: number; accessTokenMaxTTL?: number;
accessTokenNumUsesLimit?: number; accessTokenNumUsesLimit?: number;