diff --git a/.jules/sentinel.md b/.jules/sentinel.md new file mode 100644 index 0000000000..e8f7fb96b0 --- /dev/null +++ b/.jules/sentinel.md @@ -0,0 +1,4 @@ +## 2025-05-15 - Exposure of Sensitive Data in Error Parameters +**Vulnerability:** Sensitive data (JWT tokens and License Keys) were included in the `params` field of `ActivepiecesError` objects, which are directly serialized and sent to the client by the global error handler in `packages/server/api/src/app/helper/error-handler.ts`. +**Learning:** The global error handler's behavior of exposing the entire `params` object means that any data placed there is effectively public if the error is triggered. This creates a leak if `params` is used to provide context for debugging that includes secrets. +**Prevention:** Strictly define error parameter types in `packages/shared/src/lib/common/activepieces-error.ts` to only include non-sensitive fields. Use `Record` or empty objects for errors related to sensitive credentials. diff --git a/packages/server/api/src/app/ee/connection-keys/connection-key.service.ts b/packages/server/api/src/app/ee/connection-keys/connection-key.service.ts index 86efae473a..ad94b1287d 100644 --- a/packages/server/api/src/app/ee/connection-keys/connection-key.service.ts +++ b/packages/server/api/src/app/ee/connection-keys/connection-key.service.ts @@ -46,9 +46,7 @@ export const connectionKeyService = (log: FastifyBaseLogger) => ({ if (connectionName == null) { throw new ActivepiecesError({ code: ErrorCode.INVALID_OR_EXPIRED_JWT_TOKEN, - params: { - token, - }, + params: {}, }) } const connection = await appConnectionService(log).getOne({ @@ -74,9 +72,7 @@ export const connectionKeyService = (log: FastifyBaseLogger) => ({ if (connectionName == null) { throw new ActivepiecesError({ code: ErrorCode.INVALID_OR_EXPIRED_JWT_TOKEN, - params: { - token: request.token, - }, + params: {}, }) } diff --git a/packages/server/api/src/app/ee/license-keys/license-keys-controller.ts b/packages/server/api/src/app/ee/license-keys/license-keys-controller.ts index 753ebcb95b..5930ff6bda 100644 --- a/packages/server/api/src/app/ee/license-keys/license-keys-controller.ts +++ b/packages/server/api/src/app/ee/license-keys/license-keys-controller.ts @@ -40,9 +40,7 @@ export const licenseKeysController: FastifyPluginAsyncTypebox = async (app) => { if (isNil(key)) { throw new ActivepiecesError({ code: ErrorCode.INVALID_LICENSE_KEY, - params: { - key: licenseKey, - }, + params: {}, }) } await platformService.update({ diff --git a/packages/shared/src/lib/common/activepieces-error.ts b/packages/shared/src/lib/common/activepieces-error.ts index 0805b4144c..7911c85f79 100755 --- a/packages/shared/src/lib/common/activepieces-error.ts +++ b/packages/shared/src/lib/common/activepieces-error.ts @@ -278,9 +278,7 @@ ErrorCode.FLOW_IN_USE, export type InvalidJwtTokenErrorParams = BaseErrorParams< ErrorCode.INVALID_OR_EXPIRED_JWT_TOKEN, -{ - token: string -} +Record > export type TestTriggerFailedErrorParams = BaseErrorParams< @@ -405,9 +403,7 @@ ErrorCode.EXISTING_ALERT_CHANNEL, export type InvalidOtpParams = BaseErrorParams> -export type InvalidLicenseKeyParams = BaseErrorParams +export type InvalidLicenseKeyParams = BaseErrorParams> export type EmailAlreadyHasActivationKey = BaseErrorParams