Skip to content

Version/2.3.9 - #2819

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

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

Conversation

@DiogoTravalha

@DiogoTravalha DiogoTravalha commented Dec 3, 2026 •

Copy link
Copy Markdown

📋 Description

🔗 Related Issue

Closes #(issue_number)

🧪 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧹 Code cleanup
  • 🔒 Security fix

🧪 Testing

  • Manual testing completed
  • Functionality verified in development environment
  • No breaking changes introduced
  • Tested with different connection types (if applicable)

📸 Screenshots (if applicable)

✅ Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have manually tested my changes thoroughly
  • I have verified the changes work with different scenarios
  • Any dependent changes have been merged and published

📝 Additional Notes

Summary by Sourcery

Update WhatsApp integration and contact caching, add instance profile access, and expand local SQS and Docker build support.

New Features:

  • Add an authenticated instance profile endpoint that returns the stored profile for an instance.

Bug Fixes:

  • Handle Baileys logout failures with status 428 by closing active connections cleanly.
  • Acknowledge WhatsApp passkey-pairing notifications to support the pairing flow.

Enhancements:

  • Debounce connection-update webhooks to reduce repeated notifications.
  • Store WhatsApp contacts and JID variations in dedicated indexed tables and use those variations for cache lookups.
  • Allow SQS to connect to a configured development queue endpoint and provide fallback credentials for local use.
  • Add a global SQS queue-name environment setting and always include a message deduplication ID.

Build:

  • Add SSH support to Docker builds for fetching GitHub-hosted dependencies and add a build script for creating images.

Deployment:

  • Replace the development Compose stack with PostgreSQL and Redis services.

Documentation:

  • Add deployment instructions for building test and production images.

Chores:

  • Update Baileys to the GitHub-hosted rc.13 version and add the WhatsApp Rust bridge patch.
  • Remove the evolution-manager-v2 submodule and update the npm lockfile.
  • Add PostgreSQL migrations for WhatsApp contact/JID variation tables and update the PostgreSQL Prisma schema.
  • Add 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 WhatsApp contact and JID-variation tables, record their follow-up type changes, and update the Prisma schema to match the stored data.

  • 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
  • prisma/postgresql-migrations/migration_lock.toml L3 (removed lines)

API

Expose the instance profile endpoint and connect it to the monitoring service’s instance lookup.

  • src/api/controllers/instance.controller.ts L402-405
  • src/api/routes/instance.router.ts L57-66
  • src/api/services/monitor.service.ts L79-88

Implementation

Change WhatsApp cache reads and writes to store and query normalized JID variations through the new contact tables.

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

Adjust Baileys connection handling, connection-update webhook debouncing, passkey acknowledgements, and unread-message behavior for the updated fork.

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

Adjust SQS client setup for a development queue and always attach a message deduplication ID.

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

Update instance monitoring lifecycle behavior and preserve the revised exception handling.

  • src/api/controllers/instance.controller.ts L452, L478
  • src/api/services/monitor.service.ts L318

Configuration

Configure SQS development queue support and update the Baileys dependency source and version.

  • package.json L81, L91, L95 (removed lines)
  • src/config/env.config.ts L124, L589

Update container and local-development build/deployment configuration, including SSH-enabled dependency installation and Uno build scripts.

  • .vscode/launch.json L1-34
  • Docker/swarm/evolution_api_v2.yaml L54
  • Dockerfile L13-22 (+3 small edits)
  • build.sh L1-40
  • docker-compose.dev.yaml L2-18

Documentation

Document the Uno image build and deployment commands.

  • UNO_DEPLOY.md L1-12

Lock files and vendored code

Regenerate the Baileys patch for rc13 and add the WhatsApp Rust bridge patch required by the dependency updates.

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

Refresh the package lockfile to record the dependency changes.

  • package-lock.json L2660-2673, L3583-3600, L10370-10401 (+58 small edits)

Remove the evolution manager submodule entry.

  • evolution-manager-v2 (deleted)

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 14 security issues, and 16 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)
  • Axios affected by Denial of Service via proto Key in mergeConfig (link)
  • Axios: HTTP Transport Hijacking via Prototype Pollution (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/services/monitor.service.ts" line_range="80" />
<code_context>
   }

+  public async instanceProfile(instanceName: string) {
+    const instance = await this.prismaRepository.instance.findFirst({ where: { name: instanceName } });
+
+    if (instanceName && !instance && !this.waInstances[instanceName]) {
</code_context>
<issue_to_address>
**Instance profile crosses tenant boundary**

When multiple client names share a database and a caller with the global API key requests another client's instance profile, `instanceProfile` looks up an instance by name without the configured `clientName` and returns the full database row, including its per-instance token; a global-key caller can retrieve another client’s instance data despite the existing tenant filter used by `instanceInfo`.

Apply the configured `clientName` filter and return only the profile fields required by the endpoint.
</issue_to_address>

### Comment 2
<location path="Dockerfile" line_range="15" />
<code_context>

+# Configurar SSH para GitHub
+RUN mkdir -p -m 0700 ~/.ssh && \
+    ssh-keyscan github.com >> ~/.ssh/known_hosts
+
+# Montar a chave SSH durante o build (usando BuildKit)
</code_context>
<issue_to_address>
**Unverified GitHub key permits package substitution**

When the build runs through a network where an attacker can intercept the GitHub host-key scan, `ssh-keyscan` trusts whichever host key the network returns, so an on-path attacker can make the build trust an impersonated GitHub server and supply malicious dependency code during `npm ci`; the build then produces a compromised image.

Pin GitHub's published SSH host keys and verify the scan result against those pins before trusting it.
</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>
**Dependency scripts can use the forwarded SSH agent**

When a dependency lifecycle script executed by `npm ci` is malicious or compromised, `npm ci` runs dependency lifecycle scripts while the SSH agent socket is mounted, so a compromised dependency can use the builder's forwarded key to authenticate to repositories accessible to that key; the build exposes the key's privileges to dependency code.

Install dependencies without exposing a broadly privileged agent to lifecycle scripts, or use a narrowly scoped, read-only build credential and restrict what installation scripts can execute.
</issue_to_address>

### Comment 4
<location path="prisma/postgresql-migrations/migration_lock.toml" line_range="3" />
<code_context>
 # Please do not edit this file manually
 # It should be added in your version-control system (e.g., Git)
-provider = "postgresql"
\ No newline at end of file
+provider = "postgresql"
</code_context>
<issue_to_address>
**Database migrations lose their provider**

Prisma migration commands cannot determine the migration provider from the lock file, so database deployment fails before applying migrations and the service cannot start when startup depends on those migrations.

Keep `provider = "postgresql"` in the migration lock file.
</issue_to_address>

### Comment 5
<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>
**WhatsApp cache builds fail on supported providers**

When the application is generated and built with MySQL or psql_bouncer, the generated Prisma clients for those providers have no `whatsappJidVariation` or `whatsappContact` delegates, so the cache references fail compilation or runtime calls. WhatsApp cache operations therefore fail on those deployments.

Add the cache models and migrations to the supported provider schemas, or avoid referencing those delegates when that provider is selected.

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

### Comment 6
<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 remain stale**

When a message or read-status handler requests an update with a nonempty chat JID, `updateChatUnreadMessages` returns `null` before querying or updating the chat, so unread counts are not recalculated and callers continue to see stale values.

Remove the early return for nonempty JIDs so the function recalculates and persists the unread count.
</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>
**Configured events target missing queues**

When SQS is enabled in per-instance mode and an instance enables events for a queue that has not already been created, `set` no longer calls `saveQueues`, and `init` creates queues only in global mode. `emit` then sends to a nonexistent per-instance queue, so SQS rejects the send and the events are not delivered.

Create the per-instance queues when saving or enabling an instance's event settings.
</issue_to_address>

### Comment 8
<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 starts a new connection**

When `client.logout` throws a 428 error while the connection state is `connecting` or `open`, `logoutInstance` passes the raw error as `lastDisconnect`, but `connectionUpdate` reads the status from `lastDisconnect.error.output.statusCode`. It misses the 428 and takes the reconnect path, starting `connectToWhatsapp` before logout removes credentials.

Pass the 428 error in the shape `connectionUpdate` expects, or handle logout errors without entering the reconnect path.
</issue_to_address>

### Comment 9
<location path="prisma/postgresql-migrations/20251029182355_add_whatsapp_variations/migration.sql" line_range="21-23" />
<code_context>
+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" 
+-- FROM public."IsOnWhatsapp";
+
+-- INSERT INTO "WhatsappJidVariation" (contact_id, jid_variation)
</code_context>
<issue_to_address>
**Existing cache entries are missed**

When a deployment upgrades a database that already has rows in `IsOnWhatsapp`, the migration leaves the copies from `IsOnWhatsapp` commented out, while `getOnWhatsappCache` reads only `WhatsappContact` and its variations. Existing cache entries are therefore missed after upgrade, causing cache misses and live checks.

Migrate the existing `IsOnWhatsapp` rows and their JID variations into the new cache tables as part of the migration.

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

### Comment 10
<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>
**One cache failure aborts the batch**

When a cache lookup or write fails, or an item is malformed, while processing a multi-item batch, `saveOnWhatsappCache` lets the error escape and stops processing later items. Callers such as `contacts.upsert` or `whatsappNumber()` then fail before completing their remaining work or returning verification results.

Catch failures per item, continue processing the remaining items, and prevent cache-write failures from aborting the caller's work.

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

### Comment 11
<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>
**Duplicate events bypass FIFO deduplication**

When global SQS mode sends the same event more than once within the FIFO deduplication window, the explicit timestamp-based `MessageDeduplicationId` overrides content-based deduplication and changes on every emit, so identical events are accepted as separate messages.

Omit the explicit deduplication ID for global queues that use content-based deduplication.

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

### Comment 12
<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 sends target the wrong queue**

When `SQS_DEV_QUEUE_URL` points to a local SQS-compatible service, `init` configures the client endpoint, but `emit` constructs an AWS-hosted `QueueUrl`. Sends therefore address the wrong queue and fail instead of reaching the local service.

Construct the `QueueUrl` using the configured development endpoint when local SQS is enabled.
</issue_to_address>

### Comment 13
<location path="src/utils/onWhatsappCache.ts" line_range="67" />
<code_context>
-        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>
**Missing JID aborts message batch**

When a LID-addressed message has no alternate JID and the cache is enabled, `saveOnWhatsappCache` dereferences `item.remoteJid` before checking it, so `.startsWith` throws. The message handler catches the exception before finishing the batch, skipping later messages.

Check that `item.remoteJid` exists before dereferencing it and handle missing JIDs without aborting the batch.
</issue_to_address>

### Comment 14
<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**

When an instance changes connection state more than once within 30 seconds, or the process exits before the timer fires, `debouncedConnectionUpdateWebhook` delays delivery for 30 seconds and replaces earlier pending updates with the latest one. Subscribers miss intermediate transitions, and a restart can drop the pending update.

Deliver connection-state updates promptly without replacing pending transitions with a debounced latest state.
</issue_to_address>

### Comment 15
<location path="src/utils/onWhatsappCache.ts" line_range="137-150" />
<code_context>
-      logger.error(e);
+    } else {
+      // Cria novo contato com todas as variações
+      await prismaRepository.whatsappContact.create({
+        data: {
+          remoteJid,
+          lid: lidValue,
+          variations: {
+            createMany: {
+              data: uniqueJids.map((jid) => ({
+                jidVariation: jid,
+              })),
+              skipDuplicates: true,
+            },
+          },
+        },
+      });
+
+      logger.verbose(`Created new contact: ${remoteJid} with ${uniqueJids.length} variations`);
</code_context>
<issue_to_address>
**Concurrent cache creates fail**

When separate requests or instance handlers save the same previously uncached JID concurrently, both calls can find no matching variation and attempt to create the contact. The unique constraint rejects one create, propagating an error and aborting the caller's cache update.

Handle the unique-constraint race by reusing or updating the contact created by the concurrent request.
</issue_to_address>

### Comment 16
<location path="src/utils/onWhatsappCache.ts" line_range="85-108" />
<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: {
+          in: uniqueJids,
         },
-      });
+      },
+      include: {
</code_context>
<issue_to_address>
**Linked JIDs resolve to separate contacts**

When incoming identifiers are already stored under different contacts before a save links them, `findFirst` selects only one existing contact, and `createMany` skips variations owned by another contact without moving them. The linked JIDs remain split across cache rows and can resolve to inconsistent contacts.

Merge the existing contacts and move their variations to one contact when a save links identifiers already stored separately.

Also at `src/utils/onWhatsappCache.ts:124-131`.
</issue_to_address>

### Comment 17
<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 18
<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 19
<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 20
<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 21
<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 22
<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 23
<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 24
<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 25
<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 26
<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 27
<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 28
<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>

### Comment 29
<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 30
<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>

Sourcery assessment

Needs a human reviewer. 30 findings to address first, and replacing Baileys and its Signal dependency with a fork, a different libsignal package, and a Rust bridge changes the protocol and cryptographic code handling WhatsApp sessions and messages. If that behavior is wrong, reverting can restore the old implementation, but cannot undo any session or message data exposed or messages already sent.

Blocking findings: src/api/services/monitor.service.ts:80, Dockerfile:15, Dockerfile:27, prisma/postgresql-migrations/migration_lock.toml:3, src/utils/onWhatsappCache.ts:85, and 25 more


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

}

public async instanceProfile(instanceName: string) {
const instance = await this.prismaRepository.instance.findFirst({ where: { name: instanceName } });

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 · Instance profile crosses tenant boundary

When multiple client names share a database and a caller with the global API key requests another client's instance profile, instanceProfile looks up an instance by name without the configured clientName and returns the full database row, including its per-instance token; a global-key caller can retrieve another client’s instance data despite the existing tenant filter used by instanceInfo.

Apply the configured clientName filter and return only the profile fields required by the endpoint.

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

**Instance profile crosses tenant boundary**

When multiple client names share a database and a caller with the global API key requests another client's instance profile, `instanceProfile` looks up an instance by name without the configured `clientName` and returns the full database row, including its per-instance token; a global-key caller can retrieve another client’s instance data despite the existing tenant filter used by `instanceInfo`.

Apply the configured `clientName` filter and return only the profile fields required by the endpoint.

Comment thread Dockerfile

# Configurar SSH para GitHub
RUN mkdir -p -m 0700 ~/.ssh && \
ssh-keyscan github.com >> ~/.ssh/known_hosts

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 · Unverified GitHub key permits package substitution

When the build runs through a network where an attacker can intercept the GitHub host-key scan, ssh-keyscan trusts whichever host key the network returns, so an on-path attacker can make the build trust an impersonated GitHub server and supply malicious dependency code during npm ci; the build then produces a compromised image.

Pin GitHub's published SSH host keys and verify the scan result against those pins before trusting it.

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

**Unverified GitHub key permits package substitution**

When the build runs through a network where an attacker can intercept the GitHub host-key scan, `ssh-keyscan` trusts whichever host key the network returns, so an on-path attacker can make the build trust an impersonated GitHub server and supply malicious dependency code during `npm ci`; the build then produces a compromised image.

Pin GitHub's published SSH host keys and verify the scan result against those pins before trusting it.

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 · Dependency scripts can use the forwarded SSH agent

When a dependency lifecycle script executed by npm ci is malicious or compromised, npm ci runs dependency lifecycle scripts while the SSH agent socket is mounted, so a compromised dependency can use the builder's forwarded key to authenticate to repositories accessible to that key; the build exposes the key's privileges to dependency code.

Install dependencies without exposing a broadly privileged agent to lifecycle scripts, or use a narrowly scoped, read-only build credential and restrict what installation scripts can execute.

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

**Dependency scripts can use the forwarded SSH agent**

When a dependency lifecycle script executed by `npm ci` is malicious or compromised, `npm ci` runs dependency lifecycle scripts while the SSH agent socket is mounted, so a compromised dependency can use the builder's forwarded key to authenticate to repositories accessible to that key; the build exposes the key's privileges to dependency code.

Install dependencies without exposing a broadly privileged agent to lifecycle scripts, or use a narrowly scoped, read-only build credential and restrict what installation scripts can execute.

@@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "postgresql" No newline at end of file

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.

🔴 Critical · Database migrations lose their provider

Prisma migration commands cannot determine the migration provider from the lock file, so database deployment fails before applying migrations and the service cannot start when startup depends on those migrations.

Keep provider = "postgresql" in the migration lock file.

Prompt for AI agents
In `prisma/postgresql-migrations/migration_lock.toml` at line 3:

**Database migrations lose their provider**

Prisma migration commands cannot determine the migration provider from the lock file, so database deployment fails before applying migrations and the service cannot start when startup depends on those migrations.

Keep `provider = "postgresql"` in the migration lock file.

const uniqueJids = Array.from(new Set(expandedJids));

// 🎯 NOVA LÓGICA: Busca por variação em vez de LIKE
const existingVariation = await prismaRepository.whatsappJidVariation.findFirst({

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 · WhatsApp cache builds fail on supported providers

When the application is generated and built with MySQL or psql_bouncer, the generated Prisma clients for those providers have no whatsappJidVariation or whatsappContact delegates, so the cache references fail compilation or runtime calls. WhatsApp cache operations therefore fail on those deployments.

Add the cache models and migrations to the supported provider schemas, or avoid referencing those delegates when that provider is selected.

Also at src/utils/onWhatsappCache.ts:179-184.

Prompt for AI agents
In `src/utils/onWhatsappCache.ts` at line 85:

**WhatsApp cache builds fail on supported providers**

When the application is generated and built with MySQL or psql_bouncer, the generated Prisma clients for those providers have no `whatsappJidVariation` or `whatsappContact` delegates, so the cache references fail compilation or runtime calls. WhatsApp cache operations therefore fail on those deployments.

Add the cache models and migrations to the supported provider schemas, or avoid referencing those delegates when that provider is selected.

Also at `src/utils/onWhatsappCache.ts:179-184`.

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

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-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

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-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

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