mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 23:52:09 +00:00
feat(fips): requested changes & additional fixes
This commit is contained in:
@@ -13,7 +13,6 @@ import {
|
||||
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";
|
||||
import { getConfig } from "@app/lib/config/env";
|
||||
import { crypto } from "@app/lib/crypto";
|
||||
import { CompleteJWTPayload } from "@app/lib/crypto/cryptography/types";
|
||||
import {
|
||||
BadRequestError,
|
||||
ForbiddenRequestError,
|
||||
@@ -81,7 +80,7 @@ export const identityJwtAuthServiceFactory = ({
|
||||
orgId: identityMembershipOrg.orgId
|
||||
});
|
||||
|
||||
const decodedToken = crypto.jwt().decode(jwtValue, { complete: true }) as CompleteJWTPayload;
|
||||
const decodedToken = crypto.jwt().decode(jwtValue, { complete: true });
|
||||
if (!decodedToken) {
|
||||
throw new UnauthorizedError({
|
||||
message: "Invalid JWT"
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";
|
||||
import { getConfig } from "@app/lib/config/env";
|
||||
import { crypto } from "@app/lib/crypto";
|
||||
import { CompleteJWTPayload } from "@app/lib/crypto/cryptography/types";
|
||||
import {
|
||||
BadRequestError,
|
||||
ForbiddenRequestError,
|
||||
@@ -95,7 +94,7 @@ export const identityOidcAuthServiceFactory = ({
|
||||
);
|
||||
const jwksUri = discoveryDoc.jwks_uri;
|
||||
|
||||
const decodedToken = crypto.jwt().decode(oidcJwt, { complete: true }) as CompleteJWTPayload;
|
||||
const decodedToken = crypto.jwt().decode(oidcJwt, { complete: true });
|
||||
if (!decodedToken) {
|
||||
throw new UnauthorizedError({
|
||||
message: "Invalid JWT"
|
||||
|
||||
@@ -497,7 +497,7 @@ export const orgServiceFactory = ({
|
||||
orgName: string;
|
||||
userEmail?: string | null;
|
||||
}) => {
|
||||
const { privateKey, publicKey } = crypto.encryption().asymmetric().generateKeyPair();
|
||||
const { privateKey, publicKey } = await crypto.encryption().asymmetric().generateKeyPair();
|
||||
const key = crypto.randomBytes(32).toString("base64");
|
||||
const {
|
||||
ciphertext: encryptedPrivateKey,
|
||||
|
||||
@@ -59,7 +59,7 @@ export const getBotKeyFnFactory = (
|
||||
publicKey: projectV1Keys.senderPublicKey,
|
||||
privateKey: userPrivateKey
|
||||
});
|
||||
const botKey = crypto.encryption().asymmetric().generateKeyPair();
|
||||
const botKey = await crypto.encryption().asymmetric().generateKeyPair();
|
||||
const { iv, tag, ciphertext, encoding, algorithm } = crypto
|
||||
.encryption()
|
||||
.encryptWithRootEncryptionKey(botKey.privateKey);
|
||||
|
||||
@@ -54,7 +54,7 @@ export const projectBotServiceFactory = ({
|
||||
if (doc) return doc;
|
||||
|
||||
const keys =
|
||||
privateKey && publicKey ? { privateKey, publicKey } : crypto.encryption().asymmetric().generateKeyPair();
|
||||
privateKey && publicKey ? { privateKey, publicKey } : await crypto.encryption().asymmetric().generateKeyPair();
|
||||
|
||||
const { iv, tag, ciphertext, encoding, algorithm } = crypto
|
||||
.encryption()
|
||||
|
||||
Reference in New Issue
Block a user