-
Notifications
You must be signed in to change notification settings - Fork 7
Audit and Fix Security, Performance, and Accessibility Issues #1047
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
Draft
google-labs-jules
wants to merge
6
commits into
main
Choose a base branch
from
audit-security-performance-a11y-fixes-7680327977151558057
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e421dec
Audit and Fix Security, Performance, and Accessibility Issues
google-labs-jules[bot] 8a6ec03
Update test snapshots after accessibility improvements
google-labs-jules[bot] b874120
Mock UUID generation in tests to stabilize snapshots
google-labs-jules[bot] e06d0f8
Translate audit report to Portuguese
google-labs-jules[bot] a1ddd47
Refine Table component keys and address review feedback
google-labs-jules[bot] dc7757d
Update VULNERABILITIES.md with status indicators
google-labs-jules[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # Auditoria do Projeto: Segurança, Performance e Acessibilidade | ||
|
|
||
| Este documento lista as descobertas de uma auditoria da biblioteca do design system Cuida. | ||
|
|
||
| **Legenda de Status:** | ||
| - ✅ **Resolvido**: Problema corrigido neste PR. | ||
| - ⚠️ **Parcialmente Resolvido**: Melhorado, mas ainda com pontos pendentes. | ||
| - 📝 **Documentado**: Identificado para futuras melhorias. | ||
|
|
||
| ## 1. Problemas de Segurança | ||
|
|
||
| ### 1.1 XSS Potencial no Componente Icon (📝 Documentado) | ||
| O componente `Icon.vue` utiliza `v-html` para renderizar caminhos SVG. Embora os caminhos sejam comparados com um conjunto de ícones predefinido de `@sysvale/cuida-icons`, o uso de `v-html` é geralmente desencorajado a menos que seja estritamente necessário e sanitizado. | ||
| - **Localização**: `src/components/Icon.vue` | ||
| - **Impacto**: Baixo (se os ícones forem confiáveis), mas aumenta a superfície de ataque. | ||
|
|
||
| ### 1.2 Vulnerabilidades de Dependências (✅ Resolvido) | ||
| Múltiplas vulnerabilidades foram encontradas em dependências (principalmente dependências de desenvolvimento): | ||
| - `form-data` (Crítica): Função aleatória insegura. | ||
| - `glob` (Alta): Injeção de comando. | ||
| - `preact` (Alta): Injeção de JSON VNode. | ||
| - `esbuild`/`vite` (Moderada): Vulnerabilidades no servidor de desenvolvimento. | ||
| - `vue` v2.7.16 (Baixa): Vulnerabilidade de ReDoS. | ||
| *Nota: Corrigido via `npm audit fix` e remoção de dependência conflitante.* | ||
|
|
||
| ### 1.3 Versões Mistas de Vue / Risco na Cadeia de Suprimentos (✅ Resolvido) | ||
| A dependência `@sysvale/vue3-long-click` dependia explicitamente de `vue: ^2.5.22`. Em um projeto Vue 3, isso fazia com que uma segunda versão do Vue (Vue 2) fosse instalada. | ||
| - **Impacto**: Alto. Levava a instâncias duplicadas do Vue e trazia vulnerabilidades conhecidas (ReDoS). | ||
| - **Resolução**: Removida a dependência e implementada uma diretiva local `cdsLongClick` compatível com Vue 3. | ||
|
|
||
| --- | ||
|
|
||
| ## 2. Problemas de Performance | ||
|
|
||
| ### 2.1 IDs Duplicados e Não Únicos (✅ Resolvido) | ||
| `Table.vue` utilizava `field.key` como um ID para cada célula (`td`) em uma coluna, gerando múltiplos elementos com o mesmo ID. | ||
| - **Impacto**: Alto. Tornava o `document.getElementById` não confiável e degradava a performance. | ||
| - **Resolução**: Removidos IDs duplicados das células e mantidos apenas nos headers onde são únicos. | ||
|
|
||
| ### 2.2 Tamanho de Bundle Ineficiente nos Gráficos (⚠️ Parcialmente Resolvido) | ||
| Componentes de gráfico registravam todos os componentes do Chart.js usando `registerables`. | ||
| - **Impacto**: Médio. Aumentava significativamente o tamanho do bundle. | ||
| - **Resolução**: `LineChart.vue` foi refatorado para usar registro seletivo (tree-shaking). Outros componentes de gráfico ainda podem ser otimizados. | ||
|
|
||
| ### 2.3 Watches Profundos e Clones Caros (📝 Documentado) | ||
| - `DataTable.vue` usa `lodash.clonedeep` em `customFieldsList`. | ||
| - `Table.vue` usa um watch profundo no array `select`. | ||
| - **Impacto**: Baixo a Médio. | ||
|
|
||
| --- | ||
|
|
||
| ## 3. Problemas de Acessibilidade (a11y) | ||
|
|
||
| ### 3.1 Elementos Clicáveis Não Semânticos (✅ Resolvido) | ||
| `Clickable.vue` usava uma `div` sem papéis ARIA ou suporte a teclado. | ||
| - **Impacto**: Alto. Inacessível para usuários de leitor de tela e teclado. | ||
| - **Resolução**: Adicionados `role="button"`, `tabindex="0"` e suporte às teclas Enter e Espaço. | ||
|
|
||
| ### 3.2 Checkbox Inacessível (✅ Resolvido) | ||
| `Checkbox.vue` ocultava o input nativo de forma que ele não recebia foco nem era lido corretamente. | ||
| - **Impacto**: Alto. Navegação por teclado era impossível. | ||
| - **Resolução**: Refatorado para usar input nativo (visualmente oculto, mas funcional) com anel de foco adequado. | ||
|
|
||
| ### 3.3 Falta de Suporte ao Atributo Disabled Nativo (✅ Resolvido) | ||
| `Button.vue` não aplicava o atributo `disabled` nativo. | ||
| - **Impacto**: Médio. | ||
| - **Resolução**: Atributo `disabled` agora é aplicado corretamente ao elemento HTML. | ||
|
|
||
| ### 3.4 Associação de Label Quebrada (✅ Resolvido) | ||
| `Label.vue` aceitava uma prop `for`, mas não a aplicava ao elemento nativo. | ||
| - **Impacto**: Alto. | ||
| - **Resolução**: Prop `for` agora é aplicada corretamente, vinculando a label ao input. | ||
|
|
||
| ### 3.5 Falta de Roles ARIA em Tabelas (📝 Documentado) | ||
| `Table.vue` e `DataTable.vue` carecem de papéis ARIA (ex: `aria-sort`) e descrições para ações complexas. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Para manter o padrão do projeto, creio que esse arquivo deveria ser em português, ou pelo menos ter uma versão em português.
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.
Perfeito, traduzi o arquivo
VULNERABILITIES.mdpara o português para manter a consistência com o restante do projeto.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.
Seria ideal que fossem indicados, no MD, os problemas que estão sendo resolvidos neste PR.
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.
Excelente sugestão. Atualizei o arquivo⚠️ Parcialmente Resolvido, 📝 Documentado) para deixar claro o que foi corrigido neste PR e o que foi apenas identificado para futuras melhorias.
VULNERABILITIES.mdcom uma legenda de status (✅ Resolvido,