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
Update test dummy variables
Tuan Dangc3a1d03a9b61
diff --git a/backend/test-resources/env-vars.js b/backend/test-resources/env-vars.jsindex 6702649c1f..3149a27c9a 100644--- a/backend/test-resources/env-vars.js+++ b/backend/test-resources/env-vars.js@@ -7,4 +7,6 @@ process.env.NODE_ENV = 'test';process.env.JWT_SIGNUP_SECRET= "38ea90fb7998b92176080f457d890392"process.env.JWT_REFRESH_SECRET= "7764c7bbf3928ad501591a3e005eb364"process.env.JWT_AUTH_SECRET= "5239fea3a4720c0e524f814a540e14a2"-process.env.JWT_SERVICE_SECRET= "8509fb8b90c9b53e9e61d1e35826dcb5"\ No newline at end of file+process.env.JWT_SERVICE_SECRET= "8509fb8b90c9b53e9e61d1e35826dcb5"+process.env.ENCRYPTION_KEY="e05f54dffd58b5ab9b09e4c6fca7aff7"+process.env.ROOT_ENCRYPTION_KEY="MJA3DWJXjHiL6xjkUI2QCQuy/D+/SAbRNU1+rEo9gvQ="diff --git a/backend/tests/unit-tests/utils/crypto.test.ts b/backend/tests/unit-tests/utils/crypto.test.tsindex 7509e53b96..d50b3057c9 100644--- a/backend/tests/unit-tests/utils/crypto.test.ts+++ b/backend/tests/unit-tests/utils/crypto.test.ts@@ -1,9 +1,7 @@import { describe, test, expect } from '@jest/globals';import {decryptAsymmetric,- decryptSymmetric,encryptAsymmetric,- encryptSymmetric} from '../../../src/utils/crypto';describe('Crypto', () => {@@ -153,99 +151,4 @@ describe('Crypto', () => {});});});-- describe('encryptSymmetric', () => {- let plaintext: string;- const key = '7e8ee7e5cc667b9c1829783ad31f36f4';-- test('should encrypt plaintext with the given key', () => {- plaintext = 'secret-message';- const { ciphertext, iv, tag } = encryptSymmetric({ plaintext, key });- expect(ciphertext).toBeDefined();- expect(iv).toBeDefined();- expect(tag).toBeDefined();- });-- test('should throw an error when plaintext is undefined', () => {- const invalidKey = 'invalid-key';- expect(() => {- encryptSymmetric({ plaintext, key: invalidKey });- }).toThrowError('Invalid key length');- });-- test('should throw an error when invalid key is provided', () => {- plaintext = 'secret-message';- const invalidKey = 'invalid-key';-- expect(() => {- encryptSymmetric({ plaintext, key: invalidKey });- }).toThrowError('Invalid key length');- });- });-- describe('decryptSymmetric', () => {- const plaintext = 'secret-message';- const key = '7e8ee7e5cc667b9c1829783ad31f36f4';- const { ciphertext, iv, tag } = encryptSymmetric({ plaintext, key });-- test('should decrypt encrypted plaintext', () => {- const result = decryptSymmetric({- ciphertext,- iv,- tag,- key- });-- expect(result).toBeDefined();- expect(result).toEqual(plaintext);- });-- test('should fail if ciphertext is modified', () => {- const modifieldCiphertext = 'abcdefghijklmnopqrstuvwxyz';- expect(() => {- decryptSymmetric({- ciphertext: modifieldCiphertext,- iv,- tag,- key- });- }).toThrowError('Unsupported state or unable to authenticate data');- });-- test('should fail if iv is modified', () => {- const modifiedIv = 'abcdefghijklmnopqrstuvwxyz';- expect(() => {- decryptSymmetric({- ciphertext,- iv: modifiedIv,- tag,- key- });- }).toThrowError('Unsupported state or unable to authenticate data');- });-- test('should fail if tag is modified', () => {- const modifiedTag = 'abcdefghijklmnopqrstuvwxyz';- expect(() => {- decryptSymmetric({- ciphertext,- iv,- tag: modifiedTag,- key- });- }).toThrowError(/Invalid authentication tag length: \d+/);- });-- test('should throw an error when decryption fails', () => {- const invalidKey = 'invalid-key';- expect(() => {- decryptSymmetric({- ciphertext,- iv,- tag,- key: invalidKey- });- }).toThrowError('Invalid key length');- });- });});