Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(tests): enable legacy additional privileges on test projects
Vlad Ligaif1392aff65a0
diff --git a/backend-go/tests/infra/stack.go b/backend-go/tests/infra/stack.goindex ad2c1bd50e..0c32f1c390 100644--- a/backend-go/tests/infra/stack.go+++ b/backend-go/tests/infra/stack.go@@ -6,6 +6,7 @@ import ("context""log""os"+ "testing""github.com/testcontainers/testcontainers-go"@@ -31,6 +32,17 @@ func (s *Stack) NodeJS() *NodeJSService { return s.nodejs }func (s *Stack) Config() *config.Config { return s.cfg }func (s *Stack) DB() pg.DB { return s.db }+// EnableLegacyAdditionalPrivileges flips the project flag that additional+// privileges are gated on. New projects default to false and no route exposes+// the column, so tests covering the legacy path have to set it directly.+func (s *Stack) EnableLegacyAdditionalPrivileges(t *testing.T, projectID string) {+ t.Helper()+ if _, err := s.db.Primary().Exec(context.Background(),+ `UPDATE projects SET "isLegacyAdditionalPrivilegesEnabled" = true WHERE id = $1`, projectID); err != nil {+ t.Fatalf("infra.EnableLegacyAdditionalPrivileges: %v", err)+ }+}+// Stop tears down all containers, the network, and closes the DB pool.func (s *Stack) Stop() {ctx := context.Background()diff --git a/backend-go/tests/platform/permission/permission_test.go b/backend-go/tests/platform/permission/permission_test.goindex 39c0e3e914..a24806dca4 100644--- a/backend-go/tests/platform/permission/permission_test.go+++ b/backend-go/tests/platform/permission/permission_test.go@@ -525,6 +525,7 @@ func TestGroupViewer_UserInheritsReadOnly(t *testing.T) {func TestIdentityAdditionalPrivilege_ExtendsRole(t *testing.T) {nodejs := stack.NodeJS()+ stack.EnableLegacyAdditionalPrivileges(t, proj.ID)identity := nodejs.CreateIdentity(t, "addl-priv-identity")nodejs.AddIdentityToProject(t, proj.ID, identity.ID, infra.Role("viewer"))diff --git a/backend-go/tests/secretmanager/secrets/list_secrets_permission_integration_test.go b/backend-go/tests/secretmanager/secrets/list_secrets_permission_integration_test.goindex eb9d4def69..79cf42d020 100644--- a/backend-go/tests/secretmanager/secrets/list_secrets_permission_integration_test.go+++ b/backend-go/tests/secretmanager/secrets/list_secrets_permission_integration_test.go@@ -381,6 +381,7 @@ func TestIdentityAdditionalPrivilege_ExtendsRole(t *testing.T) {nodejs := stack.NodeJS()proj := nodejs.CreateProject(t, "addl-priv-test")+ stack.EnableLegacyAdditionalPrivileges(t, proj.ID)nodejs.CreateSecret(t, proj.ID, "dev", "/", "DEV_SECRET", "dev-value", nil)nodejs.CreateSecret(t, proj.ID, "staging", "/", "STAGING_SECRET", "staging-value", nil)@@ -421,6 +422,7 @@ func TestIdentityMultipleAdditionalPrivileges_Merge(t *testing.T) {nodejs := stack.NodeJS()proj := nodejs.CreateProject(t, "multi-addl-priv-test")+ stack.EnableLegacyAdditionalPrivileges(t, proj.ID)nodejs.CreateSecret(t, proj.ID, "dev", "/", "DEV_SECRET", "dev-value", nil)nodejs.CreateSecret(t, proj.ID, "staging", "/", "STAGING_SECRET", "staging-value", nil)@@ -573,6 +575,7 @@ func TestIdentityTemporaryAdditionalPrivilege_Active(t *testing.T) {nodejs := stack.NodeJS()proj := nodejs.CreateProject(t, "temp-addl-active-test")+ stack.EnableLegacyAdditionalPrivileges(t, proj.ID)nodejs.CreateSecret(t, proj.ID, proj.EnvSlug, "/", "TEMP_ADDL_SECRET", "temp-addl-value", nil)identity := nodejs.CreateIdentity(t, "temp-addl-active-identity")@@ -600,6 +603,7 @@ func TestIdentityTemporaryAdditionalPrivilege_Expired(t *testing.T) {nodejs := stack.NodeJS()proj := nodejs.CreateProject(t, "temp-addl-expired-test")+ stack.EnableLegacyAdditionalPrivileges(t, proj.ID)nodejs.CreateSecret(t, proj.ID, proj.EnvSlug, "/", "EXPIRED_ADDL_SECRET", "expired-value", nil)identity := nodejs.CreateIdentity(t, "temp-addl-expired-identity")