Skip to content

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

feat(folders): removed old comments

akhilmhdh58d3f3945ab5
diff --git a/backend/src/controllers/v1/secretsFolderController.ts b/backend/src/controllers/v1/secretsFolderController.ts
index a750af53e3..06d68a41df 100644
--- a/backend/src/controllers/v1/secretsFolderController.ts
+++ b/backend/src/controllers/v1/secretsFolderController.ts
@@ -65,8 +65,7 @@ export const createFolder = async (req: Request, res: Response) => {
const folderVersion = new FolderVersion({
workspace: workspaceId,
environment,
- // root condition
- nodes: parentFolder || folders.nodes,
+ nodes: parentFolder,
});
await folderVersion.save();
diff --git a/backend/src/ee/helpers/secret.ts b/backend/src/ee/helpers/secret.ts
index f7edab06ea..b315310cb2 100644
--- a/backend/src/ee/helpers/secret.ts
+++ b/backend/src/ee/helpers/secret.ts
@@ -31,7 +31,6 @@ const takeSecretSnapshotHelper = async ({
workspace: workspaceId,
environment,
folder: folderId,
- // undefined means root thus collect all secrets
},
"_id"
).lean()
diff --git a/backend/src/middleware/requestErrorHandler.ts b/backend/src/middleware/requestErrorHandler.ts
index 1f1e9f9b2d..08aa0d5fd7 100644
--- a/backend/src/middleware/requestErrorHandler.ts
+++ b/backend/src/middleware/requestErrorHandler.ts
@@ -1,34 +1,45 @@
import * as Sentry from '@sentry/node';
-import { ErrorRequestHandler } from "express";
-import { InternalServerError } from "../utils/errors";
-import { getLogger } from "../utils/logger";
-import RequestError, { LogLevel } from "../utils/requestError";
-import { getNodeEnv } from '../config';
+import { ErrorRequestHandler } from 'express';
+import { InternalServerError } from '../utils/errors';
+import { getLogger } from '../utils/logger';
+import RequestError, { LogLevel } from '../utils/requestError';
-export const requestErrorHandler: ErrorRequestHandler = async (error: RequestError | Error, req, res, next) => {
- if (res.headersSent) return next();
- if ((await getNodeEnv()) !== "production") {
- /* eslint-disable no-console */
- console.log(error)
- /* eslint-enable no-console */
- }
+export const requestErrorHandler: ErrorRequestHandler = async (
+ error: RequestError | Error,
+ req,
+ res,
+ next
+) => {
+ if (res.headersSent) return next();
- //TODO: Find better way to type check for error. In current setting you need to cast type to get the functions and variables from RequestError
- if (!(error instanceof RequestError)) {
- error = InternalServerError({ context: { exception: error.message }, stack: error.stack });
- (await getLogger('backend-main')).log((<RequestError>error).levelName.toLowerCase(), (<RequestError>error).message)
- }
+ //TODO: Find better way to type check for error. In current setting you need to cast type to get the functions and variables from RequestError
+ if (!(error instanceof RequestError)) {
+ error = InternalServerError({
+ context: { exception: error.message },
+ stack: error.stack,
+ });
+ (await getLogger('backend-main')).log(
+ (<RequestError>error).levelName.toLowerCase(),
+ (<RequestError>error).message
+ );
+ }
- //* Set Sentry user identification if req.user is populated
- if (req.user !== undefined && req.user !== null) {
- Sentry.setUser({ email: (req.user as any).email })
- }
- //* Only sent error to Sentry if LogLevel is one of the following level 'ERROR', 'EMERGENCY' or 'CRITICAL'
- //* with this we will eliminate false-positive errors like 'BadRequestError', 'UnauthorizedRequestError' and so on
- if ([LogLevel.ERROR, LogLevel.EMERGENCY, LogLevel.CRITICAL].includes((<RequestError>error).level)) {
- Sentry.captureException(error)
- }
+ //* Set Sentry user identification if req.user is populated
+ if (req.user !== undefined && req.user !== null) {
+ Sentry.setUser({ email: (req.user as any).email });
+ }
+ //* Only sent error to Sentry if LogLevel is one of the following level 'ERROR', 'EMERGENCY' or 'CRITICAL'
+ //* with this we will eliminate false-positive errors like 'BadRequestError', 'UnauthorizedRequestError' and so on
+ if (
+ [LogLevel.ERROR, LogLevel.EMERGENCY, LogLevel.CRITICAL].includes(
+ (<RequestError>error).level
+ )
+ ) {
+ Sentry.captureException(error);
+ }
- res.status((<RequestError>error).statusCode).json((<RequestError>error).format(req))
- next()
-}
\ No newline at end of file
+ res
+ .status((<RequestError>error).statusCode)
+ .json((<RequestError>error).format(req));
+ next();
+};
diff --git a/backend/src/models/secret.ts b/backend/src/models/secret.ts
index 75163ccd16..ff34d99b1a 100644
--- a/backend/src/models/secret.ts
+++ b/backend/src/models/secret.ts
@@ -127,7 +127,6 @@ const secretSchema = new Schema<ISecret>(
required: true,
default: ENCODING_SCHEME_UTF8,
},
- // the full path to the secret in relation to folders
folder: {
type: String,
default: "root",