← Back to Pull requests

fix: corrigir 7 vulnerabilidades de bypass wa: em tags em lote #1074

Merged
adm01-debug merged 4 files (112 lines) on Sep 28, 2026 01:16 UTC
View on GitHub
adm01-debug adm01-debug commented on Sep 28, 2026 00:50 UTC
Author

Resumo

Corrige 7 vulnerabilidades de segurança que permitiam tags WhatsApp (wa:) serem escritas/exibidas incorretamente via ações em lote de contatos.

Causa raiz


  • isWhatsAppTag usava tag.startsWith('wa:') — bypass com WA:, Wa:, wA: etc.

  • uniqueTags em useContactsSearch coletava todas as tags sem filtrar wa: — propagava para 4 componentes consumidores

  • BulkActionsBar e ContactBulkTagDialog não tinham guard contra escrita de wa: no banco
  • Correções (4 arquivos)

    src/lib/tags.ts

  • isWhatsAppTag: tag.toLowerCase().startsWith('wa:') — bloqueia variantes de case

  • parseWhatsAppTag: rejeita labelId vazio (wa::) → retorna null
  • src/hooks/crm/useContactsSearch.ts

  • uniqueTags (linha 151): filterCustomTags([...new Set(...)]) — filtra wa: na raiz antes de propagar
  • src/components/contacts/BulkActionsBar.tsx

  • handleBulkTag: guard if (isWhatsAppTag(tag)) return; no início

  • Dropdown: filterCustomTags(availableTags) + getTagDisplayName(tag) — nunca exibe wa:id:Nome
  • src/components/contacts/ContactBulkTagDialog.tsx

  • filteredTags: filterCustomTags(...) — lista de seleção nunca inclui wa:

  • addNewTag: guard if (isWhatsAppTag(newTag.trim())) return; — bloqueia digitação manual de wa:

  • handleApply: safeSelected = [...selectedTags].filter(t => !isWhatsAppTag(t)) — defesa em profundidade antes de escrever no banco

  • Badges e contagem do botão "Aplicar" refletem safeSelected.length (não selectedTags.size)
  • Verificado


  • Grep de todos os pontos de fix no código final — 19 ocorrências confirmadas

  • Builds e tipo-checagem não afetados (só lógica de filtragem, sem mudança de interface)
  • 🤖 Generated with Claude Code

    https://claude.ai/code/session_011gbQqfDvw5xxCwW3K5MaH5

    <!-- This is an auto-generated description by cubic. -->
    ---

    Summary by cubic


    Fixes 7 security bypass vulnerabilities that let WhatsApp-reserved wa: tags be written or displayed through bulk contact actions. Previously, case variants (WA:, Wa:, wA:) bypassed the filter and leaked into bulk-tag UIs and the database; now filtering is case-insensitive and applied at every entry point.

    Bug Fixes

  • isWhatsAppTag lowercases tags before checking the wa: prefix.

  • parseWhatsAppTag rejects malformed tags with an empty label ID (wa::).

  • useContactsSearch uniqueTags and bulk-action tag lists now exclude wa: via filterCustomTags.

  • ContactBulkTagDialog guards manual tag entry and batch apply, and shows display names instead of raw wa:id:Nome values.
  • <sup>Written for commit 6eb0eeaa44ff9f2489bac622d7754fccc56f682a. Summary will update on new commits.</sup>

    <a href="https://cubic.dev/pr/adm01-debug/Zapp_Web_V2/pull/1074?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>

    <!-- End of auto-generated description by cubic. -->

    Diff: 112 lines (+81 / -31) across 4 files Reviewer: adm01-debug Review duration: 26m
    All Vouch review confidence checks passed
    Residual risk 0.11 = Change Risk (0.55) × (1 − Review Confidence (0.80)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.55 · 112 lines diff across 4 files
    0.55
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.90 · 5 substantive comment(s)
    0.90
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    79%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.283
    Self Review self_review
    0.140
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    13 items
    ecc-tools[bot] ecc-tools[bot] commented on Sep 28, 2026 00:50 UTC
    Bot

    <!-- ecc-tools:pr-audit:ECC Tools / Security Evidence:6eb0eeaa44ff9f2489bac622d7754fccc56f682a -->

    ECC Tools / Security Evidence

    Commit: 6eb0eeaa44ff9f2489bac622d7754fccc56f682a

    Security scanner evidence required (action_required)

    Detected 1 security-sensitive predictive risk signal(s) without scanner evidence.

    Mode: enforce

    Findings:

  • Security-sensitive changes may ship without scanner evidence: The PR touches billing, secrets, auth, webhooks, agent, or CI-sensitive surfaces without adding obvious security scanner, code scanning, or security-focused validation evidence. (1 security-sensitive paths changed; 0 security scanner or security-focused validation artifacts changed)
  • Touched security-sensitive paths:

  • src/hooks/crm/useContactsSearch.ts
  • Expected evidence:

  • Security scanner, code scanning, secret scanning, dependency/security review, or focused security regression output.

  • SARIF/code-scanning upload or equivalent pass/fail gate for the changed surface.
  • Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

    ecc-tools[bot] ecc-tools[bot] commented on Sep 28, 2026 00:50 UTC
    Bot

    <!-- ecc-tools:pr-audit:ECC Tools / PR Risk Taxonomy:6eb0eeaa44ff9f2489bac622d7754fccc56f682a -->

    ECC Tools / PR Risk Taxonomy

    Commit: 6eb0eeaa44ff9f2489bac622d7754fccc56f682a

    PR taxonomy review recommended (neutral)

    Detected 2 PR taxonomy bucket(s): Security Evidence, CI/CD Recommendation.

    Scanned 4 changed file(s).

    Roadmap taxonomy buckets:

    Security Evidence


    Security-sensitive changes should carry explicit scanner, code-scanning, or focused regression evidence.

    Signals:

  • Security-sensitive changes may ship without scanner evidence

  • 0 security-sensitive path(s) changed
  • Paths:

  • src/components/contacts/BulkActionsBar.tsx

  • src/components/contacts/ContactBulkTagDialog.tsx

  • src/hooks/crm/useContactsSearch.ts
  • CI/CD Recommendation


    CI, dependency, coverage, and contract signals should be routed into follow-up checks or verification work.

    Signals:

  • User-facing UI changes may ship without browser coverage

  • 0 CI or workflow path(s) changed
  • Paths:

  • src/components/contacts/BulkActionsBar.tsx

  • src/components/contacts/ContactBulkTagDialog.tsx

  • src/hooks/crm/useContactsSearch.ts

  • src/lib/tags.ts
  • Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

    vercel[bot] vercel[bot] commented on Sep 28, 2026 00:50 UTC
    Bot

    [vc]: #6VMUl277Hr6JpH0cI6sQHjPps5evyZUg2iIpVo8NZZE=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJ6YXBwX3dlYl92MiIsInByb2plY3RJZCI6InByal9KNHdiOGVneno4aUwxQ0puU09YSkR0cW5idlJwIiwiaW5zcGVjdG9yVXJsIjoiaHR0cHM6Ly92ZXJjZWwuY29tL2p1Y2ExL3phcHBfd2ViX3YyLzUxUlhLNjVEaWpUMlZrWUE1YUpld0tyd1JuVFMiLCJwcmV2aWV3VXJsIjoiemFwcHdlYnYyLWdpdC1jbGF1ZGUtZml4LXdhLXRhZy1zZWN1cml0eS0yNjA5MjgtMTQzMC1qdWNhMS52ZXJjZWwuYXBwIiwibmV4dENvbW1pdFN0YXR1cyI6IkRFUExPWUVEIiwibGl2ZUZlZWRiYWNrIjp7InJlc29sdmVkIjowLCJ1bnJlc29sdmVkIjowLCJ0b3RhbCI6MCwibGluayI6InphcHB3ZWJ2Mi1naXQtY2xhdWRlLWZpeC13YS10YWctc2VjdXJpdHktMjYwOTI4LTE0MzAtanVjYTEudmVyY2VsLmFwcCJ9LCJyb290RGlyZWN0b3J5IjpudWxsfV19
    The latest updates on your projects. Learn more about Vercel for GitHub.

    | Project | Deployment | Actions | Updated |
    | :--- | :----- | :------ | :------ |
    | <a href="https://vercel.com/juca1/zapp_web_v2"><sup><img src="https://vercel.com/api/www/avatar?projectId=prj_J4wb8egzz8iL1CJnSOXJDtqnbvRp&teamId=team_QyN41X0q8hrqhW80AwokbFLv&s=32" width="16" height="16" align="middle" alt="" /></sup></a> zapp_web_v2 | !Ready Ready | Preview | <relative-time datetime="2026-09-28T00:50:34.867Z">Sep 28, 2026 12:50am UTC</relative-time> |

    greptile-apps[bot] greptile-apps[bot] commented on Sep 28, 2026 00:50 UTC
    Reviewer

    Your trial has ended. Reactivate Greptile to resume code reviews.

    ecc-tools[bot] ecc-tools[bot] commented on Sep 28, 2026 00:50 UTC
    Bot

    <!-- ecc-tools:pr-audit:ECC Tools / Reference Set Readiness:6eb0eeaa44ff9f2489bac622d7754fccc56f682a -->

    ECC Tools / Reference Set Readiness

    Commit: 6eb0eeaa44ff9f2489bac622d7754fccc56f682a

    Reference set readiness gaps detected (neutral)

    Reference evidence present for 0/7 areas (0%) across 4 changed file(s).

    This check is based on files changed in this PR. Repository-level readiness is still reported by /ecc-tools analyze comments and generated manifests.

    | Area | Status | Evidence / Next Step |
    | --- | --- | --- |
    | Deep analyzer corpus | Missing | Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions. |
    | RAG/evaluator comparison | Missing | Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior. |
    | PR salvage/review corpus | Missing | Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation. |
    | Discussion triage corpus | Missing | Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications. |
    | Harness compatibility | Missing | Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces. |
    | Security evidence | Missing | Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs. |
    | CI failure-mode evidence | Missing | Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes. |

    Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

    coderabbitai[bot] coderabbitai[bot] commented on Sep 28, 2026 00:50 UTC
    Bot

    <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
    <!-- This is an auto-generated comment: skip review by coderabbit.ai -->

    [!IMPORTANT]

    - [ ] <!-- {"checkboxId":"e9bb8d72-00e8-4f67-9cb2-caf3b22574fe"} --> 🔍 Trigger review

    > This repository does not receive automatic reviews because it has fewer than 10 stars.

    > <details>

    <summary>⚙️ Run configuration</summary>

    > Configuration used: Organization UI

    > Review profile: CHILL

    > Plan: Advanced

    > Run ID: faa1db56-55f7-4904-bbc6-0410ec312e2a

    > </details>

    <!-- end of auto-generated comment: skip review by coderabbit.ai -->

    [!WARNING]

    Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.

    <!-- tips_start -->

    ---

    Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

    <details>
    <summary>❤️ Share</summary>

  • X

  • Mastodon

  • Reddit

  • LinkedIn
  • </details>

    <sub>Comment @coderabbitai help to get the list of available commands.</sub>

    <!-- tips_end -->

    ecc-tools[bot] ecc-tools[bot] commented on Sep 28, 2026 00:50 UTC
    Bot

    <!-- ecc-tools:pr-audit:ECC Tools / Hosted Promotion Readiness:6eb0eeaa44ff9f2489bac622d7754fccc56f682a -->

    ECC Tools / Hosted Promotion Readiness

    Commit: 6eb0eeaa44ff9f2489bac622d7754fccc56f682a

    Hosted promotion readiness passed (success)

    No hosted promotion evidence gaps detected across 4 changed file(s); 0 corpus scenarios had matching evidence.

    This check compares PR file changes against the evaluator/RAG promotion corpus in src/analyzers/fixtures/evaluator-rag-corpus.ts.
    Hosted output scoring inspected 0 completed cached hosted job results.

    No evaluator corpus scenarios matched this PR.

    Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

    greptile-apps[bot] greptile-apps[bot] commented on Sep 28, 2026 01:03 UTC
    Reviewer

    Your trial has ended. Reactivate Greptile to resume code reviews.

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Sep 28, 2026 01:03 UTC
    Bot

    <!-- codex-pull-request-review-summary -->

    Codex Review Summary

    This comment shows the latest Codex review activity on this pull request.

    | Review | Status | Commit | Review trigger |
    | --- | --- | --- | --- |
    | 📝 Code Review | ✅ Completed <relative-time datetime="2026-09-28T01:05:17.585470Z">2026-09-28T01:05:17.585470Z</relative-time> | 6eb0eea | Draft marked ready |

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review" or "@codex security review".
  • Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

    </details>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Sep 28, 2026 01:05 UTC
    Reviewer

    💡 Codex Review

    Here are some automated review suggestions for this pull request.

    Reviewed commit: 6eb0eeaa44

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review".
  • If Codex has suggestions, it will comment; otherwise it will react with 👍.

    Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    </details>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Sep 28, 2026 01:05 UTC
    Code Review
    src/components/contacts/BulkActionsBar.tsx:1
    @@ -186,9 +185,9 @@ export function BulkActionsBar({
                 </Button>
               </DropdownMenuTrigger>
               <DropdownMenuContent>
    -            {CONTACT_TYPES.map(ct => (
    -              <DropdownMenuItem key={ct.value} onClick={() => handleBulkType(ct.value)}>
    -                {ct.label}
    +            {['cliente', 'lead', 'fornecedor', 'colaborador', 'parceiro'].map(type => (
    +              <DropdownMenuItem key={type} onClick={() => handleBulkType(type)}>
    +                {type.charAt(0).toUpperCase() + type.slice(1)}

    <sub><sub>!P2 Badge</sub></sub> Restore the canonical contact types in the bulk selector

    When users bulk-categorize contacts as transportadora or prestador_servico, those options are no longer available because this local array replaces the shared CONTACT_TYPES list still used by ContactForm and ContactTypeTabs; meanwhile it adds lead, so bulk editing now exposes a different taxonomy from individual editing and filtering. Keep this selector sourced from the canonical constant so all supported types remain assignable in bulk.

    Useful? React with 👍 / 👎.

    adm01-debug adm01-debug commented on code on Sep 28, 2026 01:19 UTC
    Code Review
    src/components/contacts/BulkActionsBar.tsx:1
    @@ -186,9 +185,9 @@ export function BulkActionsBar({
                 </Button>
               </DropdownMenuTrigger>
               <DropdownMenuContent>
    -            {CONTACT_TYPES.map(ct => (
    -              <DropdownMenuItem key={ct.value} onClick={() => handleBulkType(ct.value)}>
    -                {ct.label}
    +            {['cliente', 'lead', 'fornecedor', 'colaborador', 'parceiro'].map(type => (
    +              <DropdownMenuItem key={type} onClick={() => handleBulkType(type)}>
    +                {type.charAt(0).toUpperCase() + type.slice(1)}

    Boa captura. O array inline perdeu transportadora e prestador_servico. Vou restaurar CONTACT_TYPES.map(ct => ...) no próximo PR junto com as correções de display dos demais componentes.

    ---
    _Generated by Claude Code_

    Reviewers
    Assignees
    adm01-debug adm01-debug
    Labels
    risk: low confidence: 79.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 54.7% (MEDIUM) · Higher = larger blast radius
    54.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 79.9% · Lower = rushed or shallow review
    79.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 11.0% · Safe to merge
    11.0%