-
Notifications
You must be signed in to change notification settings - Fork 0
chore(eslint): fix 21 quick-win errors (Onda 5 PR 5.1) #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -99,6 +99,7 @@ export function truncate(str: string, maxLength: number): string { | |||||
| export function sanitizeDisplayName(name: string, maxLength = 100): string { | ||||||
| // Remove zero-width characters, control chars, and direction overrides | ||||||
| const cleaned = name | ||||||
| // eslint-disable-next-line no-control-regex -- intentionally matches control chars (U+0000-001F, U+007F-009F) to strip them | ||||||
| .replace(/[\u200B-\u200F\u202A-\u202E\uFEFF\u0000-\u001F\u007F-\u009F]/g, '') | ||||||
| .trim(); | ||||||
|
|
||||||
|
|
@@ -112,7 +113,7 @@ export function sanitizeDisplayName(name: string, maxLength = 100): string { | |||||
| export function sanitizeJid(jid: string): string | null { | ||||||
| // Individual: 5511999999999@s.whatsapp.net | ||||||
| // Group: 120363XXXX@g.us | ||||||
| const jidPattern = /^[\d\-]+@(s\.whatsapp\.net|g\.us|lid|newsletter)$/; | ||||||
| const jidPattern = /^[\d-]+@(s\.whatsapp\.net|g\.us|lid|newsletter)$/; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regex de JID permite entradas inválidas sem dígitos. Com Diff sugerido- const jidPattern = /^[\d-]+@(s\.whatsapp\.net|g\.us|lid|newsletter)$/;
+ const jidPattern = /^(?:\d+@s\.whatsapp\.net|\d+-\d+@g\.us|\d+@(?:lid|newsletter))$/;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| const trimmed = jid.trim(); | ||||||
|
|
||||||
| if (jidPattern.test(trimmed)) { | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: adm01-debug/zapp-web
Length of output: 1480
🏁 Script executed:
Repository: adm01-debug/zapp-web
Length of output: 4749
🏁 Script executed:
Repository: adm01-debug/zapp-web
Length of output: 46
🏁 Script executed:
Repository: adm01-debug/zapp-web
Length of output: 315
🏁 Script executed:
Repository: adm01-debug/zapp-web
Length of output: 1226
🏁 Script executed:
Repository: adm01-debug/zapp-web
Length of output: 824
🏁 Script executed:
Repository: adm01-debug/zapp-web
Length of output: 2142
🏁 Script executed:
Repository: adm01-debug/zapp-web
Length of output: 765
🏁 Script executed:
Repository: adm01-debug/zapp-web
Length of output: 4262
🏁 Script executed:
Repository: adm01-debug/zapp-web
Length of output: 1293
🏁 Script executed:
Repository: adm01-debug/zapp-web
Length of output: 5370
Sanitização insuficiente permite injeção de filtro PostgREST
O regex atual
/[\s\-()]/gdeixa passar caracteres especiais (vírgula, aspas, ponto, etc.) que quebram a sintaxe do filtro.or(). Uma entrada como123",phone.eq.456,phone.ilike.%passa intacta, corrompendo a query.Use
/\D/gpara manter apenas dígitos (números de telefone só precisam disso):useNewConversation.ts:51:searchQuerynão tem sanitização e passa direto para.or(\name.ilike.%${searchQuery}%,phone.ilike.%${searchQuery}%`)`. Adicione validação lá também.📝 Committable suggestion
🤖 Prompt for AI Agents