Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat(infisical-pg): fixed ts issue on passport type change

Akhil Mohan295c1e5d4a40
diff --git a/backend-pg/src/ee/routes/v1/saml-router.ts b/backend-pg/src/ee/routes/v1/saml-router.ts
index b74bc20817..b8387f4046 100644
--- a/backend-pg/src/ee/routes/v1/saml-router.ts
+++ b/backend-pg/src/ee/routes/v1/saml-router.ts
@@ -127,7 +127,7 @@ export const registerSamlRouter = async (server: FastifyZodProvider) => {
// this is due to zod type difference
}) as any,
handler: (req, res) => {
- if (req.passportUser.isCompleted) {
+ if (req.passportUser.isUserCompleted) {
return res.redirect(
`${appCfg.SITE_URL}/login/sso?token=${encodeURIComponent(
req.passportUser.providerAuthToken
diff --git a/backend-pg/src/ee/services/secret-snapshot/secret-snapshot-service.ts b/backend-pg/src/ee/services/secret-snapshot/secret-snapshot-service.ts
index f8ba4e1875..3b32712bdd 100644
--- a/backend-pg/src/ee/services/secret-snapshot/secret-snapshot-service.ts
+++ b/backend-pg/src/ee/services/secret-snapshot/secret-snapshot-service.ts
@@ -2,6 +2,7 @@ import { ForbiddenError } from "@casl/ability";
import { BadRequestError, InternalServerError } from "@app/lib/errors";
import { groupBy } from "@app/lib/fn";
+import { logger } from "@app/lib/logger";
import { TSecretDalFactory } from "@app/services/secret/secret-dal";
import { TSecretVersionDalFactory } from "@app/services/secret/secret-version-dal";
import { TSecretFolderDalFactory } from "@app/services/secret-folder/secret-folder-dal";
@@ -19,7 +20,6 @@ import {
import { TSnapshotDalFactory } from "./snapshot-dal";
import { TSnapshotFolderDalFactory } from "./snapshot-folder-dal";
import { TSnapshotSecretDalFactory } from "./snapshot-secret-dal";
-import { logger } from "@app/lib/logger";
type TSecretSnapshotServiceFactoryDep = {
snapshotDal: TSnapshotDalFactory;
diff --git a/backend-pg/src/server/routes/v1/sso-router.ts b/backend-pg/src/server/routes/v1/sso-router.ts
index 7d5436a6f8..a5655298ae 100644
--- a/backend-pg/src/server/routes/v1/sso-router.ts
+++ b/backend-pg/src/server/routes/v1/sso-router.ts
@@ -114,7 +114,6 @@ export const registerSsoRouter = async (server: FastifyZodProvider) => {
authMethod: AuthMethod.GITLAB,
callbackPort: req.query.state as string
});
- console.log({ isUserCompleted, providerAuthToken });
return cb(null, { isUserCompleted, providerAuthToken });
}
diff --git a/backend-pg/src/server/routes/v3/signup-router.ts b/backend-pg/src/server/routes/v3/signup-router.ts
index a3e9414773..f7f7e9ecb3 100644
--- a/backend-pg/src/server/routes/v3/signup-router.ts
+++ b/backend-pg/src/server/routes/v3/signup-router.ts
@@ -87,7 +87,7 @@ export const registerSignupRouter = async (server: FastifyZodProvider) => {
...req.body,
ip: req.realIp,
userAgent,
- authorization: req.headers.authorization
+ authorization: req.headers.authorization as string
});
res.setCookie("jid", refreshToken, {
diff --git a/backend-pg/src/services/auth/auth-fns.ts b/backend-pg/src/services/auth/auth-fns.ts
index 9a5c0f14c4..8a5882bfc7 100644
--- a/backend-pg/src/services/auth/auth-fns.ts
+++ b/backend-pg/src/services/auth/auth-fns.ts
@@ -1,11 +1,13 @@
-import { getConfig } from "@app/lib/config/env";
import jwt from "jsonwebtoken";
+
+import { getConfig } from "@app/lib/config/env";
+import { BadRequestError, UnauthorizedError } from "@app/lib/errors";
+
import {
AuthModeProviderJwtTokenPayload,
AuthModeProviderSignUpTokenPayload,
AuthTokenType
} from "./auth-type";
-import { BadRequestError, UnauthorizedError } from "@app/lib/errors";
export const validateProviderAuthToken = (providerToken: string, email: string) => {
if (!providerToken) throw new UnauthorizedError();
@@ -15,7 +17,6 @@ export const validateProviderAuthToken = (providerToken: string, email: string)
appCfg.JWT_AUTH_SECRET
) as AuthModeProviderJwtTokenPayload;
- console.log(decodedToken);
if (decodedToken.authTokenType !== AuthTokenType.PROVIDER_TOKEN) throw new UnauthorizedError();
if (decodedToken.email !== email) throw new Error("Invalid auth credentials");
};
diff --git a/backend-pg/src/services/auth/auth-login-service.ts b/backend-pg/src/services/auth/auth-login-service.ts
index 1fe9c1afe8..9815468e36 100644
--- a/backend-pg/src/services/auth/auth-login-service.ts
+++ b/backend-pg/src/services/auth/auth-login-service.ts
@@ -9,6 +9,7 @@ import { TAuthTokenServiceFactory } from "../auth-token/auth-token-service";
import { TokenType } from "../auth-token/auth-token-types";
import { SmtpTemplates, TSmtpService } from "../smtp/smtp-service";
import { TUserDalFactory } from "../user/user-dal";
+import { validateProviderAuthToken } from "./auth-fns";
import {
TLoginClientProofDTO,
TLoginGenServerPublicKeyDTO,
@@ -16,7 +17,6 @@ import {
TVerifyMfaTokenDTO
} from "./auth-login-type";
import { AuthMethod, AuthTokenType } from "./auth-type";
-import { validateProviderAuthToken } from "./auth-fns";
type TAuthLoginServiceFactoryDep = {
userDal: TUserDalFactory;
diff --git a/backend-pg/src/services/auth/auth-signup-service.ts b/backend-pg/src/services/auth/auth-signup-service.ts
index 80f7b5276b..62437c9a9f 100644
--- a/backend-pg/src/services/auth/auth-signup-service.ts
+++ b/backend-pg/src/services/auth/auth-signup-service.ts
@@ -13,9 +13,9 @@ import { TOrgServiceFactory } from "../org/org-service";
import { SmtpTemplates, TSmtpService } from "../smtp/smtp-service";
import { TUserDalFactory } from "../user/user-dal";
import { TAuthDalFactory } from "./auth-dal";
+import { validateProviderAuthToken, validateSignUpAuthorization } from "./auth-fns";
import { TCompleteAccountInviteDTO, TCompleteAccountSignupDTO } from "./auth-signup-type";
import { AuthMethod, AuthTokenType } from "./auth-type";
-import { validateProviderAuthToken, validateSignUpAuthorization } from "./auth-fns";
type TAuthSignupDep = {
authDal: TAuthDalFactory;
diff --git a/backend-pg/src/services/integration/integration-service.ts b/backend-pg/src/services/integration/integration-service.ts
index 65853c7b6a..531c67247c 100644
--- a/backend-pg/src/services/integration/integration-service.ts
+++ b/backend-pg/src/services/integration/integration-service.ts
@@ -9,6 +9,7 @@ import { BadRequestError } from "@app/lib/errors";
import { TProjectPermission } from "@app/lib/types";
import { TIntegrationAuthDalFactory } from "../integration-auth/integration-auth-dal";
+import { TSecretQueueFactory } from "../secret/secret-queue";
import { TSecretFolderDalFactory } from "../secret-folder/secret-folder-dal";
import { TIntegrationDalFactory } from "./integration-dal";
import {
@@ -16,7 +17,6 @@ import {
TDeleteIntegrationDTO,
TUpdateIntegrationDTO
} from "./integration-types";
-import { TSecretQueueFactory } from "../secret/secret-queue";
type TIntegrationServiceFactoryDep = {
integrationDal: TIntegrationDalFactory;
diff --git a/backend-pg/src/services/project-env/project-env-service.ts b/backend-pg/src/services/project-env/project-env-service.ts
index 0781b3eefe..24c909a38f 100644
--- a/backend-pg/src/services/project-env/project-env-service.ts
+++ b/backend-pg/src/services/project-env/project-env-service.ts
@@ -9,9 +9,9 @@ import {
import { BadRequestError } from "@app/lib/errors";
import { TProjectDalFactory } from "../project/project-dal";
+import { TSecretFolderDalFactory } from "../secret-folder/secret-folder-dal";
import { TProjectEnvDalFactory } from "./project-env-dal";
import { TCreateEnvDTO, TDeleteEnvDTO, TUpdateEnvDTO } from "./project-env-types";
-import { TSecretFolderDalFactory } from "../secret-folder/secret-folder-dal";
type TProjectEnvServiceFactoryDep = {
projectEnvDal: TProjectEnvDalFactory;
diff --git a/backend-pg/src/services/webhook/webhook-fns.ts b/backend-pg/src/services/webhook/webhook-fns.ts
index d661bf0162..3ef054e2a2 100644
--- a/backend-pg/src/services/webhook/webhook-fns.ts
+++ b/backend-pg/src/services/webhook/webhook-fns.ts
@@ -7,10 +7,10 @@ import { getConfig } from "@app/lib/config/env";
import { request } from "@app/lib/config/request";
import { decryptSymmetric, decryptSymmetric128BitHexKeyUTF8 } from "@app/lib/crypto";
import { BadRequestError } from "@app/lib/errors";
+import { logger } from "@app/lib/logger";
import { TProjectEnvDalFactory } from "../project-env/project-env-dal";
import { TWebhookDalFactory } from "./webhook-dal";
-import { logger } from "@app/lib/logger";
const WEBHOOK_TRIGGER_TIMEOUT = 15 * 1000;
export const triggerWebhookRequest = async (