@the-bearded-bear/claude-craft 8.8.1 → 8.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/Dev/i18n/de/Angular/commands/check-compliance.md +218 -168
  2. package/Dev/i18n/de/Common/agents/refactoring-specialist.md +146 -69
  3. package/Dev/i18n/de/Common/commands/add-technology.md +166 -68
  4. package/Dev/i18n/de/Common/commands/setup-ci.md +216 -33
  5. package/Dev/i18n/de/Laravel/commands/check-compliance.md +223 -115
  6. package/Dev/i18n/de/Python/checklists/new-feature.md +319 -44
  7. package/Dev/i18n/de/React/rules/02-architecture.md +483 -322
  8. package/Dev/i18n/de/React/rules/03-coding-standards.md +584 -368
  9. package/Dev/i18n/de/Symfony/commands/check-compliance.md +186 -114
  10. package/Dev/i18n/de/Symfony/rules/07-testing-symfony.md +679 -10
  11. package/Dev/i18n/de/UIUX/commands/a11y-component.md +284 -26
  12. package/Dev/i18n/de/UIUX/commands/design-tokens.md +199 -35
  13. package/Dev/i18n/de/UIUX/commands/user-flow.md +179 -16
  14. package/Dev/i18n/de/VueJS/commands/check-compliance.md +227 -102
  15. package/Dev/i18n/es/Angular/commands/check-compliance.md +217 -167
  16. package/Dev/i18n/es/Common/commands/add-technology.md +158 -60
  17. package/Dev/i18n/es/Laravel/commands/check-compliance.md +223 -115
  18. package/Dev/i18n/es/React/commands/check-testing.md +263 -169
  19. package/Dev/i18n/es/ReactNative/commands/check-testing.md +256 -198
  20. package/Dev/i18n/es/Symfony/commands/check-compliance.md +189 -117
  21. package/Dev/i18n/es/Symfony/commands/check-testing.md +301 -102
  22. package/Dev/i18n/es/Symfony/commands/migration-plan.md +267 -34
  23. package/Dev/i18n/es/UIUX/commands/a11y-component.md +274 -16
  24. package/Dev/i18n/es/UIUX/commands/design-tokens.md +186 -22
  25. package/Dev/i18n/es/UIUX/commands/user-flow.md +173 -10
  26. package/Dev/i18n/es/VueJS/commands/check-compliance.md +227 -102
  27. package/Dev/i18n/fr/Angular/commands/check-compliance.md +217 -167
  28. package/Dev/i18n/fr/Common/commands/ralph-run.md +138 -60
  29. package/Dev/i18n/fr/Laravel/commands/check-compliance.md +223 -115
  30. package/Dev/i18n/fr/React/commands/check-architecture.md +370 -53
  31. package/Dev/i18n/fr/React/commands/check-code-quality.md +454 -64
  32. package/Dev/i18n/fr/React/commands/check-testing.md +476 -102
  33. package/Dev/i18n/fr/Symfony/commands/check-compliance.md +188 -116
  34. package/Dev/i18n/fr/VueJS/commands/check-compliance.md +227 -102
  35. package/Dev/i18n/pt/Angular/commands/check-compliance.md +225 -175
  36. package/Dev/i18n/pt/Common/agents/ralph-conductor.md +211 -30
  37. package/Dev/i18n/pt/Common/commands/add-technology.md +149 -51
  38. package/Dev/i18n/pt/Common/commands/ralph-run.md +239 -35
  39. package/Dev/i18n/pt/Flutter/commands/analyze-performance.md +331 -46
  40. package/Dev/i18n/pt/Flutter/commands/check-compliance.md +234 -29
  41. package/Dev/i18n/pt/Flutter/commands/generate-feature.md +526 -51
  42. package/Dev/i18n/pt/Flutter/commands/generate-widget.md +515 -27
  43. package/Dev/i18n/pt/Flutter/commands/golden-update.md +322 -46
  44. package/Dev/i18n/pt/Flutter/commands/localization-check.md +278 -37
  45. package/Dev/i18n/pt/Laravel/commands/check-compliance.md +212 -104
  46. package/Dev/i18n/pt/React/commands/accessibility-check.md +151 -42
  47. package/Dev/i18n/pt/React/commands/bundle-analyze.md +300 -25
  48. package/Dev/i18n/pt/React/commands/check-architecture.md +369 -34
  49. package/Dev/i18n/pt/React/commands/check-code-quality.md +440 -34
  50. package/Dev/i18n/pt/React/commands/check-compliance.md +232 -62
  51. package/Dev/i18n/pt/React/commands/check-security.md +370 -31
  52. package/Dev/i18n/pt/React/commands/check-testing.md +473 -43
  53. package/Dev/i18n/pt/React/commands/generate-component.md +454 -19
  54. package/Dev/i18n/pt/React/commands/generate-hook.md +425 -24
  55. package/Dev/i18n/pt/React/commands/storybook-story.md +520 -35
  56. package/Dev/i18n/pt/ReactNative/commands/app-size.md +358 -387
  57. package/Dev/i18n/pt/ReactNative/commands/check-code-quality.md +246 -75
  58. package/Dev/i18n/pt/ReactNative/commands/check-compliance.md +191 -85
  59. package/Dev/i18n/pt/ReactNative/commands/check-security.md +363 -115
  60. package/Dev/i18n/pt/ReactNative/commands/check-testing.md +269 -79
  61. package/Dev/i18n/pt/ReactNative/commands/generate-screen.md +491 -324
  62. package/Dev/i18n/pt/ReactNative/commands/native-module.md +539 -82
  63. package/Dev/i18n/pt/ReactNative/commands/store-prepare.md +429 -185
  64. package/Dev/i18n/pt/ReactNative/rules/02-architecture.md +1084 -31
  65. package/Dev/i18n/pt/Symfony/commands/check-compliance.md +195 -123
  66. package/Dev/i18n/pt/UIUX/commands/a11y-audit.md +208 -24
  67. package/Dev/i18n/pt/UIUX/commands/a11y-component.md +281 -23
  68. package/Dev/i18n/pt/UIUX/commands/design-tokens.md +197 -33
  69. package/Dev/i18n/pt/UIUX/commands/user-flow.md +183 -20
  70. package/Dev/i18n/pt/VueJS/commands/check-compliance.md +228 -103
  71. package/Dev/i18n/pt/Workflow/commands/analyze.md +147 -146
  72. package/Dev/i18n/pt/Workflow/commands/design.md +205 -204
  73. package/Dev/i18n/pt/Workflow/commands/implement.md +184 -184
  74. package/Project/i18n/de/Sprint/commands/dev.md +339 -86
  75. package/Project/i18n/es/Sprint/commands/dev.md +342 -91
  76. package/Project/i18n/pt/Sprint/commands/dev.md +343 -92
  77. package/bundles/cursor/.cursorrules +1 -1
  78. package/bundles/windsurf/.windsurfrules +1 -1
  79. package/package.json +1 -1
@@ -1,62 +1,401 @@
1
1
  ---
2
- description: Auditoria de Seguranca
2
+ description: Auditoria de Segurança
3
3
  ---
4
4
 
5
- # Auditoria de Seguranca
5
+ # Auditoria de Segurança
6
6
 
7
- Realizar uma auditoria completa de seguranca da aplicacao React.
7
+ Realize uma auditoria de segurança abrangente da aplicação React.
8
8
 
9
9
  ## O Que Este Comando Faz
10
10
 
11
- 1. **Analise de Seguranca**
12
- - Verificar vulnerabilidades XSS
13
- - Verificar validacao de entrada
14
- - Auditar dependencias
15
- - Verificar implementacao de autenticacao
16
- - Verificar gerenciamento de segredos
17
- - Verificar headers CSP
11
+ 1. **Análise de Segurança**
12
+ - Verificar vulnerabilidades de XSS
13
+ - Validar a sanitização de entradas
14
+ - Auditar dependências
15
+ - Verificar a implementação de autenticação
16
+ - Validar o gerenciamento de segredos
17
+ - Verificar cabeçalhos CSP
18
18
 
19
- 2. **Ferramentas Usadas**
19
+ 2. **Ferramentas Utilizadas**
20
20
  - npm audit
21
21
  - Snyk
22
- - Plugins de seguranca ESLint
22
+ - Plugins de segurança para ESLint
23
23
  - OWASP ZAP (opcional)
24
24
 
25
- 3. **Relatorio Gerado**
26
- - Vulnerabilidades de seguranca
27
- - Niveis de severidade (critico, alto, medio, baixo)
28
- - Passos de remediacao
25
+ 3. **Relatório Gerado**
26
+ - Vulnerabilidades de segurança
27
+ - Níveis de severidade (crítico, alto, médio, baixo)
28
+ - Etapas de remediação
29
29
  - Status de conformidade
30
30
 
31
31
  ## Como Usar
32
32
 
33
33
  ```bash
34
- # Executar auditoria de seguranca
34
+ # Executar auditoria de segurança
35
35
  npm run security:check
36
36
 
37
- # Ou verificacoes individuais
37
+ # Ou verificações individuais
38
38
  npm audit
39
39
  npm run lint:security
40
40
  ```
41
41
 
42
42
  ## Modo Plano
43
43
 
44
- > O modo plano é ativado automaticamente quando o escopo abrange vários módulos ou requer investigação transversal.
44
+ > O modo plano é ativado automaticamente quando o escopo abrange vários módulos ou exige investigação transversal.
45
45
 
46
- ## Checklist de Seguranca
46
+ ## Verificações de Segurança
47
47
 
48
- - [ ] Protecao XSS implementada (DOMPurify para HTML)
49
- - [ ] Validacao de entrada em todos os formularios (Zod/Yup)
50
- - [ ] Autenticacao implementada corretamente
48
+ ### 1. Prevenção de XSS
49
+
50
+ ```typescript
51
+ // ❌ PERIGOSO - Nunca use com entrada do usuário
52
+ const UnsafeComponent = ({ html }: { html: string }) => {
53
+ return <div dangerouslySetInnerHTML={{ __html: html }} />;
54
+ };
55
+
56
+ // ✅ SEGURO - Sanitizar primeiro
57
+ import DOMPurify from 'dompurify';
58
+
59
+ const SafeComponent = ({ html }: { html: string }) => {
60
+ const sanitized = DOMPurify.sanitize(html);
61
+ return <div dangerouslySetInnerHTML={{ __html: sanitized }} />;
62
+ };
63
+
64
+ // ✅ SEGURO - React escapa por padrão
65
+ const SafeComponent = ({ text }: { text: string }) => {
66
+ return <div>{text}</div>; // React escapa automaticamente
67
+ };
68
+ ```
69
+
70
+ ### 2. Validação de Entrada
71
+
72
+ ```typescript
73
+ // ❌ RUIM - Sem validação
74
+ const handleSubmit = (email: string) => {
75
+ sendEmail(email); // Perigoso!
76
+ };
77
+
78
+ // ✅ BOM - Validação com Zod
79
+ import { z } from 'zod';
80
+
81
+ const emailSchema = z.string().email().max(255);
82
+
83
+ const handleSubmit = (email: string) => {
84
+ const result = emailSchema.safeParse(email);
85
+ if (!result.success) {
86
+ throw new Error('E-mail inválido');
87
+ }
88
+ sendEmail(result.data);
89
+ };
90
+ ```
91
+
92
+ ### 3. Autenticação
93
+
94
+ ```typescript
95
+ // ❌ RUIM - Token no localStorage (vulnerável a XSS)
96
+ localStorage.setItem('token', jwt);
97
+
98
+ // ✅ BOM - Cookie HttpOnly (lado do servidor)
99
+ // O servidor define: Set-Cookie: token=xxx; HttpOnly; Secure; SameSite=Strict
100
+
101
+ // ✅ ACEITÁVEL - Se armazenamento no lado do cliente for necessário, criptografar
102
+ import CryptoJS from 'crypto-js';
103
+
104
+ const encryptedToken = CryptoJS.AES.encrypt(token, secretKey).toString();
105
+ sessionStorage.setItem('auth', encryptedToken);
106
+ ```
107
+
108
+ ### 4. Rotas Protegidas
109
+
110
+ ```typescript
111
+ // ✅ BOM - Proteção de rotas
112
+ export const ProtectedRoute: FC<{ children: ReactNode }> = ({ children }) => {
113
+ const { isAuthenticated } = useAuth();
114
+ const location = useLocation();
115
+
116
+ if (!isAuthenticated) {
117
+ return <Navigate to="/login" state={{ from: location }} replace />;
118
+ }
119
+
120
+ return <>{children}</>;
121
+ };
122
+ ```
123
+
124
+ ### 5. Proteção CSRF
125
+
126
+ ```typescript
127
+ // ✅ BOM - Token CSRF nas requisições
128
+ import axios from 'axios';
129
+
130
+ const apiClient = axios.create({
131
+ baseURL: process.env.VITE_API_URL,
132
+ withCredentials: true
133
+ });
134
+
135
+ apiClient.interceptors.request.use((config) => {
136
+ const csrfToken = document
137
+ .querySelector('meta[name="csrf-token"]')
138
+ ?.getAttribute('content');
139
+
140
+ if (csrfToken) {
141
+ config.headers['X-CSRF-TOKEN'] = csrfToken;
142
+ }
143
+
144
+ return config;
145
+ });
146
+ ```
147
+
148
+ ## Segurança de Dependências
149
+
150
+ ### NPM Audit
151
+
152
+ ```bash
153
+ # Verificar vulnerabilidades
154
+ npm audit
155
+
156
+ # Corrigir automaticamente (atenção a breaking changes)
157
+ npm audit fix
158
+
159
+ # Verificar sem corrigir
160
+ npm audit --audit-level=moderate
161
+ ```
162
+
163
+ ### Snyk
164
+
165
+ ```bash
166
+ # Instalar o Snyk
167
+ npm install -g snyk
168
+
169
+ # Autenticar
170
+ snyk auth
171
+
172
+ # Testar vulnerabilidades
173
+ snyk test
174
+
175
+ # Monitorar o projeto
176
+ snyk monitor
177
+ ```
178
+
179
+ ### Manter Dependências Atualizadas
180
+
181
+ ```bash
182
+ # Verificar pacotes desatualizados
183
+ npm outdated
184
+
185
+ # Atualizar com segurança
186
+ npm update
187
+
188
+ # Verificar atualizações principais
189
+ npx npm-check-updates
190
+ ```
191
+
192
+ ## Cabeçalhos de Segurança
193
+
194
+ ### Content Security Policy
195
+
196
+ ```typescript
197
+ // vite.config.ts
198
+ export default defineConfig({
199
+ server: {
200
+ headers: {
201
+ 'Content-Security-Policy': [
202
+ "default-src 'self'",
203
+ "script-src 'self'",
204
+ "style-src 'self' 'unsafe-inline'",
205
+ "img-src 'self' data: https:",
206
+ "font-src 'self'",
207
+ "connect-src 'self' https://api.example.com",
208
+ "frame-ancestors 'none'",
209
+ ].join('; '),
210
+ },
211
+ },
212
+ });
213
+ ```
214
+
215
+ ### Cabeçalhos de Segurança (Nginx)
216
+
217
+ ```nginx
218
+ # nginx.conf
219
+ add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline';" always;
220
+ add_header X-Frame-Options "DENY" always;
221
+ add_header X-Content-Type-Options "nosniff" always;
222
+ add_header X-XSS-Protection "1; mode=block" always;
223
+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;
224
+ ```
225
+
226
+ ## Gerenciamento de Segredos
227
+
228
+ ### Variáveis de Ambiente
229
+
230
+ ```bash
231
+ # ❌ RUIM - Segredos no código
232
+ const API_KEY = 'sk-1234567890abcdef';
233
+
234
+ # ✅ BOM - Variáveis de ambiente
235
+ const API_KEY = import.meta.env.VITE_API_KEY;
236
+ ```
237
+
238
+ ### Gerenciamento de Arquivos .env
239
+
240
+ ```bash
241
+ # .gitignore
242
+ .env
243
+ .env.local
244
+ .env.*.local
245
+
246
+ # .env.example (fazer commit deste arquivo)
247
+ VITE_API_BASE_URL=http://localhost:8000
248
+ VITE_API_KEY=your-api-key-here
249
+
250
+ # .env (NÃO fazer commit)
251
+ VITE_API_BASE_URL=https://api.production.com
252
+ VITE_API_KEY=sk-real-secret-key
253
+ ```
254
+
255
+ ## Vulnerabilidades Comuns
256
+
257
+ ### 1. Redirecionamentos Abertos
258
+
259
+ ```typescript
260
+ // ❌ VULNERÁVEL
261
+ const handleRedirect = () => {
262
+ const url = new URLSearchParams(window.location.search).get('redirect');
263
+ window.location.href = url; // Perigoso!
264
+ };
265
+
266
+ // ✅ SEGURO - Validar URL de redirecionamento
267
+ const ALLOWED_DOMAINS = ['example.com', 'app.example.com'];
268
+
269
+ const handleRedirect = () => {
270
+ const url = new URLSearchParams(window.location.search).get('redirect');
271
+
272
+ try {
273
+ const parsed = new URL(url);
274
+ if (!ALLOWED_DOMAINS.includes(parsed.hostname)) {
275
+ throw new Error('Domínio de redirecionamento inválido');
276
+ }
277
+ window.location.href = url;
278
+ } catch {
279
+ window.location.href = '/';
280
+ }
281
+ };
282
+ ```
283
+
284
+ ### 2. Referência Direta a Objetos Inseguros
285
+
286
+ ```typescript
287
+ // ❌ VULNERÁVEL
288
+ const UserProfile = () => {
289
+ const { userId } = useParams();
290
+ const { data } = useQuery(['user', userId], () =>
291
+ fetch(`/api/users/${userId}`).then(r => r.json())
292
+ );
293
+ // Sem verificação de autorização!
294
+ };
295
+
296
+ // ✅ SEGURO - Autorização no lado do servidor
297
+ // O servidor deve verificar: "O usuário autenticado tem acesso a este recurso?"
298
+ ```
299
+
300
+ ### 3. Injeção de SQL (Backend)
301
+
302
+ ```typescript
303
+ // Frontend: Sempre usar queries parametrizadas no backend
304
+ // ✅ BOM - Validação com Zod antes de enviar
305
+ const userSchema = z.object({
306
+ email: z.string().email(),
307
+ name: z.string().max(100).regex(/^[a-zA-Z\s]+$/),
308
+ });
309
+ ```
310
+
311
+ ## Regras ESLint de Segurança
312
+
313
+ ```json
314
+ // .eslintrc.json
315
+ {
316
+ "plugins": ["security"],
317
+ "extends": ["plugin:security/recommended"],
318
+ "rules": {
319
+ "security/detect-object-injection": "warn",
320
+ "security/detect-non-literal-regexp": "warn",
321
+ "security/detect-unsafe-regex": "error",
322
+ "security/detect-buffer-noassert": "error",
323
+ "security/detect-child-process": "error",
324
+ "security/detect-disable-mustache-escape": "error",
325
+ "security/detect-eval-with-expression": "error",
326
+ "security/detect-no-csrf-before-method-override": "error",
327
+ "security/detect-non-literal-fs-filename": "error",
328
+ "security/detect-non-literal-require": "error",
329
+ "security/detect-possible-timing-attacks": "error",
330
+ "security/detect-pseudoRandomBytes": "error"
331
+ }
332
+ }
333
+ ```
334
+
335
+ ## Checklist de Segurança
336
+
337
+ - [ ] Proteção contra XSS implementada (DOMPurify para HTML)
338
+ - [ ] Validação de entrada em todos os formulários (Zod/Yup)
339
+ - [ ] Autenticação corretamente implementada
51
340
  - [ ] Rotas protegidas configuradas
52
- - [ ] Tokens CSRF usados
53
- - [ ] Segredos em variaveis de ambiente
54
- - [ ] Dependencias auditadas (npm audit/Snyk)
55
- - [ ] Headers de seguranca configurados
56
- - [ ] HTTPS forcado
57
- - [ ] Headers CSP definidos
341
+ - [ ] Tokens CSRF utilizados
342
+ - [ ] Segredos em variáveis de ambiente
343
+ - [ ] Dependências auditadas (npm audit/Snyk)
344
+ - [ ] Cabeçalhos de segurança configurados
345
+ - [ ] HTTPS imposto
346
+ - [ ] Cabeçalhos CSP definidos
58
347
  - [ ] Sem segredos hardcoded
59
348
  - [ ] Links externos usam `rel="noopener noreferrer"`
60
- - [ ] Uploads de arquivo validados
349
+ - [ ] Uploads de arquivos validados
61
350
  - [ ] Rate limiting implementado
62
- - [ ] Logs nao expoem dados sensiveis
351
+ - [ ] Logs não expõem dados sensíveis
352
+
353
+ ## Testes de Segurança
354
+
355
+ ### Testes Automatizados
356
+
357
+ ```typescript
358
+ // security.test.ts
359
+ describe('Segurança', () => {
360
+ it('deve sanitizar entrada HTML', () => {
361
+ const malicious = '<script>alert("xss")</script>';
362
+ const sanitized = DOMPurify.sanitize(malicious);
363
+ expect(sanitized).not.toContain('<script>');
364
+ });
365
+
366
+ it('deve validar o formato do e-mail', () => {
367
+ const result = emailSchema.safeParse('email-invalido');
368
+ expect(result.success).toBe(false);
369
+ });
370
+
371
+ it('deve proteger as rotas', () => {
372
+ render(<ProtectedRoute><AdminPage /></ProtectedRoute>);
373
+ expect(screen.queryByText('Admin')).not.toBeInTheDocument();
374
+ });
375
+ });
376
+ ```
377
+
378
+ ### Testes Manuais
379
+
380
+ 1. Testar vetores XSS em todas as entradas
381
+ 2. Tentar acessar rotas não autorizadas
382
+ 3. Testar com tokens expirados ou inválidos
383
+ 4. Verificar dados sensíveis no console/aba de rede
384
+ 5. Confirmar redirecionamento para HTTPS
385
+ 6. Testar proteção CSRF
386
+
387
+ ## Ferramentas
388
+
389
+ - **npm audit**: Scanner de vulnerabilidades integrado
390
+ - **Snyk**: Monitoramento contínuo de segurança
391
+ - **OWASP ZAP**: Scanner de segurança para aplicações web
392
+ - **DOMPurify**: Sanitização de HTML
393
+ - **helmet**: Cabeçalhos de segurança (servidor)
394
+ - **eslint-plugin-security**: Análise estática de segurança
395
+
396
+ ## Recursos
397
+
398
+ - [OWASP Top 10](https://owasp.org/www-project-top-ten/)
399
+ - [Melhores Práticas de Segurança no React](https://react.dev/learn/escape-hatches#security-pitfalls)
400
+ - [Segurança Web MDN](https://developer.mozilla.org/en-US/docs/Web/Security)
401
+ - [Snyk Advisor](https://snyk.io/advisor/)