Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove Service Account from Zitadel when API key is deleted. #3908

Merged
merged 66 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
3b67e16
wip
bryan-robitaille Jun 4, 2024
ae0bbd8
reanme key files
bryan-robitaille Jun 14, 2024
b2d43fd
use hosted cloud versoin for PoC
bryan-robitaille Jun 14, 2024
2da31eb
Merge branch 'develop' into feature/service_account
bryan-robitaille Jun 14, 2024
d5eec05
remove hardcoded form id in utility script
bryan-robitaille Jun 19, 2024
b8e1d7b
Merge branch 'develop' into feature/service_account
bryan-robitaille Jun 26, 2024
7e839f0
Add setting for zitadel administration key
bryan-robitaille Jun 26, 2024
faa290c
Allow for encrypted settings
bryan-robitaille Jun 27, 2024
67177d0
use new encrypted setting for zitadel admin account
bryan-robitaille Jun 27, 2024
bc75e61
Ensure session storage is only checked on client
bryan-robitaille Jun 28, 2024
d9c6f74
wip - api settings only / no login with zitadel
bryan-robitaille Jul 2, 2024
fb01f36
revert to use nextauth react signout
bryan-robitaille Jul 2, 2024
7ef322c
Merge branch 'develop' into feature/service_account
bryan-robitaille Jul 8, 2024
c9caab5
update yarn package manager to 4.3.1
bryan-robitaille Jul 8, 2024
e5c556a
Merge branch 'develop' into feature/service_account
bryan-robitaille Jul 8, 2024
ae2e75e
Merge branch 'develop' into feature/service_account
bryan-robitaille Jul 8, 2024
cd18c86
update mock for encrypted in test
bryan-robitaille Jul 8, 2024
cd4ae98
Merge branch 'feature/service_account' of https://github.com/cds-snc/…
bryan-robitaille Jul 8, 2024
583d63f
make route not routable for retrival example
bryan-robitaille Jul 8, 2024
6a09bcc
Merge branch 'develop' of https://github.com/cds-snc/platform-forms-c…
bryan-robitaille Jul 9, 2024
e66509b
fix migrations after merge in from develop
bryan-robitaille Jul 10, 2024
3567324
Add audit logging on api service user CRUD
bryan-robitaille Jul 10, 2024
6543919
Merge branch 'develop' into feature/service_account
bryan-robitaille Jul 10, 2024
e7ac357
enable filtering on next-auth endpoint
bryan-robitaille Jul 10, 2024
d2ddfea
Add error check for missing env var
bryan-robitaille Jul 10, 2024
e094fa2
bump next and next-auth
bryan-robitaille Jul 10, 2024
8c3618c
remove logMessage
bryan-robitaille Jul 10, 2024
1afdb3b
Add a flag check for Settings API page and redirect
bryan-robitaille Jul 10, 2024
ba8cfab
move line back to where it was
bryan-robitaille Jul 10, 2024
f3d0ae6
remove temporary env vars from docker file
bryan-robitaille Jul 10, 2024
2946316
remove old conversion script
bryan-robitaille Jul 10, 2024
7043a41
Add new setting for zitadel provider
bryan-robitaille Jul 10, 2024
23b372f
Merge branch 'develop' into feature/service_account
bryan-robitaille Jul 10, 2024
4864cb2
Merge branch 'feature/service_account' of https://github.com/cds-snc/…
bryan-robitaille Jul 10, 2024
4dea145
add zitadel node sdk
bryan-robitaille Jul 11, 2024
5a642a3
wip
bryan-robitaille Jul 12, 2024
6cdf2e9
Merge branch 'develop' into feature/service_account
bryan-robitaille Aug 20, 2024
8b8f31d
refactor prisma migrations to align for merge timeline
bryan-robitaille Aug 20, 2024
460c27a
reset back to what it should be without encrypted settings
bryan-robitaille Aug 21, 2024
8510c6b
remove encrypted settings from this branch
bryan-robitaille Aug 21, 2024
23aae70
remove change from other feature
bryan-robitaille Aug 22, 2024
753e125
Remove changes that were part of prototyping
bryan-robitaille Aug 22, 2024
53fe6e1
fix changelog formatting
bryan-robitaille Aug 22, 2024
98d7f37
rework api actions to delete user
bryan-robitaille Aug 22, 2024
60d2482
remove utility script. it will be hosted in the api repo instead
bryan-robitaille Aug 22, 2024
b5bc981
Merge branch 'develop' into feature/service_account
bryan-robitaille Aug 22, 2024
96f5b2d
refactoring and delete key on form deletion
bryan-robitaille Aug 23, 2024
2bc701a
add flag check
bryan-robitaille Aug 26, 2024
189cfbb
update yarn again
bryan-robitaille Aug 26, 2024
e3c76c3
globally mock redis
bryan-robitaille Aug 26, 2024
2aefe14
Need to add check for Zitadel flag when deleting a form
bryan-robitaille Aug 26, 2024
112c63e
artifact from updating yarn to 4.4.1
bryan-robitaille Aug 26, 2024
bf928f0
Merge branch 'develop' into feature/service_account
bryan-robitaille Aug 26, 2024
d797469
small prisma fixes from leftover refactors in the past
bryan-robitaille Aug 26, 2024
04653ff
wip tests for service account lib
bryan-robitaille Aug 26, 2024
8fe2725
Merge branch 'feature/service_account' of https://github.com/cds-snc/…
bryan-robitaille Aug 26, 2024
b1ddca9
wip, fix overriding mock on auth
bryan-robitaille Aug 26, 2024
68d55a3
switch jest env to node and ensure prisma is only run on node
bryan-robitaille Aug 27, 2024
4fe295b
finished up jest tests
bryan-robitaille Aug 27, 2024
5eb9aba
remove unrequired mock
bryan-robitaille Aug 27, 2024
ed2cb92
remove unused import
bryan-robitaille Aug 27, 2024
c61fd53
Merge branch 'develop' into feature/service_account
bryan-robitaille Aug 28, 2024
13f74fc
Merge branch 'develop' into feature/service_account
bryan-robitaille Sep 16, 2024
2367297
add missing line break on import
bryan-robitaille Sep 16, 2024
35f603b
remove debug logs from api key module
bryan-robitaille Sep 16, 2024
6f1727f
use right flag
bryan-robitaille Sep 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.1.1.cjs

This file was deleted.

925 changes: 925 additions & 0 deletions .yarn/releases/yarn-4.4.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.1.1.cjs
yarnPath: .yarn/releases/yarn-4.4.1.cjs
77 changes: 31 additions & 46 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions __tests__/api/acceptable-use.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

import { createMocks } from "node-mocks-http";
import acceptableUse from "old_pages/api/acceptableuse";
import { setAcceptableUse } from "@lib/cache/acceptableUseCache";
Expand Down
4 changes: 0 additions & 4 deletions __tests__/api/account/confirmpassword.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

/* eslint-disable @typescript-eslint/no-explicit-any */
import { createMocks, RequestMethod } from "node-mocks-http";
import { getCsrfToken } from "@lib/client/csrfToken";
Expand Down
4 changes: 0 additions & 4 deletions __tests__/api/account/forgotpassword.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

/* eslint-disable @typescript-eslint/no-explicit-any */
import { createMocks, RequestMethod } from "node-mocks-http";
import { getCsrfToken } from "@lib/client/csrfToken";
Expand Down
3 changes: 0 additions & 3 deletions __tests__/api/account/register.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* @jest-environment node
*/
/* eslint-disable @typescript-eslint/no-explicit-any */
import { createMocks, RequestMethod } from "node-mocks-http";
import { getCsrfToken } from "@lib/client/csrfToken";
Expand Down
3 changes: 0 additions & 3 deletions __tests__/api/flags.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* @jest-environment node
*/
import { createMocks } from "node-mocks-http";
import { getServerSession } from "next-auth/next";
import enable from "old_pages/api/flags/[key]/enable";
Expand Down
4 changes: 0 additions & 4 deletions __tests__/api/id/form/apiUsers.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

/* eslint-disable @typescript-eslint/no-explicit-any */

import { createMocks, RequestMethod } from "node-mocks-http";
Expand Down
3 changes: 0 additions & 3 deletions __tests__/api/id/form/submission/confirm.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* @jest-environment node
*/
/* eslint-disable @typescript-eslint/no-explicit-any */
import { createMocks, RequestMethod } from "node-mocks-http";
import confirm from "old_pages/api/id/[form]/submission/confirm";
Expand Down
3 changes: 0 additions & 3 deletions __tests__/api/id/form/submission/report.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* @jest-environment node
*/
/* eslint-disable @typescript-eslint/no-explicit-any */
import { createMocks, RequestMethod } from "node-mocks-http";
import report from "old_pages/api/id/[form]/submission/report";
Expand Down
3 changes: 0 additions & 3 deletions __tests__/api/notify-callbacks.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* @jest-environment node
*/
import { createMocks } from "node-mocks-http";
import notifyCallback from "../../pages/api/notify-callback";
import { SQSClient } from "@aws-sdk/client-sqs";
Expand Down
3 changes: 0 additions & 3 deletions __tests__/api/request/publish.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* @jest-environment node
*/
/* eslint-disable @typescript-eslint/no-explicit-any */
import { createMocks, RequestMethod } from "node-mocks-http";
import publish from "old_pages/api/request/publish";
Expand Down
3 changes: 0 additions & 3 deletions __tests__/api/request/support.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* @jest-environment node
*/
/* eslint-disable @typescript-eslint/no-explicit-any */
import { createMocks, RequestMethod } from "node-mocks-http";
import support from "old_pages/api/request/support";
Expand Down
3 changes: 0 additions & 3 deletions __tests__/api/settings.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* @jest-environment node
*/
import { createMocks, RequestMethod } from "node-mocks-http";
import settings from "old_pages/api/settings/[settingId]";
import settingsRoot from "old_pages/api/settings/index";
Expand Down
4 changes: 0 additions & 4 deletions __tests__/api/templates.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

/* eslint-disable @typescript-eslint/no-explicit-any */
import { createMocks, RequestMethod } from "node-mocks-http";
import Redis from "ioredis-mock";
Expand Down
4 changes: 0 additions & 4 deletions __tests__/api/users.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment node
*/

/* eslint-disable @typescript-eslint/no-explicit-any */
import { createMocks } from "node-mocks-http";
import Redis from "ioredis-mock";
Expand Down
8 changes: 8 additions & 0 deletions __utils__/mocks/redis/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Redis from "ioredis-mock";

jest.mock("@lib/integration/redisConnector", () => {
const redis = new Redis();
return {
getRedisInstance: jest.fn(async () => redis),
};
});
27 changes: 17 additions & 10 deletions __utils__/prismaConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,23 @@ export const {
} = Prisma;

jest.mock("@lib/integration/prismaConnector", () => {
const originalModule = jest.requireActual("@lib/integration/prismaConnector");
return {
__esModule: true,
...originalModule,
prisma: mockDeep<PrismaClient>(),
};
});

beforeEach(() => {
mockReset(prismaMock);
// Only mock prisma when were running in the Node jest environment
if (typeof window === "undefined") {
const originalModule = jest.requireActual("@lib/integration/prismaConnector");
return {
__esModule: true,
...originalModule,
prisma: mockDeep<PrismaClient>(),
};
} else {
return {};
}
});
// Only mock prisma when were running in the Node jest environment
if (typeof window === "undefined") {
beforeEach(() => {
mockReset(prismaMock);
});
}

export const prismaMock = prisma as unknown as DeepMockProxy<PrismaClient>;
5 changes: 0 additions & 5 deletions __utils__/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,6 @@ jest.mock("@i18n", () => {
};
});

jest.mock("@lib/integration/redisConnector", () => ({
__esModule: true,
getRedisInstance: () => jest.fn(),
}));

jest.mock("@lib/auditLogs", () => ({
__esModule: true,
logEvent: jest.fn(jest.fn(async () => undefined)),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React from "react";
import { cleanup, render } from "@testing-library/react";
import { AddElementButton } from "../AddElementButton";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React from "react";
import { cleanup, render, fireEvent } from "@testing-library/react";
import { ElementDialog } from "../ElementDialog";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React from "react";
import { cleanup, screen, render, act, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React from "react";
import { cleanup, render, act } from "@testing-library/react";
import { Option } from "../Option";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React from "react";
import { cleanup, render, waitFor } from "@testing-library/react";
import { Options } from "../Options";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React from "react";
import { cleanup, render, act, waitFor } from "@testing-library/react";
import { Question } from "../question/Question";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React from "react";
import { cleanup, render, act } from "@testing-library/react";
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React from "react";
import { cleanup } from "@testing-library/react";
import { RichTextLocked } from "../RichTextLocked";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React from "react";
import { cleanup } from "@testing-library/react";
import { ShortAnswer } from "../ShortAnswer";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React from "react";
import { render, cleanup, act } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React from "react";
import { render, waitFor, waitForElementToBeRemoved } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React from "react";
import { render, cleanup } from "@testing-library/react";
import { LineItem } from "../LineItem";
Expand All @@ -24,6 +27,9 @@ describe("LineItem", () => {
await userEvent.click(removeButtons[0]);
expect(mockCallback).toHaveBeenCalledTimes(1);
expect(mockCallback).toHaveBeenCalledWith("31-12-XCRV");
expect(removeButtons[0]).toHaveAttribute("aria-label", "downloadResponsesModals.lineItemEntries.remove 31-12-XCRV");
expect(removeButtons[0]).toHaveAttribute(
"aria-label",
"downloadResponsesModals.lineItemEntries.remove 31-12-XCRV"
);
});
});
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React, { useState } from "react";
import { render, cleanup } from "@testing-library/react";
import { LineItemEntries } from "../LineItemEntries";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React from "react";
import { render, cleanup } from "@testing-library/react";
import { LineItems } from "../LineItems";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @jest-environment jsdom
*/
import React from "react";
import { act, render } from "@testing-library/react";
import { DownloadTable } from "../DownloadTable";
Expand Down
Loading
Loading