Skip to content

Version/2.3.8 - #2818

Closed
DiogoTravalha wants to merge 30 commits into
evolution-foundation:mainfrom
unobject-dev:version/2.3.8
Closed

DiogoTravalha wants to merge 30 commits into
evolution-foundation:mainfrom
unobject-dev:version/2.3.8

Conversation

@DiogoTravalha

@DiogoTravalha DiogoTravalha commented Dec 3, 2026 •

Copy link
Copy Markdown

Summary by Sourcery

Improve WhatsApp instance management and caching while updating dependency, SQS, and deployment support.

New Features:

  • Add an instance profile endpoint that returns the stored profile for an instance.
  • Support local SQS-compatible endpoints through the SQS_DEV_QUEUE_URL configuration option.
  • Store WhatsApp contacts and their JID variations in dedicated PostgreSQL tables for cache lookups.
  • Acknowledge WhatsApp passkey-pairing notifications.

Bug Fixes:

  • Debounce connection-update webhooks to reduce repeated notifications during connection changes.
  • Handle logout failures with disconnect status 428 by updating the instance connection state.
  • Keep newly started instances from being removed by clearing their pending deletion timeout.
  • Avoid updating unread-message counts through the existing update path.

Enhancements:

  • Update the Baileys dependency to the rc.13 fork and apply corresponding dependency patches.
  • Use the new contact/JID-variation cache schema for WhatsApp cache reads and writes.
  • Always include an SQS message deduplication ID and simplify SQS queue configuration updates.

Build:

  • Add SSH-enabled Docker image build support and a build script for authenticated GitHub dependency access.

Deployment:

  • Add deployment instructions for building test and production images.

Chores:

  • Add PostgreSQL migrations and Prisma schema updates for WhatsApp contact and JID-variation storage.
  • Replace the development Compose services with PostgreSQL and Redis, and add a VS Code launch configuration.

AndreLorenz and others added 30 commits December 13, 2024 15:24
* Retry system for send webhooks
* Message filtering to support timestamp range queries
* Chats filtering to support timestamp range queries

* Correction of webhook global
* Fixed send audio with whatsapp cloud api
* Refactor on fetch chats
* Refactor on Evolution Channel
…to version/2.3.0

* Add support to get Catalogs and Collections with new routes: '{{baseUrl}}/chat/fetchCatalogs' and '{{baseUrl}}/chat/fetchCollections'
* Add NATS integration support to the event system
* Add message location support meta
* Add S3_SKIP_POLICY env variable to disable setBucketPolicy for incompatible providers
* Add EvoAI integration with models, services, and routes
* Add N8n integration with models, services, and routes

* Shell injection vulnerability
* Update Baileys Version v6.7.18
* Audio send duplicate from chatwoot
* Chatwoot csat creating new conversation in another language
* Refactor SQS controller to correct bug in sqs events by instance
* Adjustin cloud api send audio and video
* Preserve animation in GIF and WebP stickers
* Preventing use conversation from other inbox for the same user
* Ensure full WhatsApp compatibility for audio conversion (libopus, 48kHz, mono)
* Enhance message fetching and processing logic
* Added lid on whatsapp numbers router
* Now if the CONFIG_SESSION_PHONE_VERSION variable is not filled in it automatically searches for the most updated version
…to version/2.3.2

* Add BaileysMessageProcessor for improved message handling and integrate rxjs for asynchronous processing
* Enhance message processing with retry logic for error handling

* Update Baileys Version
* Update Dockerhub Repository and Delete Config Session Variable
* Fixed sending variables in typebot
* Add unreadMessages in the response
* Phone number as message ID for Evo AI
* Fix upload to s3 when media message
* Simplify edited message check in BaileysStartupService
* Avoid corrupting URLs with query strings
* Removed CONFIG_SESSION_PHONE_VERSION environment variable
2.3.8

# Conflicts:
#	evolution-manager-v2
#	package.json
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The 2.3.8 patch targeted baileys 7.0.0-rc.9 and no longer applies to the
unobject-dev fork on rc.13. Regenerate it for rc13 (same handleStatus and
CB:status changes) and refresh package-lock.json.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Schema and migrations

Add the PostgreSQL tables and relations used to store WhatsApp contacts and JID variations, together with the updated Prisma schema and follow-up migration that adjusts their types and constraints.

  • prisma/postgresql-migrations/20251029182355_add_whatsapp_variations/migration.sql L1-30
  • prisma/postgresql-migrations/20251029195234_add_whatssapp_variations/migration.sql L1-32
  • prisma/postgresql-schema.prisma L668-692

API

Expose an instance profile endpoint and controller method that return the stored instance profile.

  • src/api/controllers/instance.controller.ts L402-405, L452, L478
  • src/api/routes/instance.router.ts L57-66

Implementation

Replace the old WhatsApp cache lookup and persistence with indexed contact and variation operations backed by the new tables.

  • src/utils/onWhatsappCache.ts L64-156, L167-202 (+4 small edits)

Add instance profile lookup and refresh the instance deletion timer when an instance is registered.

  • src/api/services/monitor.service.ts L79-88, L318

Update Baileys handling with debounced connection webhooks, passkey notification acknowledgements, logout recovery, timestamp representation, and a disabled unread-count update.

  • src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts L271-286, L349-369, L754-772 (+8 small edits)

Change SQS client construction for a configurable development endpoint and adjust event queue persistence and message deduplication parameters.

  • src/api/integrations/event/sqs/sqs.controller.ts L26-41 (+3 small edits)

Configuration

Configure the optional SQS development queue URL and add its type and environment-variable mapping.

  • Docker/swarm/evolution_api_v2.yaml L54
  • src/config/env.config.ts L124, L589

Modify the Docker build to use an SSH mount for private GitHub dependencies and copy dependency patches into the build context.

  • Dockerfile L13-22 (+3 small edits)

Replace the development Compose services with local PostgreSQL and Redis containers.

  • docker-compose.dev.yaml L2-18

Add a helper script for building Docker images with an SSH agent.

  • build.sh L1-40

Add VS Code launch configuration for local development.

  • .vscode/launch.json L1-34

Documentation

Document the commands for building test and production deployment images.

  • UNO_DEPLOY.md L1-12

Lock files and vendored code

Switch Baileys to the rc13 fork and update its patch and lockfile to match.

  • package-lock.json L2660-2673, L3583-3600, L10370-10401 (+58 small edits)
  • package.json L81, L91, L95 (removed lines)

Add the WhatsApp Rust bridge dependency patch.

  • patches/whatsapp-rust-bridge+0.5.4.patch L1-94

Remove the evolution-manager-v2 submodule reference.

  • evolution-manager-v2 (deleted)

Update the Prisma PostgreSQL migration lock file.

  • prisma/postgresql-migrations/migration_lock.toml L3 (removed lines)

Other changes

Files not grouped.

  • patches/baileys+7.0.0-rc.9.patch L2-6, L20-31

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 12 security issues, and 18 other issues

Security issues:

  • Possible SSRF and Credential Leakage via Absolute URL in axios Requests (link)
  • Axios affected by Denial of Service via proto Key in mergeConfig (link)
  • Axios: HTTP Transport Hijacking via Prototype Pollution (link)
  • Axios: Arbitrary HTTP header injection via prototype pollution (link)
  • Axios: NO_PROXY bypass via crafted URL (link)
  • Axios: Information disclosure of proxy credentials via HTTP redirects (link)
  • Axios: Information disclosure of proxy credentials via redirect flows (link)
  • Axios: Proxy bypass via IPv4-mapped IPv6 address non-normalization (link)
  • Axios: Information disclosure due to prototype pollution vulnerability (link)
  • Axios: Client-side Denial of Service via unescaped regex metacharacters in XSRF cookie name (link)
  • axios: Security control bypass via unapplied HTTP/2 proxy and DNS settings (link)
  • Axios: Denial of Service via unhandled error in HTTP/2 session initialization (link)

Fixed security issues:

  • Command injection from untrusted input passed to child_process commands (link)
Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/api/routes/instance.router.ts" line_range="62" />
<code_context>
+          request: req,
+          schema: null,
+          ClassRef: InstanceDto,
+          execute: (instance) => instanceController.instanceProfile(instance),
+        });
+
</code_context>
<issue_to_address>
**Cross-instance tokens exposed**

When a tenant holding a valid instance token requests `/instance/profile/<their-instance>?instanceName=<another-instance>`, `dataValidate` overwrites the guarded path `instanceName` with the query parameter, then `instanceProfile` returns the target’s full database row, including its `token`. A holder of one instance’s API token can read other tenants’ tokens and use them to control those instances.

Bind the profile lookup to the authenticated path instance and return only explicitly approved profile fields, excluding the token.
</issue_to_address>

### Comment 2
<location path="docker-compose.dev.yaml" line_range="6-9" />
<code_context>
-    container_name: evolution_frontend
-    image: evolution/manager:local
-    build: ./evolution-manager-v2
+      - '5438:5432'
+    environment:
+      - POSTGRES_USER=postgres
+      - POSTGRES_PASSWORD=andand123
+    
+  redis:
</code_context>
<issue_to_address>
**Dev database exposed with weak credentials**

When a developer runs this compose file on a host reachable from an untrusted network, postgreSQL publishes port 5432 on the host’s default interfaces and accepts the fixed `postgres`/`andand123` credentials, so a network attacker can connect and read or modify the development database.

Bind the published port to loopback for local development and require a strong, externally supplied password.
</issue_to_address>

### Comment 3
<location path="Dockerfile" line_range="27" />
<code_context>
 COPY ./patches ./patches

-RUN npm ci --silent
+RUN --mount=type=ssh,id=default npm ci

 COPY ./src ./src
</code_context>
<issue_to_address>
**Build scripts can use SSH agent**

When a dependency or its install script is malicious or compromised, a compromised dependency install script runs while the forwarded SSH agent is available and can authenticate to GitHub as the builder, accessing repositories permitted to that key. The builder’s private key is not extractable, but its access can be abused during the build.

Restrict the SSH mount to fetching the Git dependency, then run dependency lifecycle scripts without the agent mounted.
</issue_to_address>

### Comment 4
<location path="src/api/services/monitor.service.ts" line_range="86" />
<code_context>
+      throw new NotFoundException(`Instance "${instanceName}" not found`);
+    }
+
+    return instance;
+  }
+
</code_context>
<issue_to_address>
**Profile responses expose API credentials**

When a caller requests an instance profile, `instanceProfile()` returns the complete Prisma row, including `token`, and the profile route serializes it, so callers receive the instance API credential.

Return only the non-sensitive profile fields from `instanceProfile()`.

Also at `src/api/services/monitor.service.ts:80`.
</issue_to_address>

### Comment 5
<location path="src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts" line_range="4812" />
<code_context>

   private async updateChatUnreadMessages(remoteJid: string): Promise<number> {
+    // Desabilitar a atualização de mensagens não lidas
+    if (remoteJid) return null;
+
     const [chat, unreadMessages] = await Promise.all([
</code_context>
<issue_to_address>
**Unread counts stay stale**

When `updateChatUnreadMessages` receives a non-empty remote JID, `updateChatUnreadMessages` returns before querying or updating the chat, so incoming and read-message handlers leave stored unread counts unchanged and callers receive no updated count.

Remove or correct the early return so the method counts unread messages and updates the chat.
</issue_to_address>

### Comment 6
<location path="src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts" line_range="279" />
<code_context>
+    } catch (error) {
+      if (error?.output?.statusCode === 428) {
+        if (['connecting', 'open'].includes(this.connectionStatus.state)) {
+          await this.connectionUpdate({ connection: 'close', lastDisconnect: error });
+        } else {
+          throw error;
</code_context>
<issue_to_address>
**Logout reconnects the client**

When `client.logout()` throws status 428 while the connection is open or connecting, `logoutInstance` passes the Boom error as `lastDisconnect`, but `connectionUpdate` reads `lastDisconnect.error.output.statusCode`; the status is undefined, so the close is treated as reconnectable and the client reconnects during logout.

Pass the error in the shape `connectionUpdate` expects, or update that method to read the Boom error directly.
</issue_to_address>

### Comment 7
<location path="src/api/integrations/event/sqs/sqs.controller.ts" line_range="65" />
<code_context>
       }
     }

-    await this.saveQueues(instanceName, data[this.name].events, data[this.name]?.enabled);
-
     const payload: any = {
</code_context>
<issue_to_address>
**Per-instance SQS queues are missing**

When SQS is enabled per instance while global SQS is disabled and an instance is configured, `set` saves the configuration without calling `saveQueues`, and `init` creates queues only in global mode; `emit` then sends to an uncreated per-instance queue, so event delivery fails.

Create the instance's queues when its SQS configuration is saved.
</issue_to_address>

### Comment 8
<location path="src/utils/onWhatsappCache.ts" line_range="85" />
<code_context>
+    const uniqueJids = Array.from(new Set(expandedJids));
+
+    // 🎯 NOVA LÓGICA: Busca por variação em vez de LIKE
+    const existingVariation = await prismaRepository.whatsappJidVariation.findFirst({
+      where: {
+        jidVariation: {
</code_context>
<issue_to_address>
**MySQL cache operations fail**

When the application uses the MySQL Prisma schema with WhatsApp cache lookups enabled, `getOnWhatsappCache` and `saveOnWhatsappCache` use `WhatsappContact` and `WhatsappJidVariation` delegates that the MySQL schema and migration set lack, so the generated client cannot run these cache operations.

Add the cache models and migrations to the MySQL schema and migration set, or use cache operations supported by that schema.

Also at `src/utils/onWhatsappCache.ts:179`.
</issue_to_address>

### Comment 9
<location path="src/api/integrations/event/sqs/sqs.controller.ts" line_range="28" />
<code_context>
-    });
+    if (awsConfig.DEV_QUEUE_URL) {
+      this.sqs = new SQS({
+        endpoint: awsConfig.DEV_QUEUE_URL,
+        region: awsConfig.REGION,
+        credentials: {
</code_context>
<issue_to_address>
**Local SQS sends target the wrong queue**

When `SQS_DEV_QUEUE_URL` points to a local SQS-compatible service, `init` configures the SDK endpoint, but `emit` constructs `QueueUrl` with the AWS hostname, so messages are sent to a different queue URL and local delivery fails.

Build each `QueueUrl` using the queue URL from the configured development endpoint.

Also at `src/api/integrations/event/sqs/sqs.controller.ts:29`.
</issue_to_address>

### Comment 10
<location path="prisma/postgresql-migrations/20251029182355_add_whatsapp_variations/migration.sql" line_range="20" />
<code_context>
+CREATE INDEX idx_contact_id ON "WhatsappJidVariation"(contact_id);
+CREATE INDEX idx_jid_variation ON "WhatsappJidVariation"(jid_variation);
+
+-- Migrar dados da tabela antiga (OPCIONAL - rode depois de testar)
+-- INSERT INTO "WhatsappContact" (remote_jid, lid, created_at, updated_at)
+-- SELECT "remoteJid", lid, "createdAt", "updatedAt" 
</code_context>
<issue_to_address>
**Existing WhatsApp cache entries disappear**

When an installation upgrades with cached rows in `IsOnWhatsapp`, the migration leaves the copy from `IsOnWhatsapp` commented out, while `getOnWhatsappCache` reads only `WhatsappContact` and its variations, so existing entries become cache misses after the upgrade.

Copy the existing contacts and their JID variations into the replacement tables in the migration.

Also at `src/utils/onWhatsappCache.ts:179-194`, `prisma/postgresql-migrations/20251029182355_add_whatsapp_variations/migration.sql:21-30`.
</issue_to_address>

### Comment 11
<location path="src/utils/onWhatsappCache.ts" line_range="66" />
<code_context>
-        logger.warn('[saveOnWhatsappCache] Item skipped, missing remoteJid.');
-        return;
-      }
+  for (const item of data) {
+    const remoteJid = item.remoteJid.startsWith('+') ? item.remoteJid.slice(1) : item.remoteJid;
+    const allJids = [remoteJid];
</code_context>
<issue_to_address>
**One cache failure interrupts the batch**

When a cache query or write fails while processing a multi-contact batch, `saveOnWhatsappCache` lets the rejected operation escape its sequential loop, so later contacts are not saved; callers also receive the error, which can fail a verified-number request or skip remaining contact processing.

Catch failures per item and continue processing the remaining contacts, while preserving the successful request result.

Also at `src/utils/onWhatsappCache.ts:85`, `src/utils/onWhatsappCache.ts:137`.
</issue_to_address>

### Comment 12
<location path="src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts" line_range="366" />
<code_context>

 # SQS - Environment variables
 SQS_ENABLED=false
</code_context>
<issue_to_address>
**Connection updates arrive late or disappear**

When an instance emits another connection update within the 30-second debounce window, `connectionUpdateData.set` replaces the pending payload and the timer resets, so `CONNECTION_UPDATE` is delayed until updates stop and earlier state transitions are never sent to webhook consumers.

Send connection transitions without replacing pending updates or waiting for 30 seconds of silence.

Also at `src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:356`, `src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:499`, `src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:546`.
</issue_to_address>

### Comment 13
<location path="prisma/postgresql-migrations/20251029195234_add_whatssapp_variations/migration.sql" line_range="12" />
<code_context>
+ALTER TABLE "public"."WhatsappJidVariation" DROP CONSTRAINT "WhatsappJidVariation_contact_id_fkey";
+
+-- DropIndex
+DROP INDEX "public"."idx_jid_variation";
+
+-- AlterTable
</code_context>
<issue_to_address>
**Duplicate JID variations can persist**

When concurrent cache saves add the same JID variation before either finds the other contact, the migration drops the `jid_variation` index without recreating its uniqueness, so both saves can persist the same variation and later lookups can associate a number with the wrong contact.

Recreate a unique constraint or index on `jid_variation` in the migration.

Also at `src/utils/onWhatsappCache.ts:142-147`.
</issue_to_address>

### Comment 14
<location path="src/utils/onWhatsappCache.ts" line_range="85" />
<code_context>
+    const uniqueJids = Array.from(new Set(expandedJids));
+
+    // 🎯 NOVA LÓGICA: Busca por variação em vez de LIKE
+    const existingVariation = await prismaRepository.whatsappJidVariation.findFirst({
+      where: {
+        jidVariation: {
</code_context>
<issue_to_address>
**Concurrent cache inserts conflict**

When two callers save the same JID, or different contacts with an overlapping JID, concurrently, two contact events or number-verification requests can both find no matching variation, then create contacts with overlapping globally unique JIDs. One insert fails with a unique-constraint error, so that caller does not save its cache entry.

Make the lookup-and-create operation atomic or handle unique conflicts by reloading the winning contact and merging its variations.
</issue_to_address>

### Comment 15
<location path="src/api/integrations/event/sqs/sqs.controller.ts" line_range="175" />
<code_context>
           MessageGroupId: messageGroupId,
           QueueUrl: sqsUrl,
-          ...(!isGlobalEnabled && {
-            MessageDeduplicationId: `${instanceName}_${eventFormatted}_${Date.now()}`,
-          }),
+          MessageDeduplicationId: `${instanceName}_${eventFormatted}_${Date.now()}`,
</code_context>
<issue_to_address>
**Global FIFO deduplication is bypassed**

When the same global event is emitted more than once within the FIFO deduplication interval, `MessageDeduplicationId` is now always unique because it includes `Date.now()`, so FIFO queues cannot deduplicate repeated global events by their body. Consumers receive duplicates that the previous global-queue path suppressed through content-based deduplication.

Only set an explicit deduplication ID for queues that do not use content-based deduplication, as before.
</issue_to_address>

### Comment 16
<location path="src/api/integrations/event/sqs/sqs.controller.ts" line_range="175" />
<code_context>
           MessageGroupId: messageGroupId,
           QueueUrl: sqsUrl,
-          ...(!isGlobalEnabled && {
-            MessageDeduplicationId: `${instanceName}_${eventFormatted}_${Date.now()}`,
-          }),
+          MessageDeduplicationId: `${instanceName}_${eventFormatted}_${Date.now()}`,
</code_context>
<issue_to_address>
**Distinct SQS events can be deduplicated**

When two distinct messages for the same instance and event are emitted within the same millisecond, `MessageDeduplicationId` uses `Date.now()`, so both messages receive the same ID and FIFO SQS suppresses the later message during its deduplication window.

Use a deduplication ID that is unique for each distinct event.
</issue_to_address>

### Comment 17
<location path="docker-compose.dev.yaml" line_range="2" />
<code_context>
 services:
-  api:
-    container_name: evolution_api
-    image: evolution/api:local
</code_context>
<issue_to_address>
**Dev compose omits application services**

When A developer starts the documented full development stack with `docker-compose.dev.yaml`, the development Compose file no longer defines the API or frontend, so the documented full-stack command starts only PostgreSQL and Redis; developers cannot use it to run the application and manager as before.

Keep the API and frontend services in the development Compose file, or update the documented workflow to start them separately.
</issue_to_address>

### Comment 18
<location path="src/api/controllers/instance.controller.ts" line_range="452" />
<code_context>
       return { status: 'SUCCESS', error: false, response: { message: 'Instance logged out' } };
     } catch (error) {
-      throw new InternalServerErrorException(error.toString());
+      throw new InternalServerErrorException(error);
     }
   }
</code_context>
<issue_to_address>
**Error responses lose their message**

When logout or delete throws an `Error`, when an operation throws an `Error`, passing that object to the Nest exception constructor makes it the response body. `Error` message properties are not JSON-enumerable, so callers receive an empty or incomplete JSON body instead of the previous error text.

Pass a serializable message such as `error.message` (with a fallback for non-Error values) to the exception constructor.

Also at `src/api/controllers/instance.controller.ts:478`.
</issue_to_address>

### Comment 19
<location path="package-lock.json" line_range="5782-5783" />
<code_context>

</code_context>
<issue_to_address>
**security (CVE-2025-27152):** Possible SSRF and Credential Leakage via Absolute URL in axios Requests

axios is a promise based HTTP client for the browser and node.js. The issue occurs when passing absolute URLs rather than protocol-relative URLs to axios. Even if ⁠baseURL is set, axios sends the request to the specified absolute URL, potentially causing SSRF and credential leakage. This issue impacts both server-side and client-side usage of axios. This issue is fixed in 1.8.2.

*Source: trivy*
</issue_to_address>

### Comment 20
<location path="package-lock.json" line_range="5782-5783" />
<code_context>

</code_context>
<issue_to_address>
**security (CVE-2026-25639):** Axios affected by Denial of Service via __proto__ Key in mergeConfig

Axios is a promise based HTTP client for the browser and Node.js. Prior to versions 0.30.3 and 1.13.5, the mergeConfig function in axios crashes with a TypeError when processing configuration objects containing __proto__ as an own property. An attacker can trigger this by providing a malicious configuration object created via JSON.parse(), causing complete denial of service. This vulnerability is fixed in versions 0.30.3 and 1.13.5.

*Source: trivy*
</issue_to_address>

### Comment 21
<location path="package-lock.json" line_range="5782-5783" />
<code_context>

</code_context>
<issue_to_address>
**security (CVE-2026-42033):** Axios: HTTP Transport Hijacking via Prototype Pollution

Axios is a promise based HTTP client for the browser and Node.js. Prior to 1.15.1 and 0.31.1, when Object.prototype has been polluted by any co-dependency with keys that axios reads without a hasOwnProperty guard, an attacker can (a) silently intercept and modify every JSON response before the application sees it, or (b) fully hijack the underlying HTTP transport, gaining access to request credentials, headers, and body. The precondition is prototype pollution from a separate source in the same process. This vulnerability is fixed in 1.15.1 and 0.31.1.

*Source: trivy*
</issue_to_address>

### Comment 22
<location path="package-lock.json" line_range="5782-5783" />
<code_context>

</code_context>
<issue_to_address>
**security (CVE-2026-42035):** Axios: Arbitrary HTTP header injection via prototype pollution

Axios is a promise based HTTP client for the browser and Node.js. Prior to 1.15.1 and 0.31.1, a prototype pollution gadget exists in the Axios HTTP adapter (lib/adapters/http.js) that allows an attacker to inject arbitrary HTTP headers into outgoing requests. The vulnerability exploits duck-type checking of the data payload, where if Object.prototype is polluted with getHeaders, append, pipe, on, once, and Symbol.toStringTag, Axios misidentifies any plain object payload as a FormData instance and calls the attacker-controlled getHeaders() function, merging the returned headers into the outgoing request. The vulnerable code resides exclusively in lib/adapters/http.js. The prototype pollution source does not need to originate from Axios itself — any prototype pollution primitive in any dependency in the application's dependency tree is sufficient to trigger this gadget. This vulnerability is fixed in 1.15.1 and 0.31.1.

*Source: trivy*
</issue_to_address>

### Comment 23
<location path="package-lock.json" line_range="5782-5783" />
<code_context>

</code_context>
<issue_to_address>
**security (CVE-2026-42043):** Axios: NO_PROXY bypass via crafted URL

Axios is a promise based HTTP client for the browser and Node.js. Prior to 1.15.1 and 0.31.1, an attacker who can influence the target URL of an Axios request can use any address in the 127.0.0.0/8 range (other than 127.0.0.1) to completely bypass the NO_PROXY protection. This vulnerability is due to an incomplete for CVE-2025-62718, This vulnerability is fixed in 1.15.1 and 0.31.1.

*Source: trivy*
</issue_to_address>

### Comment 24
<location path="package-lock.json" line_range="5782-5783" />
<code_context>

</code_context>
<issue_to_address>
**security (CVE-2026-44486):** Axios: Information disclosure of proxy credentials via HTTP redirects

Axios is a promise based HTTP client for the browser and Node.js. Prior to 0.32.0 and 1.16.0, Axios’ Node.js HTTP adapter can leak proxy credentials to a redirect target in affected versions. When a request is sent through an authenticated proxy, Axios may add a Proxy-Authorization header. If Axios then follows a redirect and the redirected request is no longer sent through that proxy, the stale Proxy-Authorization header can remain on the redirected request and be sent to the redirect target. This affects Node.js's use of Axios with automatic redirects enabled and an authenticated proxy configuration. Browser adapters are not affected. This vulnerability is fixed in 0.32.0 and 1.16.0.

*Source: trivy*
</issue_to_address>

### Comment 25
<location path="package-lock.json" line_range="5782-5783" />
<code_context>

</code_context>
<issue_to_address>
**security (CVE-2026-44487):** Axios: Information disclosure of proxy credentials via redirect flows

Axios is a promise based HTTP client for the browser and Node.js. Prior to 0.32.0 and 1.16.0, Axios’s Node.js HTTP adapter may forward a Proxy-Authorization header to a redirected origin during specific proxy-to-direct redirect flows. This affects Node.js usage, where an initial HTTP request is sent through an authenticated HTTP proxy, redirects are followed, and the redirected URL is no longer proxied. Under affected redirect shapes, the final origin can receive the proxy credential that was intended only for the outbound proxy. This vulnerability is fixed in 0.32.0 and 1.16.0.

*Source: trivy*
</issue_to_address>

### Comment 26
<location path="package-lock.json" line_range="5782-5783" />
<code_context>

</code_context>
<issue_to_address>
**security (CVE-2026-44492):** Axios: Proxy bypass via IPv4-mapped IPv6 address non-normalization

Axios is a promise based HTTP client for the browser and Node.js. Prior to 0.32.0 and 1.16.0, Axios does not normalise IPv4-mapped IPv6 addresses. When NO_PROXY lists an IPv4 address such as 127.0.0.1 or 169.254.169.254, a request URL using the IPv4-mapped IPv6 form (::ffff:7f00:1, ::ffff:a9fe:a9fe) still routes through the configured proxy. Node.js resolves these addresses to the underlying IPv4 host, so the request reaches the internal service via the proxy rather than being blocked. This vulnerability is fixed in 0.32.0 and 1.16.0.

*Source: trivy*
</issue_to_address>

### Comment 27
<location path="package-lock.json" line_range="5782-5783" />
<code_context>

</code_context>
<issue_to_address>
**security (CVE-2026-44495):** Axios: Information disclosure due to prototype pollution vulnerability

Axios is a promise based HTTP client for the browser and Node.js. From 0.19.0 to before 0.31.1 and 1.15.2, Axios contains prototype-pollution gadgets in request config processing. If another vulnerability in the same JavaScript process has already polluted Object.prototype.transformResponse, affected Axios versions may treat that inherited value as request configuration or as an option validator. Axios does not itself create the prototype pollution. Exploitability requires a separate prototype-pollution vulnerability or equivalent attacker control over Object.prototype before Axios creates a request. This vulnerability is fixed in 0.31.1 and 1.15.2.

*Source: trivy*
</issue_to_address>

### Comment 28
<location path="package-lock.json" line_range="5782-5783" />
<code_context>

</code_context>
<issue_to_address>
**security (CVE-2026-44496):** Axios: Client-side Denial of Service via unescaped regex metacharacters in XSRF cookie name

Axios is a promise based HTTP client for the browser and Node.js. Axios versions before 0.32.0 on the 0.x line and before 1.16.0 on the 1.x line build a regular expression from the configured XSRF cookie name without escaping regex metacharacters. In standard browser environments, an attacker who can influence the cookie name passed to axios can cause expensive regex backtracking while axios reads document.cookie. The practical impact is client-side availability degradation, such as freezing the affected browser tab while axios prepares a request. The issue does not affect ordinary Node.js HTTP adapter usage, React Native, or web workers, where axios does not read document.cookie. This vulnerability is fixed in 0.32.0 and 1.16.0.

*Source: trivy*
</issue_to_address>

### Comment 29
<location path="package-lock.json" line_range="5782-5783" />
<code_context>

</code_context>
<issue_to_address>
**security (CVE-2026-101898):** axios: Security control bypass via unapplied HTTP/2 proxy and DNS settings

Axios is a promise-based HTTP client for the browser and Node.js. From 1.13.0 until 1.20.0, Axios HTTP/2 request setup does not consistently apply proxy settings and caller-supplied DNS lookup policy. An HTTPS request uses httpVersion: 2 with explicit config.proxy or environment-derived proxy settings, or relies on caller-supplied config.lookup DNS policy. The HTTP/2 path can connect without the configured proxy behavior or without applying the caller-supplied config.lookup policy before http2.connect(). Requests can bypass the intended proxy route or the caller-supplied DNS resolution policy. This issue is fixed in version 1.20.0.

*Source: trivy*
</issue_to_address>

### Comment 30
<location path="package-lock.json" line_range="5782-5783" />
<code_context>

</code_context>
<issue_to_address>
**security (CVE-2026-101901):** Axios: Denial of Service via unhandled error in HTTP/2 session initialization

Axios is a promise-based HTTP client for the browser and Node.js. From 1.13.0 until 1.20.0, Http2Sessions does not install adequate error handling for a ClientHttp2Session during Axios HTTP/2 session initialization or reuse. A request uses httpVersion: 2 and the ClientHttp2Session emits an error during session initialization or reuse. The unhandled session error escapes normal Promise rejection handling. The uncaught error can terminate the Node.js process and cause denial of service. This issue is fixed in version 1.20.0.

*Source: trivy*
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 30 findings to address first, and replacing Baileys and its libsignal dependency changes the cryptographic implementation used for WhatsApp sessions; if it mishandles keys or messages, data could be exposed before the dependency is reverted. The added database tables and Docker build changes are also persistent deployment changes, though reverting them does not undo any exposure that already occurred.

Blocking findings: src/api/routes/instance.router.ts:62, docker-compose.dev.yaml:9, Dockerfile:27, src/api/services/monitor.service.ts:86, src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:4812, and 25 more


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

request: req,
schema: null,
ClassRef: InstanceDto,
execute: (instance) => instanceController.instanceProfile(instance),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · Cross-instance tokens exposed

When a tenant holding a valid instance token requests /instance/profile/<their-instance>?instanceName=<another-instance>, dataValidate overwrites the guarded path instanceName with the query parameter, then instanceProfile returns the target’s full database row, including its token. A holder of one instance’s API token can read other tenants’ tokens and use them to control those instances.

Bind the profile lookup to the authenticated path instance and return only explicitly approved profile fields, excluding the token.

Prompt for AI agents
In `src/api/routes/instance.router.ts` at line 62:

**Cross-instance tokens exposed**

When a tenant holding a valid instance token requests `/instance/profile/<their-instance>?instanceName=<another-instance>`, `dataValidate` overwrites the guarded path `instanceName` with the query parameter, then `instanceProfile` returns the target’s full database row, including its `token`. A holder of one instance’s API token can read other tenants’ tokens and use them to control those instances.

Bind the profile lookup to the authenticated path instance and return only explicitly approved profile fields, excluding the token.

Comment thread docker-compose.dev.yaml
Comment on lines +6 to +9
- '5438:5432'
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=andand123

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Dev database exposed with weak credentials

When a developer runs this compose file on a host reachable from an untrusted network, postgreSQL publishes port 5432 on the host’s default interfaces and accepts the fixed postgres/andand123 credentials, so a network attacker can connect and read or modify the development database.

Bind the published port to loopback for local development and require a strong, externally supplied password.

Prompt for AI agents
In `docker-compose.dev.yaml` at lines 6-9:

**Dev database exposed with weak credentials**

When a developer runs this compose file on a host reachable from an untrusted network, postgreSQL publishes port 5432 on the host’s default interfaces and accepts the fixed `postgres`/`andand123` credentials, so a network attacker can connect and read or modify the development database.

Bind the published port to loopback for local development and require a strong, externally supplied password.

Comment thread Dockerfile
COPY ./patches ./patches

RUN npm ci --silent
RUN --mount=type=ssh,id=default npm ci

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Build scripts can use SSH agent

When a dependency or its install script is malicious or compromised, a compromised dependency install script runs while the forwarded SSH agent is available and can authenticate to GitHub as the builder, accessing repositories permitted to that key. The builder’s private key is not extractable, but its access can be abused during the build.

Restrict the SSH mount to fetching the Git dependency, then run dependency lifecycle scripts without the agent mounted.

Prompt for AI agents
In `Dockerfile` at line 27:

**Build scripts can use SSH agent**

When a dependency or its install script is malicious or compromised, a compromised dependency install script runs while the forwarded SSH agent is available and can authenticate to GitHub as the builder, accessing repositories permitted to that key. The builder’s private key is not extractable, but its access can be abused during the build.

Restrict the SSH mount to fetching the Git dependency, then run dependency lifecycle scripts without the agent mounted.

throw new NotFoundException(`Instance "${instanceName}" not found`);
}

return instance;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · Profile responses expose API credentials

When a caller requests an instance profile, instanceProfile() returns the complete Prisma row, including token, and the profile route serializes it, so callers receive the instance API credential.

Return only the non-sensitive profile fields from instanceProfile().

Also at src/api/services/monitor.service.ts:80.

Prompt for AI agents
In `src/api/services/monitor.service.ts` at line 86:

**Profile responses expose API credentials**

When a caller requests an instance profile, `instanceProfile()` returns the complete Prisma row, including `token`, and the profile route serializes it, so callers receive the instance API credential.

Return only the non-sensitive profile fields from `instanceProfile()`.

Also at `src/api/services/monitor.service.ts:80`.


private async updateChatUnreadMessages(remoteJid: string): Promise<number> {
// Desabilitar a atualização de mensagens não lidas
if (remoteJid) return null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · Unread counts stay stale

When updateChatUnreadMessages receives a non-empty remote JID, updateChatUnreadMessages returns before querying or updating the chat, so incoming and read-message handlers leave stored unread counts unchanged and callers receive no updated count.

Remove or correct the early return so the method counts unread messages and updates the chat.

Prompt for AI agents
In `src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts` at line 4812:

**Unread counts stay stale**

When `updateChatUnreadMessages` receives a non-empty remote JID, `updateChatUnreadMessages` returns before querying or updating the chat, so incoming and read-message handlers leave stored unread counts unchanged and callers receive no updated count.

Remove or correct the early return so the method counts unread messages and updates the chat.

Comment thread package-lock.json
Comment on lines 5782 to 5783
}
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (CVE-2026-44492): Axios: Proxy bypass via IPv4-mapped IPv6 address non-normalization

Axios is a promise based HTTP client for the browser and Node.js. Prior to 0.32.0 and 1.16.0, Axios does not normalise IPv4-mapped IPv6 addresses. When NO_PROXY lists an IPv4 address such as 127.0.0.1 or 169.254.169.254, a request URL using the IPv4-mapped IPv6 form (::ffff:7f00:1, ::ffff:a9fe:a9fe) still routes through the configured proxy. Node.js resolves these addresses to the underlying IPv4 host, so the request reaches the internal service via the proxy rather than being blocked. This vulnerability is fixed in 0.32.0 and 1.16.0.

Source: trivy

Comment thread package-lock.json
Comment on lines 5782 to 5783
}
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (CVE-2026-44495): Axios: Information disclosure due to prototype pollution vulnerability

Axios is a promise based HTTP client for the browser and Node.js. From 0.19.0 to before 0.31.1 and 1.15.2, Axios contains prototype-pollution gadgets in request config processing. If another vulnerability in the same JavaScript process has already polluted Object.prototype.transformResponse, affected Axios versions may treat that inherited value as request configuration or as an option validator. Axios does not itself create the prototype pollution. Exploitability requires a separate prototype-pollution vulnerability or equivalent attacker control over Object.prototype before Axios creates a request. This vulnerability is fixed in 0.31.1 and 1.15.2.

Source: trivy

Comment thread package-lock.json
Comment on lines 5782 to 5783
}
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (CVE-2026-44496): Axios: Client-side Denial of Service via unescaped regex metacharacters in XSRF cookie name

Axios is a promise based HTTP client for the browser and Node.js. Axios versions before 0.32.0 on the 0.x line and before 1.16.0 on the 1.x line build a regular expression from the configured XSRF cookie name without escaping regex metacharacters. In standard browser environments, an attacker who can influence the cookie name passed to axios can cause expensive regex backtracking while axios reads document.cookie. The practical impact is client-side availability degradation, such as freezing the affected browser tab while axios prepares a request. The issue does not affect ordinary Node.js HTTP adapter usage, React Native, or web workers, where axios does not read document.cookie. This vulnerability is fixed in 0.32.0 and 1.16.0.

Source: trivy

Comment thread package-lock.json
Comment on lines 5782 to 5783
}
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (CVE-2026-101898): axios: Security control bypass via unapplied HTTP/2 proxy and DNS settings

Axios is a promise-based HTTP client for the browser and Node.js. From 1.13.0 until 1.20.0, Axios HTTP/2 request setup does not consistently apply proxy settings and caller-supplied DNS lookup policy. An HTTPS request uses httpVersion: 2 with explicit config.proxy or environment-derived proxy settings, or relies on caller-supplied config.lookup DNS policy. The HTTP/2 path can connect without the configured proxy behavior or without applying the caller-supplied config.lookup policy before http2.connect(). Requests can bypass the intended proxy route or the caller-supplied DNS resolution policy. This issue is fixed in version 1.20.0.

Source: trivy

Comment thread package-lock.json
Comment on lines 5782 to 5783
}
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (CVE-2026-101901): Axios: Denial of Service via unhandled error in HTTP/2 session initialization

Axios is a promise-based HTTP client for the browser and Node.js. From 1.13.0 until 1.20.0, Http2Sessions does not install adequate error handling for a ClientHttp2Session during Axios HTTP/2 session initialization or reuse. A request uses httpVersion: 2 and the ClientHttp2Session emits an error during session initialization or reuse. The unhandled session error escapes normal Promise rejection handling. The uncaught error can terminate the Node.js process and cause denial of service. This issue is fixed in version 1.20.0.

Source: trivy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants