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: do not allow a user that is not inside a project or was deleted to receive an approval
adilsona666610309fb
diff --git a/CLAUDE.md b/CLAUDE.mdindex 77ab1520a0..ac724ad2c5 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -211,7 +211,12 @@ that locks the approval request, moves the delegated row `waiting_approval` →runs the policy type's `postApprovalTxRoutine` from `approvalResources`. A mismatch, a record for anotherrequest, or any other `UnrecoverableError` goes through `failDelegatedApprovalRequest`: the delegated rowbecomes `failed` with a readable `statusReason`, the approval request is cancelled, and nothing can retry-it. Every outcome is audited as `ACCESS_APPROVAL_REQUEST_DELEGATED_DECISION` with the `PLATFORM` actor, and+it. A request whose requester was deleted (`requesterId` is set null) or is no longer a member of the+project, directly or through a group (`membershipDAL.isUserProjectMember`), takes the same path before the+decision is read back. The secret access `postApprovalTxRoutine` refuses a non-member too, on both approval+paths: removing a member reaps only the privileges that already exist, so one written afterwards would take+effect if the user were ever added back. Every outcome is audited as+`ACCESS_APPROVAL_REQUEST_DELEGATED_DECISION` with the `PLATFORM` actor, andproduct notifications (the access request webhook) go through `decisionNotifiers`, never through theconsumer itself. ServiceNow stamps an immutable `decision` on its record before it posts the callback, sothe provider reads that field alone and ignores `state`.diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex 159ccfda5c..3d7d0497c4 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -2648,7 +2648,8 @@ export const registerRoutes = async (const secretAccessApprovalGlobalResource = secretAccessApprovalGlobalResourceFactory({approvalPolicyDAL,approvalRequestGrantsDAL,- additionalPrivilegeDAL+ additionalPrivilegeDAL,+ membershipDAL});const secretReplicationService = secretReplicationServiceFactory({@@ -3301,6 +3302,7 @@ export const registerRoutes = async (approvalPolicyDAL,approvalRequestDAL,appConnectionDAL,+ membershipDAL,kmsService,auditLogService,approvalResources: { [ApprovalPolicyType.SecretAccess]: secretAccessApprovalGlobalResource },diff --git a/backend/src/services/approval-policy/secret-access/secret-access-policy-factory.test.ts b/backend/src/services/approval-policy/secret-access/secret-access-policy-factory.test.tsnew file mode 100644index 0000000000..92d80c1fce--- /dev/null+++ b/backend/src/services/approval-policy/secret-access/secret-access-policy-factory.test.ts@@ -0,0 +1,58 @@+import { TApprovalRequest } from "../approval-policy-types";+import { secretAccessApprovalGlobalResourceFactory } from "./secret-access-policy-factory";++const TX = { tx: true } as never;++const approvedRequest = {+ id: "request-1",+ projectId: "project-1",+ requesterId: "user-1",+ requestData: {+ version: 1,+ requestData: {+ permissions: [["read", "secrets", { environment: "dev", secretPath: { $glob: "/app" } }]],+ isTemporary: false,+ temporaryRange: null+ }+ }+} as unknown as TApprovalRequest;++const buildResource = ({ isRequesterProjectMember }: { isRequesterProjectMember: boolean }) => {+ const isUserProjectMember = vi.fn().mockResolvedValue(isRequesterProjectMember);+ const createGrant = vi.fn().mockResolvedValue({ id: "grant-1" });+ const createPrivilege = vi.fn().mockResolvedValue({ id: "privilege-1" });++ const resource = secretAccessApprovalGlobalResourceFactory({+ approvalPolicyDAL: { findSecretAccessPolicyByEnvIdAndSecretPath: vi.fn() },+ approvalRequestGrantsDAL: { find: vi.fn(), create: createGrant },+ additionalPrivilegeDAL: { create: createPrivilege },+ membershipDAL: { isUserProjectMember }+ } as never);++ return { resource, isUserProjectMember, createGrant, createPrivilege };+};++describe("secretAccessApprovalGlobalResource.postApprovalTxRoutine", () => {+ test("grants a requester who is still a member of the project", async () => {+ const { resource, isUserProjectMember, createPrivilege } = buildResource({ isRequesterProjectMember: true });++ await expect(resource.postApprovalTxRoutine(approvedRequest, TX)).resolves.toEqual({ grantId: "grant-1" });++ expect(isUserProjectMember).toHaveBeenCalledWith({ projectId: "project-1", userId: "user-1" }, TX);+ expect(createPrivilege).toHaveBeenCalledWith(+ expect.objectContaining({ actorUserId: "user-1", projectId: "project-1", grantId: "grant-1" }),+ TX+ );+ });++ test("grants nothing to a requester who is no longer a member of the project", async () => {+ const { resource, createGrant, createPrivilege } = buildResource({ isRequesterProjectMember: false });++ await expect(resource.postApprovalTxRoutine(approvedRequest, TX)).rejects.toThrow(+ "The user who created this access request is no longer a member of this project, so access cannot be granted."+ );++ expect(createGrant).not.toHaveBeenCalled();+ expect(createPrivilege).not.toHaveBeenCalled();+ });+});diff --git a/backend/src/services/approval-policy/secret-access/secret-access-policy-factory.ts b/backend/src/services/approval-policy/secret-access/secret-access-policy-factory.tsindex 0119f808fe..a1163fe5aa 100644--- a/backend/src/services/approval-policy/secret-access/secret-access-policy-factory.ts+++ b/backend/src/services/approval-policy/secret-access/secret-access-policy-factory.ts@@ -1,5 +1,6 @@-import { NotFoundError } from "@app/lib/errors";+import { BadRequestError, NotFoundError } from "@app/lib/errors";import { TAdditionalPrivilegeDALFactory } from "@app/services/additional-privilege/additional-privilege-dal";+import { TMembershipDALFactory } from "@app/services/membership/membership-dal";import { TApprovalPolicyDALFactory } from "../approval-policy-dal";import { ApprovalPolicyType, ApprovalRequestGrantStatus } from "../approval-policy-enums";@@ -20,6 +21,7 @@ type TSecretAccessApprovalGlobalResourceDep = {approvalPolicyDAL: Pick<TApprovalPolicyDALFactory, "findSecretAccessPolicyByEnvIdAndSecretPath">;approvalRequestGrantsDAL: Pick<TApprovalRequestGrantsDALFactory, "find" | "create">;additionalPrivilegeDAL: Pick<TAdditionalPrivilegeDALFactory, "create">;+ membershipDAL: Pick<TMembershipDALFactory, "isUserProjectMember">;};export type TSecretAccessApprovalGlobalResource = ReturnType<typeof secretAccessApprovalGlobalResourceFactory>;@@ -27,7 +29,8 @@ export type TSecretAccessApprovalGlobalResource = ReturnType<typeof secretAccessexport const secretAccessApprovalGlobalResourceFactory = ({approvalPolicyDAL,approvalRequestGrantsDAL,- additionalPrivilegeDAL+ additionalPrivilegeDAL,+ membershipDAL}: TSecretAccessApprovalGlobalResourceDep) =>({matchPolicy: async (projectId, inputs) => {@@ -69,6 +72,15 @@ export const secretAccessApprovalGlobalResourceFactory = ({throw new NotFoundError({ message: "The user who created this access request no longer exists" });}+ // An additional privilege outlives a removal that ran before it was written, and takes effect if the+ // user is ever added back, so it is never granted to someone outside the project.+ if (!(await membershipDAL.isUserProjectMember({ projectId: request.projectId, userId: requesterId }, tx))) {+ throw new BadRequestError({+ message:+ "The user who created this access request is no longer a member of this project, so access cannot be granted."+ });+ }+const grant = await createSecretAccessGrantWithPrivilege({projectId: request.projectId,diff --git a/backend/src/services/delegated-approval-decision/delegated-approval-decision-consumer.test.ts b/backend/src/services/delegated-approval-decision/delegated-approval-decision-consumer.test.tsindex b1d03ce91b..60ac594473 100644--- a/backend/src/services/delegated-approval-decision/delegated-approval-decision-consumer.test.ts+++ b/backend/src/services/delegated-approval-decision/delegated-approval-decision-consumer.test.ts@@ -72,6 +72,7 @@ const pendingApprovalRequest = {policyId: "policy-1",projectId: "project-1",organizationId: ORG_ID,+ requesterId: "user-1" as string | null,type: ApprovalPolicyType.SecretAccess,status: ApprovalRequestStatus.Pending as string,expiresAt: null as Date | null@@ -104,7 +105,8 @@ const buildConsumer = ({delegatedRequest = waitingDelegatedRequest as TDelegatedRow | null,approvalRequest = pendingApprovalRequest as TApprovalRow | null,policy = delegatedPolicy as typeof delegatedPolicy | null,- connection = { id: "connection-1", orgId: ORG_ID, app: "servicenow" } as { id: string; orgId: string } | null+ connection = { id: "connection-1", orgId: ORG_ID, app: "servicenow" } as { id: string; orgId: string } | null,+ isRequesterProjectMember = true} = {}) => {let row: TDelegatedRow | null = delegatedRequest ? { ...delegatedRequest } : null;let approval: TApprovalRow | null = approvalRequest ? { ...approvalRequest } : null;@@ -147,6 +149,7 @@ const buildConsumer = ({transaction: vi.fn(async (fn: (tx: unknown) => Promise<unknown>) => fn(TX))},appConnectionDAL: { findById: vi.fn().mockResolvedValue(connection) },+ membershipDAL: { isUserProjectMember: vi.fn().mockResolvedValue(isRequesterProjectMember) },kmsService: { createCipherPairWithDataKey: vi.fn() },auditLogService: { createAuditLog },approvalResources: { [ApprovalPolicyType.SecretAccess]: { postApprovalTxRoutine } },@@ -292,6 +295,38 @@ describe("delegatedApprovalDecisionConsumer", () => {expect(approval()?.status).toBe(ApprovalRequestStatus.Cancelled);});+ test("cancels a request whose requester was deleted without reading the decision", async () => {+ const { consumer, row, approval, postApprovalTxRoutine, createAuditLog } = buildConsumer({+ approvalRequest: { ...pendingApprovalRequest, requesterId: null }+ });++ const [result] = await consumer.handle([makeEvent()]);++ expect(result.status).toBe(EventResultStatus.Failed);+ expect(result.error).toContain("was deleted");+ expect(fetchDecision).not.toHaveBeenCalled();+ expect(row()).toMatchObject({+ status: DelegatedApprovalRequestStatus.Failed,+ details: { statusReason: result.error }+ });+ expect(approval()?.status).toBe(ApprovalRequestStatus.Cancelled);+ expect(postApprovalTxRoutine).not.toHaveBeenCalled();+ auditedWith(createAuditLog, { outcome: DelegatedApprovalDecisionOutcome.Failed, reason: result.error });+ });++ test("cancels a request whose requester left the project without reading the decision", async () => {+ const { consumer, row, approval, postApprovalTxRoutine } = buildConsumer({ isRequesterProjectMember: false });++ const [result] = await consumer.handle([makeEvent()]);++ expect(result.status).toBe(EventResultStatus.Failed);+ expect(result.error).toContain("no longer a member of this project");+ expect(fetchDecision).not.toHaveBeenCalled();+ expect(row()?.status).toBe(DelegatedApprovalRequestStatus.Failed);+ expect(approval()?.status).toBe(ApprovalRequestStatus.Cancelled);+ expect(postApprovalTxRoutine).not.toHaveBeenCalled();+ });+test("retries while the system has not recorded a decision, telling the user why", async () => {fetchDecision.mockResolvedValueOnce({ status: "pending", reason: "ServiceNow has not recorded a decision yet." });const { consumer, row, approval, createAuditLog } = buildConsumer();diff --git a/backend/src/services/delegated-approval-decision/delegated-approval-decision-service.ts b/backend/src/services/delegated-approval-decision/delegated-approval-decision-service.tsindex 277c5bc7e5..a3acd72de9 100644--- a/backend/src/services/delegated-approval-decision/delegated-approval-decision-service.ts+++ b/backend/src/services/delegated-approval-decision/delegated-approval-decision-service.ts@@ -56,6 +56,7 @@ export const delegatedApprovalDecisionServiceFactory = ({approvalPolicyDAL,approvalRequestDAL,appConnectionDAL,+ membershipDAL,kmsService,auditLogService,approvalResources,@@ -285,6 +286,21 @@ export const delegatedApprovalDecisionServiceFactory = ({delegatedApprovalType: delegatedApprovalName ?? "the delegated approval system"};+ if (!approvalRequest.requesterId) {+ return $terminal(context, "The user who created this access request was deleted, so the request was cancelled.");+ }++ const isRequesterProjectMember = await membershipDAL.isUserProjectMember(+ { projectId: approvalRequest.projectId, userId: approvalRequest.requesterId },+ delegatedApprovalRequestDAL.primaryNode()+ );+ if (!isRequesterProjectMember) {+ return $terminal(+ context,+ "The user who created this access request is no longer a member of this project, so the request was cancelled."+ );+ }+if (!delegatedPolicy) {return $terminal(context,diff --git a/backend/src/services/delegated-approval-decision/delegated-approval-decision-types.ts b/backend/src/services/delegated-approval-decision/delegated-approval-decision-types.tsindex 1a2558c897..81f776477a 100644--- a/backend/src/services/delegated-approval-decision/delegated-approval-decision-types.ts+++ b/backend/src/services/delegated-approval-decision/delegated-approval-decision-types.ts@@ -8,6 +8,7 @@ import { TDelegatedApprovalPolicyDALFactory } from "@app/services/delegated-apprimport { TDelegatedApprovalRequestDALFactory } from "@app/services/delegated-approval/delegated-approval-request-dal";import { EventResultStatus } from "@app/services/event-outbox/event-outbox-types";import { TKmsServiceFactory } from "@app/services/kms/kms-service";+import { TMembershipDALFactory } from "@app/services/membership/membership-dal";import { DelegatedApprovalDecision, DelegatedApprovalDecisionOutcome } from "./delegated-approval-decision-enums";@@ -55,6 +56,7 @@ export type TDelegatedApprovalDecisionServiceFactoryDep = {approvalPolicyDAL: Pick<TApprovalPolicyDALFactory, "findById">;approvalRequestDAL: Pick<TApprovalRequestDALFactory, "findById" | "findByIdForUpdate" | "updateById" | "transaction">;appConnectionDAL: Pick<TAppConnectionDALFactory, "findById">;+ membershipDAL: Pick<TMembershipDALFactory, "isUserProjectMember">;kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;auditLogService: Pick<TAuditLogServiceFactory, "createAuditLog">;approvalResources: Record<DelegatedApprovalSupportedPolicyType, Pick<TApprovalResource, "postApprovalTxRoutine">>;diff --git a/backend/src/services/membership/membership-dal.ts b/backend/src/services/membership/membership-dal.tsindex d561e1ac2e..55d5508872 100644--- a/backend/src/services/membership/membership-dal.ts+++ b/backend/src/services/membership/membership-dal.ts@@ -159,6 +159,28 @@ export const membershipDALFactory = (db: TDbClient) => {}};+ // Matches a user's project memberships the way permissionDAL.getPermission does, directly or through a+ // group, so it answers whether a privilege granted to the user in the project would take effect.+ const isUserProjectMember = async ({ projectId, userId }: { projectId: string; userId: string }, tx?: Knex) => {+ try {+ const conn = tx || db.replicaNode();+ const userGroupSubquery = conn(TableName.UserGroupMembership).where("userId", userId).select("groupId");++ const membership = (await conn(TableName.Membership)+ .where(`${TableName.Membership}.scope`, AccessScope.Project)+ .where(`${TableName.Membership}.scopeProjectId`, projectId)+ .where((qb) => {+ void qb+ .where(`${TableName.Membership}.actorUserId`, userId)+ .orWhereIn(`${TableName.Membership}.actorGroupId`, userGroupSubquery);+ })+ .first(`${TableName.Membership}.id`)) as { id: string } | undefined;+ return Boolean(membership);+ } catch (error) {+ throw new DatabaseError({ error, name: "Is user project member" });+ }+ };+// Locks the row so a concurrent deactivation or removal of the same membership serializes behind the// caller. Always reads the primary, so it also bypasses the cached permission blob.const lockOrgMembershipForUser = async (@@ -231,6 +253,7 @@ export const membershipDALFactory = (db: TDbClient) => {findResourceMembershipsForActor,findResourceMembershipsForActors,findResourceMembershipsForGroup,+ isUserProjectMember,lockOrgMembershipForUser,lockResourceMembershipForActor};diff --git a/tests/clients/api/api.gen.go b/tests/clients/api/api.gen.goindex 5a9246efe8..906d1e9962 100644--- a/tests/clients/api/api.gen.go+++ b/tests/clients/api/api.gen.go@@ -786,6 +786,21 @@ func (e UpdateAccessApprovalPolicy500JSONResponseBodyStatusCode) Valid() bool {}}+// Defines values for ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0Type.+const (+ ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0TypeServicenow ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0Type = "servicenow"+)++// Valid indicates whether the value is a known member of the ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0Type enum.+func (e ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0Type) Valid() bool {+ switch e {+ case ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0TypeServicenow:+ return true+ default:+ return false+ }+}+// Defines values for ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalStatus.const (ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalStatusApproved ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalStatus = "approved"@@ -6345,6 +6360,96 @@ func (e CreateProjectMachineIdentity500JSONResponseBodyStatusCode) Valid() bool}}+// Defines values for RemoveProjectMembers400JSONResponseBodyStatusCode.+const (+ RemoveProjectMembers400JSONResponseBodyStatusCodeN400 RemoveProjectMembers400JSONResponseBodyStatusCode = 400+)++// Valid indicates whether the value is a known member of the RemoveProjectMembers400JSONResponseBodyStatusCode enum.+func (e RemoveProjectMembers400JSONResponseBodyStatusCode) Valid() bool {+ switch e {+ case RemoveProjectMembers400JSONResponseBodyStatusCodeN400:+ return true+ default:+ return false+ }+}++// Defines values for RemoveProjectMembers401JSONResponseBodyStatusCode.+const (+ RemoveProjectMembers401JSONResponseBodyStatusCodeN401 RemoveProjectMembers401JSONResponseBodyStatusCode = 401+)++// Valid indicates whether the value is a known member of the RemoveProjectMembers401JSONResponseBodyStatusCode enum.+func (e RemoveProjectMembers401JSONResponseBodyStatusCode) Valid() bool {+ switch e {+ case RemoveProjectMembers401JSONResponseBodyStatusCodeN401:+ return true+ default:+ return false+ }+}++// Defines values for RemoveProjectMembers403JSONResponseBodyStatusCode.+const (+ RemoveProjectMembers403JSONResponseBodyStatusCodeN403 RemoveProjectMembers403JSONResponseBodyStatusCode = 403+)++// Valid indicates whether the value is a known member of the RemoveProjectMembers403JSONResponseBodyStatusCode enum.+func (e RemoveProjectMembers403JSONResponseBodyStatusCode) Valid() bool {+ switch e {+ case RemoveProjectMembers403JSONResponseBodyStatusCodeN403:+ return true+ default:+ return false+ }+}++// Defines values for RemoveProjectMembers404JSONResponseBodyStatusCode.+const (+ RemoveProjectMembers404JSONResponseBodyStatusCodeN404 RemoveProjectMembers404JSONResponseBodyStatusCode = 404+)++// Valid indicates whether the value is a known member of the RemoveProjectMembers404JSONResponseBodyStatusCode enum.+func (e RemoveProjectMembers404JSONResponseBodyStatusCode) Valid() bool {+ switch e {+ case RemoveProjectMembers404JSONResponseBodyStatusCodeN404:+ return true+ default:+ return false+ }+}++// Defines values for RemoveProjectMembers422JSONResponseBodyStatusCode.+const (+ RemoveProjectMembers422JSONResponseBodyStatusCodeN422 RemoveProjectMembers422JSONResponseBodyStatusCode = 422+)++// Valid indicates whether the value is a known member of the RemoveProjectMembers422JSONResponseBodyStatusCode enum.+func (e RemoveProjectMembers422JSONResponseBodyStatusCode) Valid() bool {+ switch e {+ case RemoveProjectMembers422JSONResponseBodyStatusCodeN422:+ return true+ default:+ return false+ }+}++// Defines values for RemoveProjectMembers500JSONResponseBodyStatusCode.+const (+ RemoveProjectMembers500JSONResponseBodyStatusCodeN500 RemoveProjectMembers500JSONResponseBodyStatusCode = 500+)++// Valid indicates whether the value is a known member of the RemoveProjectMembers500JSONResponseBodyStatusCode enum.+func (e RemoveProjectMembers500JSONResponseBodyStatusCode) Valid() bool {+ switch e {+ case RemoveProjectMembers500JSONResponseBodyStatusCodeN500:+ return true+ default:+ return false+ }+}+// Defines values for InviteProjectMembers400JSONResponseBodyStatusCode.const (InviteProjectMembers400JSONResponseBodyStatusCodeN400 InviteProjectMembers400JSONResponseBodyStatusCode = 400@@ -11520,6 +11625,96 @@ func (e CreateSecretImport500JSONResponseBodyStatusCode) Valid() bool {}}+// Defines values for DeleteUser400JSONResponseBodyStatusCode.+const (+ DeleteUser400JSONResponseBodyStatusCodeN400 DeleteUser400JSONResponseBodyStatusCode = 400+)++// Valid indicates whether the value is a known member of the DeleteUser400JSONResponseBodyStatusCode enum.+func (e DeleteUser400JSONResponseBodyStatusCode) Valid() bool {+ switch e {+ case DeleteUser400JSONResponseBodyStatusCodeN400:+ return true+ default:+ return false+ }+}++// Defines values for DeleteUser401JSONResponseBodyStatusCode.+const (+ DeleteUser401JSONResponseBodyStatusCodeN401 DeleteUser401JSONResponseBodyStatusCode = 401+)++// Valid indicates whether the value is a known member of the DeleteUser401JSONResponseBodyStatusCode enum.+func (e DeleteUser401JSONResponseBodyStatusCode) Valid() bool {+ switch e {+ case DeleteUser401JSONResponseBodyStatusCodeN401:+ return true+ default:+ return false+ }+}++// Defines values for DeleteUser403JSONResponseBodyStatusCode.+const (+ DeleteUser403JSONResponseBodyStatusCodeN403 DeleteUser403JSONResponseBodyStatusCode = 403+)++// Valid indicates whether the value is a known member of the DeleteUser403JSONResponseBodyStatusCode enum.+func (e DeleteUser403JSONResponseBodyStatusCode) Valid() bool {+ switch e {+ case DeleteUser403JSONResponseBodyStatusCodeN403:+ return true+ default:+ return false+ }+}++// Defines values for DeleteUser404JSONResponseBodyStatusCode.+const (+ DeleteUser404JSONResponseBodyStatusCodeN404 DeleteUser404JSONResponseBodyStatusCode = 404+)++// Valid indicates whether the value is a known member of the DeleteUser404JSONResponseBodyStatusCode enum.+func (e DeleteUser404JSONResponseBodyStatusCode) Valid() bool {+ switch e {+ case DeleteUser404JSONResponseBodyStatusCodeN404:+ return true+ default:+ return false+ }+}++// Defines values for DeleteUser422JSONResponseBodyStatusCode.+const (+ DeleteUser422JSONResponseBodyStatusCodeN422 DeleteUser422JSONResponseBodyStatusCode = 422+)++// Valid indicates whether the value is a known member of the DeleteUser422JSONResponseBodyStatusCode enum.+func (e DeleteUser422JSONResponseBodyStatusCode) Valid() bool {+ switch e {+ case DeleteUser422JSONResponseBodyStatusCodeN422:+ return true+ default:+ return false+ }+}++// Defines values for DeleteUser500JSONResponseBodyStatusCode.+const (+ DeleteUser500JSONResponseBodyStatusCodeN500 DeleteUser500JSONResponseBodyStatusCode = 500+)++// Valid indicates whether the value is a known member of the DeleteUser500JSONResponseBodyStatusCode enum.+func (e DeleteUser500JSONResponseBodyStatusCode) Valid() bool {+ switch e {+ case DeleteUser500JSONResponseBodyStatusCodeN500:+ return true+ default:+ return false+ }+}+// Defines values for GetCurrentUser400JSONResponseBodyStatusCode.const (GetCurrentUser400JSONResponseBodyStatusCodeN400 GetCurrentUser400JSONResponseBodyStatusCode = 400@@ -14010,6 +14205,21 @@ type ListAccessApprovalRequestsParams struct {EnvSlug *string `form:"envSlug,omitempty" json:"envSlug,omitempty"`}+// ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0 defines parameters for ListAccessApprovalRequests.+type ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0 struct {+ // RecordNumber The number of the ServiceNow record that tracks this request, as shown in ServiceNow.+ RecordNumber string `json:"recordNumber"`+ Type ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0Type `json:"type"`+}++// ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0Type defines parameters for ListAccessApprovalRequests.+type ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0Type string++// ListAccessApprovalRequests200JSONResponseBody_Requests_DelegatedApproval_Provider defines parameters for ListAccessApprovalRequests.+type ListAccessApprovalRequests200JSONResponseBody_Requests_DelegatedApproval_Provider struct {+ union json.RawMessage+}+// ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalStatus defines parameters for ListAccessApprovalRequests.type ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalStatus string@@ -18023,6 +18233,33 @@ type CreateProjectMachineIdentity422JSONResponseBodyStatusCode float32// CreateProjectMachineIdentity500JSONResponseBodyStatusCode defines parameters for CreateProjectMachineIdentity.type CreateProjectMachineIdentity500JSONResponseBodyStatusCode float32+// RemoveProjectMembersJSONBody defines parameters for RemoveProjectMembers.+type RemoveProjectMembersJSONBody struct {+ // Emails A list of organization member emails to remove from the project.+ Emails *[]openapi_types.Email `json:"emails,omitempty"`++ // Usernames A list of usernames to remove from the project.+ Usernames *[]string `json:"usernames,omitempty"`+}++// RemoveProjectMembers400JSONResponseBodyStatusCode defines parameters for RemoveProjectMembers.+type RemoveProjectMembers400JSONResponseBodyStatusCode float32++// RemoveProjectMembers401JSONResponseBodyStatusCode defines parameters for RemoveProjectMembers.+type RemoveProjectMembers401JSONResponseBodyStatusCode float32++// RemoveProjectMembers403JSONResponseBodyStatusCode defines parameters for RemoveProjectMembers.+type RemoveProjectMembers403JSONResponseBodyStatusCode float32++// RemoveProjectMembers404JSONResponseBodyStatusCode defines parameters for RemoveProjectMembers.+type RemoveProjectMembers404JSONResponseBodyStatusCode float32++// RemoveProjectMembers422JSONResponseBodyStatusCode defines parameters for RemoveProjectMembers.+type RemoveProjectMembers422JSONResponseBodyStatusCode float32++// RemoveProjectMembers500JSONResponseBodyStatusCode defines parameters for RemoveProjectMembers.+type RemoveProjectMembers500JSONResponseBodyStatusCode float32+// InviteProjectMembersJSONBody defines parameters for InviteProjectMembers.type InviteProjectMembersJSONBody struct {// Emails A list of organization member emails to invite to the project.@@ -20097,6 +20334,24 @@ type CreateSecretImport422JSONResponseBodyStatusCode float32// CreateSecretImport500JSONResponseBodyStatusCode defines parameters for CreateSecretImport.type CreateSecretImport500JSONResponseBodyStatusCode float32+// DeleteUser400JSONResponseBodyStatusCode defines parameters for DeleteUser.+type DeleteUser400JSONResponseBodyStatusCode float32++// DeleteUser401JSONResponseBodyStatusCode defines parameters for DeleteUser.+type DeleteUser401JSONResponseBodyStatusCode float32++// DeleteUser403JSONResponseBodyStatusCode defines parameters for DeleteUser.+type DeleteUser403JSONResponseBodyStatusCode float32++// DeleteUser404JSONResponseBodyStatusCode defines parameters for DeleteUser.+type DeleteUser404JSONResponseBodyStatusCode float32++// DeleteUser422JSONResponseBodyStatusCode defines parameters for DeleteUser.+type DeleteUser422JSONResponseBodyStatusCode float32++// DeleteUser500JSONResponseBodyStatusCode defines parameters for DeleteUser.+type DeleteUser500JSONResponseBodyStatusCode float32+// GetCurrentUser400JSONResponseBodyStatusCode defines parameters for GetCurrentUser.type GetCurrentUser400JSONResponseBodyStatusCode float32@@ -21372,6 +21627,9 @@ type CreateProjectJSONRequestBody CreateProjectJSONBody// CreateProjectMachineIdentityJSONRequestBody defines body for CreateProjectMachineIdentity for application/json ContentType.type CreateProjectMachineIdentityJSONRequestBody CreateProjectMachineIdentityJSONBody+// RemoveProjectMembersJSONRequestBody defines body for RemoveProjectMembers for application/json ContentType.+type RemoveProjectMembersJSONRequestBody RemoveProjectMembersJSONBody+// InviteProjectMembersJSONRequestBody defines body for InviteProjectMembers for application/json ContentType.type InviteProjectMembersJSONRequestBody InviteProjectMembersJSONBody@@ -21749,6 +22007,42 @@ func (t *UpdateAccessApprovalPolicyJSONBody_Bypassers_Item) UnmarshalJSON(b []byreturn err}+// AsListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0 returns the union data inside the ListAccessApprovalRequests200JSONResponseBody_Requests_DelegatedApproval_Provider as a ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0+func (t ListAccessApprovalRequests200JSONResponseBody_Requests_DelegatedApproval_Provider) AsListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0() (ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0, error) {+ var body ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0+ err := json.Unmarshal(t.union, &body)+ return body, err+}++// FromListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0 overwrites any union data inside the ListAccessApprovalRequests200JSONResponseBody_Requests_DelegatedApproval_Provider as the provided ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0+func (t *ListAccessApprovalRequests200JSONResponseBody_Requests_DelegatedApproval_Provider) FromListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0(v ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0) error {+ b, err := json.Marshal(v)+ t.union = b+ return err+}++// MergeListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0 performs a merge with any union data inside the ListAccessApprovalRequests200JSONResponseBody_Requests_DelegatedApproval_Provider, using the provided ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0+func (t *ListAccessApprovalRequests200JSONResponseBody_Requests_DelegatedApproval_Provider) MergeListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0(v ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalProvider0) error {+ b, err := json.Marshal(v)+ if err != nil {+ return err+ }++ merged, err := runtime.JSONMerge(t.union, b)+ t.union = merged+ return err+}++func (t ListAccessApprovalRequests200JSONResponseBody_Requests_DelegatedApproval_Provider) MarshalJSON() ([]byte, error) {+ b, err := t.union.MarshalJSON()+ return b, err+}++func (t *ListAccessApprovalRequests200JSONResponseBody_Requests_DelegatedApproval_Provider) UnmarshalJSON(b []byte) error {+ err := t.union.UnmarshalJSON(b)+ return err+}+// AsCreateGitHubAppConnectionJSONBody0 returns the union data inside the CreateGitHubAppConnectionJSONBody as a CreateGitHubAppConnectionJSONBody0func (t CreateGitHubAppConnectionJSONBody) AsCreateGitHubAppConnectionJSONBody0() (CreateGitHubAppConnectionJSONBody0, error) {var body CreateGitHubAppConnectionJSONBody0@@ -27038,6 +27332,18 @@ type ClientInterface interface {// Create an identity in a project.CreateProjectMachineIdentity(ctx context.Context, projectId string, body CreateProjectMachineIdentityJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)+ // RemoveProjectMembersWithBody performs a DELETE /api/v1/projects/{projectId}/memberships (the `RemoveProjectMembers` operationId) request,+ // with any type of body and a specified content type.+ //+ // Remove members from project.+ RemoveProjectMembersWithBody(ctx context.Context, projectId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)++ // RemoveProjectMembers performs a DELETE /api/v1/projects/{projectId}/memberships (the `RemoveProjectMembers` operationId) request.+ // Takes a body of the `application/json` content type.+ //+ // Remove members from project.+ RemoveProjectMembers(ctx context.Context, projectId string, body RemoveProjectMembersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)+// InviteProjectMembersWithBody performs a POST /api/v1/projects/{projectId}/memberships (the `InviteProjectMembers` operationId) request,// with any type of body and a specified content type.//@@ -27422,6 +27728,9 @@ type ClientInterface interface {// Create secret imports.CreateSecretImport(ctx context.Context, body CreateSecretImportJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)+ // DeleteUser performs a DELETE /api/v2/users/me (the `DeleteUser` operationId) request.+ DeleteUser(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)+// GetCurrentUser performs a GET /api/v2/users/me (the `GetCurrentUser` operationId) request.//// Retrieve the current user on the request.@@ -28402,6 +28711,38 @@ func (c *Client) CreateProjectMachineIdentity(ctx context.Context, projectId strreturn c.Client.Do(req)}+// RemoveProjectMembersWithBody performs a DELETE /api/v1/projects/{projectId}/memberships (the `RemoveProjectMembers` operationId) request,+// with any type of body and a specified content type.+//+// Remove members from project.+func (c *Client) RemoveProjectMembersWithBody(ctx context.Context, projectId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {+ req, err := NewRemoveProjectMembersRequestWithBody(c.Server, projectId, contentType, body)+ if err != nil {+ return nil, err+ }+ req = req.WithContext(ctx)+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {+ return nil, err+ }+ return c.Client.Do(req)+}++// RemoveProjectMembers performs a DELETE /api/v1/projects/{projectId}/memberships (the `RemoveProjectMembers` operationId) request.+// Takes a body of the `application/json` content type.+//+// Remove members from project.+func (c *Client) RemoveProjectMembers(ctx context.Context, projectId string, body RemoveProjectMembersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {+ req, err := NewRemoveProjectMembersRequest(c.Server, projectId, body)+ if err != nil {+ return nil, err+ }+ req = req.WithContext(ctx)+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {+ return nil, err+ }+ return c.Client.Do(req)+}+// InviteProjectMembersWithBody performs a POST /api/v1/projects/{projectId}/memberships (the `InviteProjectMembers` operationId) request,// with any type of body and a specified content type.//@@ -29666,6 +30007,19 @@ func (c *Client) CreateSecretImport(ctx context.Context, body CreateSecretImportreturn c.Client.Do(req)}+// DeleteUser performs a DELETE /api/v2/users/me (the `DeleteUser` operationId) request.+func (c *Client) DeleteUser(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) {+ req, err := NewDeleteUserRequest(c.Server)+ if err != nil {+ return nil, err+ }+ req = req.WithContext(ctx)+ if err := c.applyEditors(ctx, req, reqEditors); err != nil {+ return nil, err+ }+ return c.Client.Do(req)+}+// GetCurrentUser performs a GET /api/v2/users/me (the `GetCurrentUser` operationId) request.//// Retrieve the current user on the request.@@ -31931,6 +32285,53 @@ func NewCreateProjectMachineIdentityRequestWithBody(server string, projectId strreturn req, nil}+// NewRemoveProjectMembersRequest calls the generic RemoveProjectMembers builder with application/json body+func NewRemoveProjectMembersRequest(server string, projectId string, body RemoveProjectMembersJSONRequestBody) (*http.Request, error) {+ var bodyReader io.Reader+ buf, err := json.Marshal(body)+ if err != nil {+ return nil, err+ }+ bodyReader = bytes.NewReader(buf)+ return NewRemoveProjectMembersRequestWithBody(server, projectId, "application/json", bodyReader)+}++// NewRemoveProjectMembersRequestWithBody constructs an http.Request for the RemoveProjectMembers method, with any body, and a specified content type+func NewRemoveProjectMembersRequestWithBody(server string, projectId string, contentType string, body io.Reader) (*http.Request, error) {+ var err error++ var pathParam0 string++ pathParam0, err = runtime.StyleParamWithOptions("simple", false, "projectId", projectId, runtime.StyleParamOptions{ParamLocation: runtime.ParamLocationPath, Type: "string", Format: ""})+ if err != nil {+ return nil, err+ }++ serverURL, err := url.Parse(server)+ if err != nil {+ return nil, err+ }++ operationPath := fmt.Sprintf("/api/v1/projects/%s/memberships", pathParam0)+ if operationPath[0] == '/' {+ operationPath = "." + operationPath+ }++ queryURL, err := serverURL.Parse(operationPath)+ if err != nil {+ return nil, err+ }++ req, err := http.NewRequest(http.MethodDelete, queryURL.String(), body)+ if err != nil {+ return nil, err+ }++ req.Header.Add("Content-Type", contentType)++ return req, nil+}+// NewInviteProjectMembersRequest calls the generic InviteProjectMembers builder with application/json bodyfunc NewInviteProjectMembersRequest(server string, projectId string, body InviteProjectMembersJSONRequestBody) (*http.Request, error) {var bodyReader io.Reader@@ -34867,6 +35268,33 @@ func NewCreateSecretImportRequestWithBody(server string, contentType string, bodreturn req, nil}+// NewDeleteUserRequest constructs an http.Request for the DeleteUser method+func NewDeleteUserRequest(server string) (*http.Request, error) {+ var err error++ serverURL, err := url.Parse(server)+ if err != nil {+ return nil, err+ }++ operationPath := fmt.Sprintf("/api/v2/users/me")+ if operationPath[0] == '/' {+ operationPath = "." + operationPath+ }++ queryURL, err := serverURL.Parse(operationPath)+ if err != nil {+ return nil, err+ }++ req, err := http.NewRequest(http.MethodDelete, queryURL.String(), nil)+ if err != nil {+ return nil, err+ }++ return req, nil+}+// NewGetCurrentUserRequest constructs an http.Request for the GetCurrentUser methodfunc NewGetCurrentUserRequest(server string) (*http.Request, error) {var err error@@ -36376,6 +36804,20 @@ type ClientWithResponsesInterface interface {// Create an identity in a project.CreateProjectMachineIdentityWithResponse(ctx context.Context, projectId string, body CreateProjectMachineIdentityJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateProjectMachineIdentityResponse, error)+ // RemoveProjectMembersWithBodyWithResponse performs a DELETE /api/v1/projects/{projectId}/memberships (the `RemoveProjectMembers` operationId) request,+ // with any type of body and a specified content type.+ //+ // Remove members from project.+ //+ // Returns a wrapper object for the known response body format(s).+ RemoveProjectMembersWithBodyWithResponse(ctx context.Context, projectId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RemoveProjectMembersResponse, error)++ // RemoveProjectMembersWithResponse performs a DELETE /api/v1/projects/{projectId}/memberships (the `RemoveProjectMembers` operationId) request.+ // Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).+ //+ // Remove members from project.+ RemoveProjectMembersWithResponse(ctx context.Context, projectId string, body RemoveProjectMembersJSONRequestBody, reqEditors ...RequestEditorFn) (*RemoveProjectMembersResponse, error)+// InviteProjectMembersWithBodyWithResponse performs a POST /api/v1/projects/{projectId}/memberships (the `InviteProjectMembers` operationId) request,// with any type of body and a specified content type.//@@ -36880,6 +37322,11 @@ type ClientWithResponsesInterface interface {// Create secret imports.CreateSecretImportWithResponse(ctx context.Context, body CreateSecretImportJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSecretImportResponse, error)+ // DeleteUserWithResponse performs a DELETE /api/v2/users/me (the `DeleteUser` operationId) request.+ //+ // Returns a wrapper object for the known response body format(s).+ DeleteUserWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*DeleteUserResponse, error)+// GetCurrentUserWithResponse performs a GET /api/v2/users/me (the `GetCurrentUser` operationId) request.//// Retrieve the current user on the request.@@ -38186,6 +38633,9 @@ type ListAccessApprovalRequestsResponse struct {BypassReason *string `json:"bypassReason,omitempty"`CreatedAt time.Time `json:"createdAt"`DelegatedApproval *struct {+ // Provider How the delegated approval system identifies this request to its own users, when it reported that.+ Provider *ListAccessApprovalRequests200JSONResponseBody_Requests_DelegatedApproval_Provider `json:"provider"`+// Status Where the request stands in the delegated approval system that reviews it.Status ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalStatus `json:"status"`@@ -38326,6 +38776,9 @@ func (r ListAccessApprovalRequestsResponse) GetJSON200() *struct {BypassReason *string `json:"bypassReason,omitempty"`CreatedAt time.Time `json:"createdAt"`DelegatedApproval *struct {+ // Provider How the delegated approval system identifies this request to its own users, when it reported that.+ Provider *ListAccessApprovalRequests200JSONResponseBody_Requests_DelegatedApproval_Provider `json:"provider"`+// Status Where the request stands in the delegated approval system that reviews it.Status ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalStatus `json:"status"`@@ -43974,6 +44427,169 @@ func (r CreateProjectMachineIdentityResponse) ContentType() string {return ""}+type RemoveProjectMembersResponse struct {+ Body []byte+ HTTPResponse *http.Response+ // JSON200 the response for an HTTP 200 `application/json` response+ JSON200 *struct {+ Memberships []struct {+ CreatedAt time.Time `json:"createdAt"`+ Id openapi_types.UUID `json:"id"`+ ProjectId string `json:"projectId"`+ UpdatedAt time.Time `json:"updatedAt"`+ UserId openapi_types.UUID `json:"userId"`+ } `json:"memberships"`+ }+ // JSON400 the response for an HTTP 400 `application/json` response+ JSON400 *struct {+ Details interface{} `json:"details,omitempty"`+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers400JSONResponseBodyStatusCode `json:"statusCode"`+ }+ // JSON401 the response for an HTTP 401 `application/json` response+ JSON401 *struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers401JSONResponseBodyStatusCode `json:"statusCode"`+ }+ // JSON403 the response for an HTTP 403 `application/json` response+ JSON403 *struct {+ Details interface{} `json:"details,omitempty"`+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers403JSONResponseBodyStatusCode `json:"statusCode"`+ }+ // JSON404 the response for an HTTP 404 `application/json` response+ JSON404 *struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers404JSONResponseBodyStatusCode `json:"statusCode"`+ }+ // JSON422 the response for an HTTP 422 `application/json` response+ JSON422 *struct {+ Error string `json:"error"`+ Message interface{} `json:"message,omitempty"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers422JSONResponseBodyStatusCode `json:"statusCode"`+ }+ // JSON500 the response for an HTTP 500 `application/json` response+ JSON500 *struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers500JSONResponseBodyStatusCode `json:"statusCode"`+ }+}++// GetJSON200 returns the response for an HTTP 200 `application/json` response+func (r RemoveProjectMembersResponse) GetJSON200() *struct {+ Memberships []struct {+ CreatedAt time.Time `json:"createdAt"`+ Id openapi_types.UUID `json:"id"`+ ProjectId string `json:"projectId"`+ UpdatedAt time.Time `json:"updatedAt"`+ UserId openapi_types.UUID `json:"userId"`+ } `json:"memberships"`+} {+ return r.JSON200+}++// GetJSON400 returns the response for an HTTP 400 `application/json` response+func (r RemoveProjectMembersResponse) GetJSON400() *struct {+ Details interface{} `json:"details,omitempty"`+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers400JSONResponseBodyStatusCode `json:"statusCode"`+} {+ return r.JSON400+}++// GetJSON401 returns the response for an HTTP 401 `application/json` response+func (r RemoveProjectMembersResponse) GetJSON401() *struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers401JSONResponseBodyStatusCode `json:"statusCode"`+} {+ return r.JSON401+}++// GetJSON403 returns the response for an HTTP 403 `application/json` response+func (r RemoveProjectMembersResponse) GetJSON403() *struct {+ Details interface{} `json:"details,omitempty"`+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers403JSONResponseBodyStatusCode `json:"statusCode"`+} {+ return r.JSON403+}++// GetJSON404 returns the response for an HTTP 404 `application/json` response+func (r RemoveProjectMembersResponse) GetJSON404() *struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers404JSONResponseBodyStatusCode `json:"statusCode"`+} {+ return r.JSON404+}++// GetJSON422 returns the response for an HTTP 422 `application/json` response+func (r RemoveProjectMembersResponse) GetJSON422() *struct {+ Error string `json:"error"`+ Message interface{} `json:"message,omitempty"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers422JSONResponseBodyStatusCode `json:"statusCode"`+} {+ return r.JSON422+}++// GetJSON500 returns the response for an HTTP 500 `application/json` response+func (r RemoveProjectMembersResponse) GetJSON500() *struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers500JSONResponseBodyStatusCode `json:"statusCode"`+} {+ return r.JSON500+}++// GetBody returns the raw response body bytes+func (r RemoveProjectMembersResponse) GetBody() []byte {+ return r.Body+}++// Status returns HTTPResponse.Status+func (r RemoveProjectMembersResponse) Status() string {+ if r.HTTPResponse != nil {+ return r.HTTPResponse.Status+ }+ return http.StatusText(0)+}++// StatusCode returns HTTPResponse.StatusCode+func (r RemoveProjectMembersResponse) StatusCode() int {+ if r.HTTPResponse != nil {+ return r.HTTPResponse.StatusCode+ }+ return 0+}++// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers+func (r RemoveProjectMembersResponse) ContentType() string {+ if r.HTTPResponse != nil {+ return r.HTTPResponse.Header.Get("Content-Type")+ }+ return ""+}+type InviteProjectMembersResponse struct {Body []byteHTTPResponse *http.Response@@ -53145,6 +53761,175 @@ func (r CreateSecretImportResponse) ContentType() string {return ""}+type DeleteUserResponse struct {+ Body []byte+ HTTPResponse *http.Response+ // JSON200 the response for an HTTP 200 `application/json` response+ JSON200 *struct {+ User struct {+ AuthMethods *[]string `json:"authMethods,omitempty"`+ Email *string `json:"email,omitempty"`+ FirstName *string `json:"firstName,omitempty"`+ Id openapi_types.UUID `json:"id"`+ IsEmailVerified *bool `json:"isEmailVerified,omitempty"`+ LastName *string `json:"lastName,omitempty"`+ PublicKey *string `json:"publicKey,omitempty"`+ Username string `json:"username"`+ } `json:"user"`+ }+ // JSON400 the response for an HTTP 400 `application/json` response+ JSON400 *struct {+ Details interface{} `json:"details,omitempty"`+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser400JSONResponseBodyStatusCode `json:"statusCode"`+ }+ // JSON401 the response for an HTTP 401 `application/json` response+ JSON401 *struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser401JSONResponseBodyStatusCode `json:"statusCode"`+ }+ // JSON403 the response for an HTTP 403 `application/json` response+ JSON403 *struct {+ Details interface{} `json:"details,omitempty"`+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser403JSONResponseBodyStatusCode `json:"statusCode"`+ }+ // JSON404 the response for an HTTP 404 `application/json` response+ JSON404 *struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser404JSONResponseBodyStatusCode `json:"statusCode"`+ }+ // JSON422 the response for an HTTP 422 `application/json` response+ JSON422 *struct {+ Error string `json:"error"`+ Message interface{} `json:"message,omitempty"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser422JSONResponseBodyStatusCode `json:"statusCode"`+ }+ // JSON500 the response for an HTTP 500 `application/json` response+ JSON500 *struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser500JSONResponseBodyStatusCode `json:"statusCode"`+ }+}++// GetJSON200 returns the response for an HTTP 200 `application/json` response+func (r DeleteUserResponse) GetJSON200() *struct {+ User struct {+ AuthMethods *[]string `json:"authMethods,omitempty"`+ Email *string `json:"email,omitempty"`+ FirstName *string `json:"firstName,omitempty"`+ Id openapi_types.UUID `json:"id"`+ IsEmailVerified *bool `json:"isEmailVerified,omitempty"`+ LastName *string `json:"lastName,omitempty"`+ PublicKey *string `json:"publicKey,omitempty"`+ Username string `json:"username"`+ } `json:"user"`+} {+ return r.JSON200+}++// GetJSON400 returns the response for an HTTP 400 `application/json` response+func (r DeleteUserResponse) GetJSON400() *struct {+ Details interface{} `json:"details,omitempty"`+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser400JSONResponseBodyStatusCode `json:"statusCode"`+} {+ return r.JSON400+}++// GetJSON401 returns the response for an HTTP 401 `application/json` response+func (r DeleteUserResponse) GetJSON401() *struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser401JSONResponseBodyStatusCode `json:"statusCode"`+} {+ return r.JSON401+}++// GetJSON403 returns the response for an HTTP 403 `application/json` response+func (r DeleteUserResponse) GetJSON403() *struct {+ Details interface{} `json:"details,omitempty"`+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser403JSONResponseBodyStatusCode `json:"statusCode"`+} {+ return r.JSON403+}++// GetJSON404 returns the response for an HTTP 404 `application/json` response+func (r DeleteUserResponse) GetJSON404() *struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser404JSONResponseBodyStatusCode `json:"statusCode"`+} {+ return r.JSON404+}++// GetJSON422 returns the response for an HTTP 422 `application/json` response+func (r DeleteUserResponse) GetJSON422() *struct {+ Error string `json:"error"`+ Message interface{} `json:"message,omitempty"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser422JSONResponseBodyStatusCode `json:"statusCode"`+} {+ return r.JSON422+}++// GetJSON500 returns the response for an HTTP 500 `application/json` response+func (r DeleteUserResponse) GetJSON500() *struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser500JSONResponseBodyStatusCode `json:"statusCode"`+} {+ return r.JSON500+}++// GetBody returns the raw response body bytes+func (r DeleteUserResponse) GetBody() []byte {+ return r.Body+}++// Status returns HTTPResponse.Status+func (r DeleteUserResponse) Status() string {+ if r.HTTPResponse != nil {+ return r.HTTPResponse.Status+ }+ return http.StatusText(0)+}++// StatusCode returns HTTPResponse.StatusCode+func (r DeleteUserResponse) StatusCode() int {+ if r.HTTPResponse != nil {+ return r.HTTPResponse.StatusCode+ }+ return 0+}++// ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers+func (r DeleteUserResponse) ContentType() string {+ if r.HTTPResponse != nil {+ return r.HTTPResponse.Header.Get("Content-Type")+ }+ return ""+}+type GetCurrentUserResponse struct {Body []byteHTTPResponse *http.Response@@ -57434,6 +58219,32 @@ func (c *ClientWithResponses) CreateProjectMachineIdentityWithResponse(ctx contereturn ParseCreateProjectMachineIdentityResponse(rsp)}+// RemoveProjectMembersWithBodyWithResponse performs a DELETE /api/v1/projects/{projectId}/memberships (the `RemoveProjectMembers` operationId) request,+// with any type of body and a specified content type.+//+// Remove members from project.+//+// Returns a wrapper object for the known response body format(s).+func (c *ClientWithResponses) RemoveProjectMembersWithBodyWithResponse(ctx context.Context, projectId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RemoveProjectMembersResponse, error) {+ rsp, err := c.RemoveProjectMembersWithBody(ctx, projectId, contentType, body, reqEditors...)+ if err != nil {+ return nil, err+ }+ return ParseRemoveProjectMembersResponse(rsp)+}++// RemoveProjectMembersWithResponse performs a DELETE /api/v1/projects/{projectId}/memberships (the `RemoveProjectMembers` operationId) request.+// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).+//+// Remove members from project.+func (c *ClientWithResponses) RemoveProjectMembersWithResponse(ctx context.Context, projectId string, body RemoveProjectMembersJSONRequestBody, reqEditors ...RequestEditorFn) (*RemoveProjectMembersResponse, error) {+ rsp, err := c.RemoveProjectMembers(ctx, projectId, body, reqEditors...)+ if err != nil {+ return nil, err+ }+ return ParseRemoveProjectMembersResponse(rsp)+}+// InviteProjectMembersWithBodyWithResponse performs a POST /api/v1/projects/{projectId}/memberships (the `InviteProjectMembers` operationId) request,// with any type of body and a specified content type.//@@ -58466,6 +59277,17 @@ func (c *ClientWithResponses) CreateSecretImportWithResponse(ctx context.Contextreturn ParseCreateSecretImportResponse(rsp)}+// DeleteUserWithResponse performs a DELETE /api/v2/users/me (the `DeleteUser` operationId) request.+//+// Returns a wrapper object for the known response body format(s).+func (c *ClientWithResponses) DeleteUserWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*DeleteUserResponse, error) {+ rsp, err := c.DeleteUser(ctx, reqEditors...)+ if err != nil {+ return nil, err+ }+ return ParseDeleteUserResponse(rsp)+}+// GetCurrentUserWithResponse performs a GET /api/v2/users/me (the `GetCurrentUser` operationId) request.//// Retrieve the current user on the request.@@ -59598,6 +60420,9 @@ func ParseListAccessApprovalRequestsResponse(rsp *http.Response) (*ListAccessAppBypassReason *string `json:"bypassReason,omitempty"`CreatedAt time.Time `json:"createdAt"`DelegatedApproval *struct {+ // Provider How the delegated approval system identifies this request to its own users, when it reported that.+ Provider *ListAccessApprovalRequests200JSONResponseBody_Requests_DelegatedApproval_Provider `json:"provider"`+// Status Where the request stands in the delegated approval system that reviews it.Status ListAccessApprovalRequests200JSONResponseBodyRequestsDelegatedApprovalStatus `json:"status"`@@ -63267,6 +64092,114 @@ func ParseCreateProjectMachineIdentityResponse(rsp *http.Response) (*CreateProjereturn response, nil}+// ParseRemoveProjectMembersResponse parses an HTTP response from a RemoveProjectMembersWithResponse call+func ParseRemoveProjectMembersResponse(rsp *http.Response) (*RemoveProjectMembersResponse, error) {+ bodyBytes, err := io.ReadAll(rsp.Body)+ defer func() { _ = rsp.Body.Close() }()+ if err != nil {+ return nil, err+ }++ response := &RemoveProjectMembersResponse{+ Body: bodyBytes,+ HTTPResponse: rsp,+ }++ switch {+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:+ var dest struct {+ Memberships []struct {+ CreatedAt time.Time `json:"createdAt"`+ Id openapi_types.UUID `json:"id"`+ ProjectId string `json:"projectId"`+ UpdatedAt time.Time `json:"updatedAt"`+ UserId openapi_types.UUID `json:"userId"`+ } `json:"memberships"`+ }+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON200 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:+ var dest struct {+ Details interface{} `json:"details,omitempty"`+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers400JSONResponseBodyStatusCode `json:"statusCode"`+ }+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON400 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:+ var dest struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers401JSONResponseBodyStatusCode `json:"statusCode"`+ }+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON401 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403:+ var dest struct {+ Details interface{} `json:"details,omitempty"`+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers403JSONResponseBodyStatusCode `json:"statusCode"`+ }+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON403 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:+ var dest struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers404JSONResponseBodyStatusCode `json:"statusCode"`+ }+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON404 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:+ var dest struct {+ Error string `json:"error"`+ Message interface{} `json:"message,omitempty"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers422JSONResponseBodyStatusCode `json:"statusCode"`+ }+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON422 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:+ var dest struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode RemoveProjectMembers500JSONResponseBodyStatusCode `json:"statusCode"`+ }+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON500 = &dest++ }++ return response, nil+}+// ParseInviteProjectMembersResponse parses an HTTP response from a InviteProjectMembersWithResponse callfunc ParseInviteProjectMembersResponse(rsp *http.Response) (*InviteProjectMembersResponse, error) {bodyBytes, err := io.ReadAll(rsp.Body)@@ -68998,6 +69931,117 @@ func ParseCreateSecretImportResponse(rsp *http.Response) (*CreateSecretImportResreturn response, nil}+// ParseDeleteUserResponse parses an HTTP response from a DeleteUserWithResponse call+func ParseDeleteUserResponse(rsp *http.Response) (*DeleteUserResponse, error) {+ bodyBytes, err := io.ReadAll(rsp.Body)+ defer func() { _ = rsp.Body.Close() }()+ if err != nil {+ return nil, err+ }++ response := &DeleteUserResponse{+ Body: bodyBytes,+ HTTPResponse: rsp,+ }++ switch {+ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:+ var dest struct {+ User struct {+ AuthMethods *[]string `json:"authMethods,omitempty"`+ Email *string `json:"email,omitempty"`+ FirstName *string `json:"firstName,omitempty"`+ Id openapi_types.UUID `json:"id"`+ IsEmailVerified *bool `json:"isEmailVerified,omitempty"`+ LastName *string `json:"lastName,omitempty"`+ PublicKey *string `json:"publicKey,omitempty"`+ Username string `json:"username"`+ } `json:"user"`+ }+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON200 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:+ var dest struct {+ Details interface{} `json:"details,omitempty"`+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser400JSONResponseBodyStatusCode `json:"statusCode"`+ }+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON400 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:+ var dest struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser401JSONResponseBodyStatusCode `json:"statusCode"`+ }+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON401 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403:+ var dest struct {+ Details interface{} `json:"details,omitempty"`+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser403JSONResponseBodyStatusCode `json:"statusCode"`+ }+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON403 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:+ var dest struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser404JSONResponseBodyStatusCode `json:"statusCode"`+ }+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON404 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422:+ var dest struct {+ Error string `json:"error"`+ Message interface{} `json:"message,omitempty"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser422JSONResponseBodyStatusCode `json:"statusCode"`+ }+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON422 = &dest++ case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:+ var dest struct {+ Error string `json:"error"`+ Message string `json:"message"`+ ReqId string `json:"reqId"`+ StatusCode DeleteUser500JSONResponseBodyStatusCode `json:"statusCode"`+ }+ if err := json.Unmarshal(bodyBytes, &dest); err != nil {+ return nil, err+ }+ response.JSON500 = &dest++ }++ return response, nil+}+// ParseGetCurrentUserResponse parses an HTTP response from a GetCurrentUserWithResponse callfunc ParseGetCurrentUserResponse(rsp *http.Response) (*GetCurrentUserResponse, error) {bodyBytes, err := io.ReadAll(rsp.Body)diff --git a/tests/clients/api/oapi-codegen.yaml b/tests/clients/api/oapi-codegen.yamlindex b7e7d480d2..deb52230d1 100644--- a/tests/clients/api/oapi-codegen.yaml+++ b/tests/clients/api/oapi-codegen.yaml@@ -34,6 +34,7 @@ output-options:- verifyEmailSignupV3- completeAccountSignupV3- inviteProjectMembers+ - removeProjectMembers- createMachineIdentity- createProjectMachineIdentity- createProjectIdentityMembership@@ -109,6 +110,7 @@ output-options:- getOrgMembership- updateOrgMembership- getCurrentUser+ - deleteUser- createScimToken- listScimTokens- deleteScimTokendiff --git a/tests/suites/secretmanager/approvals/delegated_access_request_test.go b/tests/suites/secretmanager/approvals/delegated_access_request_test.goindex 551db90cd3..0dbc3d30da 100644--- a/tests/suites/secretmanager/approvals/delegated_access_request_test.go+++ b/tests/suites/secretmanager/approvals/delegated_access_request_test.go@@ -19,6 +19,7 @@ import ("github.com/Infisical/infisical/tests/internal/spec""github.com/Infisical/infisical/tests/internal/wait""github.com/google/uuid"+ openapi_types "github.com/oapi-codegen/runtime/types""github.com/stretchr/testify/require")@@ -65,6 +66,56 @@ func TestDelegatedAccessRequest_Decision(t *testing.T) {require.Equal(t, delegatedState{status: "rejected", delegated: "rejected"}, req.await(t, "rejected"))require.Equal(t, http.StatusForbidden, req.readSecret(t))})++ t.Run("should cancel the request when the requester was deleted before ServiceNow approved", func(t *testing.T) {+ t.Parallel()+ spec.Why(t, "The access request list drops a request whose requester is gone, so the cancellation "++ "is observed through the policy, which cannot be edited while it has a pending request.")++ // Setup+ req := newWaitingDelegatedRequest(t)+ req.sn.Seed(t, servicenow.Approved(req.record.SysID))+ deleted, err := req.requester.API.DeleteUserWithResponse(t.Context())+ require.NoError(t, err)+ require.Equalf(t, http.StatusOK, deleted.StatusCode(), "deleting the requester returned %s", apierr.Body(deleted.Body))++ // Action+ code := req.callback(t, req.record.CallbackToken)++ // Assert+ require.Equal(t, http.StatusOK, code)+ wait.Until(t, "the policy to have no pending request", func() bool { return req.renamePolicy(t) == http.StatusOK },+ wait.Timeout(outboxWait), wait.Interval(time.Second))+ require.Equal(t, "renamed", accessPolicyName(t, req.proj, req.policyID))+ })++ t.Run("should not grant a requester who left the project before ServiceNow approved, even after they return", func(t *testing.T) {+ t.Parallel()+ spec.Why(t, "The requester is added back only once the request has closed, because a decision read while "++ "they are a member again would rightly grant them access. Until then they cannot list the request, so "++ "the wait is on the policy, which cannot be edited while it has a pending request.")++ // Setup+ req := newWaitingDelegatedRequest(t)+ req.sn.Seed(t, servicenow.Approved(req.record.SysID))+ removed, err := req.tn.Admin.API.RemoveProjectMembersWithResponse(t.Context(), req.proj.ID,+ api.RemoveProjectMembersJSONRequestBody{Emails: &[]openapi_types.Email{openapi_types.Email(req.requester.Email)}})+ require.NoError(t, err)+ require.Equalf(t, http.StatusOK, removed.StatusCode(), "removing the requester returned %s", apierr.Body(removed.Body))++ // Action+ code := req.callback(t, req.record.CallbackToken)++ // Assert+ require.Equal(t, http.StatusOK, code)+ wait.Until(t, "the policy to have no pending request", func() bool { return req.renamePolicy(t) == http.StatusOK },+ wait.Timeout(outboxWait), wait.Interval(time.Second))+ req.proj.Grant(t, req.requester, "no-access")+ closed := req.current(t)+ require.Equal(t, delegatedState{status: "rejected", delegated: "failed", reason: closed.reason}, closed)+ require.Contains(t, closed.reason, "no longer a member of this project")+ require.Equal(t, http.StatusForbidden, req.readSecret(t))+ })}func TestDelegatedAccessRequest_CallbackLimit(t *testing.T) {@@ -164,6 +215,7 @@ func TestDelegatedAccessRequest_DuplicateCallback(t *testing.T) {type delegatedRequest struct {tn *harness.Tenantproj *fixture.Project+ policyID uuid.UUIDrequester *harness.Principalsn *servicenow.ControlPlaneid uuid.UUID@@ -177,11 +229,12 @@ func newWaitingDelegatedRequest(t *testing.T) *delegatedRequest {tn := harness.From(t).NewTenant(t)proj := fixture.NewProject(t, tn, fixture.WithProjectType("secret-manager"))conn := newDelegatedApprovalSystem(t, tn)- newDelegatedAccessPolicy(t, proj, conn)+ policyID, _ := newDelegatedAccessPolicy(t, proj, conn)secretmanager.CreateSecret(t, proj, "dev", "DB_PASSWORD", "hunter2")req := &delegatedRequest{tn: tn,proj: proj,+ policyID: policyID,requester: proj.NewUser(t, fixture.WithPrincipalName("requester"), fixture.WithRoles("no-access")),sn: servicenow.Open(t, conn.FakenetAdmin(t), conn.Nonce()),}@@ -270,6 +323,14 @@ func sendCallback(ctx context.Context, client *api.ClientWithResponses, sysID, treturn res.StatusCode(), nil}+func (r *delegatedRequest) renamePolicy(t *testing.T) int {+ t.Helper()+ res, err := r.tn.Admin.API.UpdateAccessApprovalPolicyWithBodyWithResponse(t.Context(), r.policyID.String(),+ "application/json", jsonBody(t, map[string]any{"name": "renamed", "allowedSelfApprovals": false}))+ require.NoError(t, err)+ return res.StatusCode()+}+func (r *delegatedRequest) readSecret(t *testing.T) int {t.Helper()res, err := r.requester.API.GetSecretByNameV4WithResponse(t.Context(), "DB_PASSWORD", &api.GetSecretByNameV4Params{