Skip to content

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

feat: resovled ts error and recovery account type

=bdf97036c54b
diff --git a/backend/src/ee/services/secret-rotation/secret-rotation-queue/secret-rotation-queue.ts b/backend/src/ee/services/secret-rotation/secret-rotation-queue/secret-rotation-queue.ts
index 0464d23d26..4348e93475 100644
--- a/backend/src/ee/services/secret-rotation/secret-rotation-queue/secret-rotation-queue.ts
+++ b/backend/src/ee/services/secret-rotation/secret-rotation-queue/secret-rotation-queue.ts
@@ -267,14 +267,14 @@ export const secretRotationQueueFactory = ({
if (provider.template.functions.set?.pre) {
secretRotationPreSetFn(provider.template.functions.set.pre, newCredential);
}
- await secretRotationHttpSetFn(provider.template.functions.set, newCredential);
+ await secretRotationHttpSetFn();
// now test
- await secretRotationHttpFn(provider.template.functions.test, newCredential);
+ await secretRotationHttpFn();
if (variables.creds.length === 2) {
const deleteCycleCred = variables.creds.pop();
if (deleteCycleCred && provider.template.functions.remove) {
const deleteCycleVar = { inputs: variables.inputs, ...deleteCycleCred };
- await secretRotationHttpFn(provider.template.functions.remove, deleteCycleVar);
+ await secretRotationHttpFn();
}
}
}
diff --git a/backend/src/services/account-recovery/account-recovery-service.ts b/backend/src/services/account-recovery/account-recovery-service.ts
index b37247e654..c773f888a8 100644
--- a/backend/src/services/account-recovery/account-recovery-service.ts
+++ b/backend/src/services/account-recovery/account-recovery-service.ts
@@ -112,7 +112,7 @@ export const accountRecoveryServiceFactory = ({
const token = crypto.jwt().sign(
{
- authTokenType: AuthTokenType.SIGNUP_TOKEN,
+ authTokenType: AuthTokenType.ACCOUNT_RECOVERY_TOKEN,
userId: user.id
},
cfg.AUTH_SECRET,
diff --git a/backend/src/services/auth/auth-fns.ts b/backend/src/services/auth/auth-fns.ts
index 54bbc8a414..e99406f1f6 100644
--- a/backend/src/services/auth/auth-fns.ts
+++ b/backend/src/services/auth/auth-fns.ts
@@ -3,7 +3,7 @@ import { request } from "@app/lib/config/request";
import { crypto } from "@app/lib/crypto";
import { BadRequestError, ForbiddenRequestError, UnauthorizedError } from "@app/lib/errors";
-import { AuthModeSignUpTokenPayload, AuthTokenType } from "./auth-type";
+import { AuthModeAccountRecoveryTokenPayload, AuthModeSignUpTokenPayload, AuthTokenType } from "./auth-type";
export const extractBearerToken = (token?: string): string => {
if (!token) {
@@ -43,9 +43,9 @@ export const validatePasswordResetAuthorization = (token?: string) => {
const appCfg = getConfig();
const authTokenValue = extractBearerToken(token);
- const decodedToken = crypto.jwt().verify(authTokenValue, appCfg.AUTH_SECRET) as AuthModeSignUpTokenPayload;
+ const decodedToken = crypto.jwt().verify(authTokenValue, appCfg.AUTH_SECRET) as AuthModeAccountRecoveryTokenPayload;
- if (decodedToken.authTokenType !== AuthTokenType.SIGNUP_TOKEN) {
+ if (decodedToken.authTokenType !== AuthTokenType.ACCOUNT_RECOVERY_TOKEN) {
throw new UnauthorizedError({
message: `The provided authentication token type is not supported.`
});
diff --git a/backend/src/services/auth/auth-type.ts b/backend/src/services/auth/auth-type.ts
index c7e6da05a5..0be5638589 100644
--- a/backend/src/services/auth/auth-type.ts
+++ b/backend/src/services/auth/auth-type.ts
@@ -22,7 +22,8 @@ export enum AuthTokenType {
SERVICE_REFRESH_TOKEN = "serviceRefreshToken",
IDENTITY_ACCESS_TOKEN = "identityAccessToken",
SCIM_TOKEN = "scimToken",
- GATEWAY_ACCESS_TOKEN = "gatewayAccessToken"
+ GATEWAY_ACCESS_TOKEN = "gatewayAccessToken",
+ ACCOUNT_RECOVERY_TOKEN = "accountRecoveryToken"
}
// Result state from processProviderCallback — determines what the route handler should do
@@ -117,6 +118,11 @@ export type AuthModeSignUpTokenPayload = {
lastName?: string;
};
+export type AuthModeAccountRecoveryTokenPayload = {
+ authTokenType: AuthTokenType.ACCOUNT_RECOVERY_TOKEN;
+ userId: string;
+};
+
export enum MfaMethod {
EMAIL = "email",
TOTP = "totp",