@fontdata/ai-harness 4.4.0 → 4.5.0

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 (213) hide show
  1. package/.claude-plugin/plugin.json +2 -2
  2. package/README.md +74 -1
  3. package/dist/cli.js +1 -0
  4. package/dist/config/config.js +20 -12
  5. package/dist/delphi/catalogo.js +299 -0
  6. package/dist/delphi/classificar.js +21 -0
  7. package/dist/delphi/command.js +43 -2
  8. package/dist/doctor/checks.js +19 -1
  9. package/dist/init.js +9 -1
  10. package/dist/install/perfis.js +11 -4
  11. package/dist/mapa/extratores/pascal.js +1 -1
  12. package/dist/update/update.js +80 -23
  13. package/package.json +1 -1
  14. package/templates/CLAUDE.md +2 -1
  15. package/templates/catalog.json +9 -4
  16. package/templates/hooks/comentarios/check.mjs +62 -5
  17. package/templates/hooks/hooks.json +2 -1
  18. package/templates/hooks/lib/config.mjs +1 -0
  19. package/templates/hooks/padroes-proibidos.mjs +68 -0
  20. package/templates/perfis/delphi/rules/linguagem/reaproveitar-funcao-existente-antes-de-criar.md +6 -6
  21. package/templates/perfis/delphi/skills/conhecimento-delphi/SKILL.md +6 -0
  22. package/templates/perfis/delphi-fiscal/rules/campo-novo-acbr-preenchimento-explicito.md +61 -0
  23. package/templates/perfis/delphi-fiscal/rules/retorno-de-evento-nfe-pelo-cstat.md +51 -0
  24. package/templates/perfis/delphi-fiscal/rules/sucesso-de-webservice-fiscal-nao-prova-documento.md +100 -0
  25. package/templates/perfis/delphi-fiscal/rules/total-tributo-acbr-soma-itens.md +63 -0
  26. package/templates/perfis/delphi-fiscal/skills/diagnosticar-rejeicao-nfse/SKILL.md +155 -0
  27. package/templates/perfis/delphi-fiscal/skills/patch-acbr/SKILL.md +143 -0
  28. package/templates/skills/auditar-performance/SKILL.md +9 -0
  29. package/templates/skills/auditar-performance/references/pontos-quentes.md +8 -0
  30. package/templates/skills/auditar-seguranca/SKILL.md +55 -14
  31. package/templates/skills/auditar-seguranca/templates/relatorios/TECNICO.md +5 -0
  32. package/templates/skills/auditar-ui/SKILL.md +18 -3
  33. package/templates/skills/auditar-ui/references/ATRIBUICAO.md +44 -0
  34. package/templates/skills/auditar-ui/references/web-interface-guidelines.md +191 -0
  35. package/templates/skills/harness/references/validar-ideia.md +7 -6
  36. package/templates/skills/security-audit/AI-AND-LLM.md +83 -0
  37. package/templates/skills/security-audit/ATTACK-CLASSES.md +130 -0
  38. package/templates/skills/security-audit/CLIENT-SIDE.md +83 -0
  39. package/templates/skills/security-audit/CLOUD-AND-DEPLOYMENT.md +86 -0
  40. package/templates/skills/security-audit/DATA-ISOLATION-AND-LIFECYCLE.md +84 -0
  41. package/templates/skills/security-audit/DESKTOP-MOBILE-AND-LOCAL-IPC.md +89 -0
  42. package/templates/skills/security-audit/HUNTING.md +251 -0
  43. package/templates/skills/security-audit/LICENSE +21 -0
  44. package/templates/skills/security-audit/MEMORY-SAFETY-AND-BINARY.md +101 -0
  45. package/templates/skills/security-audit/ORIGEM.md +51 -0
  46. package/templates/skills/security-audit/PROTOCOLS-RPC-AND-MESSAGING.md +81 -0
  47. package/templates/skills/security-audit/RECONNAISSANCE.md +156 -0
  48. package/templates/skills/security-audit/RESOURCE-EXHAUSTION-AND-AVAILABILITY.md +78 -0
  49. package/templates/skills/security-audit/SKILL.md +192 -0
  50. package/templates/skills/security-audit/SUPPLY-CHAIN-AND-RELEASE.md +73 -0
  51. package/templates/skills/security-audit/VALIDATION-AND-REPORTING.md +186 -0
  52. package/templates/skills/security-audit/WEB-PROTOCOL-AND-AUTH.md +105 -0
  53. package/templates/skills/security-audit/report-schema.json +461 -0
  54. package/templates/skills/security-audit/validate-coverage-ledger.cjs +872 -0
  55. package/templates/skills/security-audit/validate-findings.cjs +773 -0
  56. package/templates/skills/supabase-postgres-best-practices/CHANGELOG.md +73 -0
  57. package/templates/skills/supabase-postgres-best-practices/LICENSE +21 -0
  58. package/templates/skills/supabase-postgres-best-practices/ORIGEM.md +43 -0
  59. package/templates/skills/supabase-postgres-best-practices/SKILL.md +64 -0
  60. package/templates/skills/supabase-postgres-best-practices/references/_contributing.md +170 -0
  61. package/templates/skills/supabase-postgres-best-practices/references/_sections.md +39 -0
  62. package/templates/skills/supabase-postgres-best-practices/references/_template.md +34 -0
  63. package/templates/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +55 -0
  64. package/templates/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +49 -0
  65. package/templates/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +46 -0
  66. package/templates/skills/supabase-postgres-best-practices/references/conn-limits.md +44 -0
  67. package/templates/skills/supabase-postgres-best-practices/references/conn-pooling.md +41 -0
  68. package/templates/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +46 -0
  69. package/templates/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +54 -0
  70. package/templates/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +53 -0
  71. package/templates/skills/supabase-postgres-best-practices/references/data-pagination.md +50 -0
  72. package/templates/skills/supabase-postgres-best-practices/references/data-upsert.md +50 -0
  73. package/templates/skills/supabase-postgres-best-practices/references/lock-advisory.md +56 -0
  74. package/templates/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +68 -0
  75. package/templates/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +50 -0
  76. package/templates/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +54 -0
  77. package/templates/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +45 -0
  78. package/templates/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +55 -0
  79. package/templates/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +55 -0
  80. package/templates/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +44 -0
  81. package/templates/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +40 -0
  82. package/templates/skills/supabase-postgres-best-practices/references/query-index-types.md +48 -0
  83. package/templates/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +43 -0
  84. package/templates/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +45 -0
  85. package/templates/skills/supabase-postgres-best-practices/references/schema-constraints.md +80 -0
  86. package/templates/skills/supabase-postgres-best-practices/references/schema-data-types.md +46 -0
  87. package/templates/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +59 -0
  88. package/templates/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +55 -0
  89. package/templates/skills/supabase-postgres-best-practices/references/schema-partitioning.md +55 -0
  90. package/templates/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +61 -0
  91. package/templates/skills/supabase-postgres-best-practices/references/security-privileges.md +54 -0
  92. package/templates/skills/supabase-postgres-best-practices/references/security-rls-basics.md +50 -0
  93. package/templates/skills/supabase-postgres-best-practices/references/security-rls-performance.md +63 -0
  94. package/templates/skills/vercel-react-best-practices/AGENTS.md +3810 -0
  95. package/templates/skills/vercel-react-best-practices/ORIGEM.md +39 -0
  96. package/templates/skills/vercel-react-best-practices/README.md +123 -0
  97. package/templates/skills/vercel-react-best-practices/SKILL.md +149 -0
  98. package/templates/skills/vercel-react-best-practices/metadata.json +15 -0
  99. package/templates/skills/vercel-react-best-practices/rules/_sections.md +46 -0
  100. package/templates/skills/vercel-react-best-practices/rules/_template.md +28 -0
  101. package/templates/skills/vercel-react-best-practices/rules/advanced-effect-event-deps.md +56 -0
  102. package/templates/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  103. package/templates/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
  104. package/templates/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
  105. package/templates/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
  106. package/templates/skills/vercel-react-best-practices/rules/async-cheap-condition-before-await.md +37 -0
  107. package/templates/skills/vercel-react-best-practices/rules/async-defer-await.md +82 -0
  108. package/templates/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
  109. package/templates/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
  110. package/templates/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
  111. package/templates/skills/vercel-react-best-practices/rules/bundle-analyzable-paths.md +63 -0
  112. package/templates/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +60 -0
  113. package/templates/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
  114. package/templates/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
  115. package/templates/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  116. package/templates/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
  117. package/templates/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
  118. package/templates/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
  119. package/templates/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
  120. package/templates/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
  121. package/templates/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
  122. package/templates/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
  123. package/templates/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
  124. package/templates/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
  125. package/templates/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
  126. package/templates/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
  127. package/templates/skills/vercel-react-best-practices/rules/js-flatmap-filter.md +60 -0
  128. package/templates/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
  129. package/templates/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
  130. package/templates/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
  131. package/templates/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
  132. package/templates/skills/vercel-react-best-practices/rules/js-request-idle-callback.md +105 -0
  133. package/templates/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
  134. package/templates/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
  135. package/templates/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
  136. package/templates/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  137. package/templates/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
  138. package/templates/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
  139. package/templates/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  140. package/templates/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  141. package/templates/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
  142. package/templates/skills/vercel-react-best-practices/rules/rendering-resource-hints.md +85 -0
  143. package/templates/skills/vercel-react-best-practices/rules/rendering-script-defer-async.md +68 -0
  144. package/templates/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
  145. package/templates/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
  146. package/templates/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
  147. package/templates/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
  148. package/templates/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
  149. package/templates/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
  150. package/templates/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
  151. package/templates/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  152. package/templates/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
  153. package/templates/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
  154. package/templates/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
  155. package/templates/skills/vercel-react-best-practices/rules/rerender-no-inline-components.md +82 -0
  156. package/templates/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
  157. package/templates/skills/vercel-react-best-practices/rules/rerender-split-combined-hooks.md +64 -0
  158. package/templates/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
  159. package/templates/skills/vercel-react-best-practices/rules/rerender-use-deferred-value.md +59 -0
  160. package/templates/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
  161. package/templates/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
  162. package/templates/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
  163. package/templates/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
  164. package/templates/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
  165. package/templates/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
  166. package/templates/skills/vercel-react-best-practices/rules/server-hoist-static-io.md +149 -0
  167. package/templates/skills/vercel-react-best-practices/rules/server-no-shared-module-state.md +50 -0
  168. package/templates/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
  169. package/templates/skills/vercel-react-best-practices/rules/server-parallel-nested-fetching.md +34 -0
  170. package/templates/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
  171. package/templates/skills/vercel-react-native-skills/AGENTS.md +2897 -0
  172. package/templates/skills/vercel-react-native-skills/ORIGEM.md +39 -0
  173. package/templates/skills/vercel-react-native-skills/README.md +165 -0
  174. package/templates/skills/vercel-react-native-skills/SKILL.md +121 -0
  175. package/templates/skills/vercel-react-native-skills/metadata.json +16 -0
  176. package/templates/skills/vercel-react-native-skills/rules/_sections.md +86 -0
  177. package/templates/skills/vercel-react-native-skills/rules/_template.md +28 -0
  178. package/templates/skills/vercel-react-native-skills/rules/animation-derived-value.md +53 -0
  179. package/templates/skills/vercel-react-native-skills/rules/animation-gesture-detector-press.md +95 -0
  180. package/templates/skills/vercel-react-native-skills/rules/animation-gpu-properties.md +65 -0
  181. package/templates/skills/vercel-react-native-skills/rules/design-system-compound-components.md +66 -0
  182. package/templates/skills/vercel-react-native-skills/rules/fonts-config-plugin.md +71 -0
  183. package/templates/skills/vercel-react-native-skills/rules/imports-design-system-folder.md +68 -0
  184. package/templates/skills/vercel-react-native-skills/rules/js-hoist-intl.md +61 -0
  185. package/templates/skills/vercel-react-native-skills/rules/list-performance-callbacks.md +44 -0
  186. package/templates/skills/vercel-react-native-skills/rules/list-performance-function-references.md +132 -0
  187. package/templates/skills/vercel-react-native-skills/rules/list-performance-images.md +53 -0
  188. package/templates/skills/vercel-react-native-skills/rules/list-performance-inline-objects.md +97 -0
  189. package/templates/skills/vercel-react-native-skills/rules/list-performance-item-expensive.md +94 -0
  190. package/templates/skills/vercel-react-native-skills/rules/list-performance-item-memo.md +82 -0
  191. package/templates/skills/vercel-react-native-skills/rules/list-performance-item-types.md +104 -0
  192. package/templates/skills/vercel-react-native-skills/rules/list-performance-virtualize.md +67 -0
  193. package/templates/skills/vercel-react-native-skills/rules/monorepo-native-deps-in-app.md +46 -0
  194. package/templates/skills/vercel-react-native-skills/rules/monorepo-single-dependency-versions.md +63 -0
  195. package/templates/skills/vercel-react-native-skills/rules/navigation-native-navigators.md +188 -0
  196. package/templates/skills/vercel-react-native-skills/rules/react-compiler-destructure-functions.md +50 -0
  197. package/templates/skills/vercel-react-native-skills/rules/react-compiler-reanimated-shared-values.md +48 -0
  198. package/templates/skills/vercel-react-native-skills/rules/react-state-dispatcher.md +91 -0
  199. package/templates/skills/vercel-react-native-skills/rules/react-state-fallback.md +56 -0
  200. package/templates/skills/vercel-react-native-skills/rules/react-state-minimize.md +65 -0
  201. package/templates/skills/vercel-react-native-skills/rules/rendering-no-falsy-and.md +74 -0
  202. package/templates/skills/vercel-react-native-skills/rules/rendering-text-in-text-component.md +36 -0
  203. package/templates/skills/vercel-react-native-skills/rules/scroll-position-no-state.md +82 -0
  204. package/templates/skills/vercel-react-native-skills/rules/state-ground-truth.md +80 -0
  205. package/templates/skills/vercel-react-native-skills/rules/ui-expo-image.md +66 -0
  206. package/templates/skills/vercel-react-native-skills/rules/ui-image-gallery.md +104 -0
  207. package/templates/skills/vercel-react-native-skills/rules/ui-measure-views.md +78 -0
  208. package/templates/skills/vercel-react-native-skills/rules/ui-menus.md +174 -0
  209. package/templates/skills/vercel-react-native-skills/rules/ui-native-modals.md +77 -0
  210. package/templates/skills/vercel-react-native-skills/rules/ui-pressable.md +61 -0
  211. package/templates/skills/vercel-react-native-skills/rules/ui-safe-area-scroll.md +65 -0
  212. package/templates/skills/vercel-react-native-skills/rules/ui-scrollview-content-inset.md +45 -0
  213. package/templates/skills/vercel-react-native-skills/rules/ui-styling.md +87 -0
@@ -41,7 +41,22 @@ A senha nunca vai para os relatórios nem para o rastro.
41
41
  4. Sem caso concreto, não é achado: diga a ação na tela e o resultado errado que a pessoa vê ou deixa de conseguir.
42
42
  Quando o achado aponta código, leia quem chama o trecho apontado e o que ele chama.
43
43
 
44
- ## Passo 3 — Relatório técnico
44
+ ## Passo 3 — Conferir o código das telas
45
+
46
+ 1. Para cada tela visitada no Passo 2, localize no código-fonte da aplicação os componentes que a renderizam e
47
+ confira esse código contra `references/web-interface-guidelines.md`.
48
+ 2. Escopo das regras conforme a lente:
49
+ - `a11y`: só as seções `### Accessibility`, `### Focus States` e `### Forms`;
50
+ - `ux` ou `tudo`: todas as seções.
51
+ 3. Ignore o frontmatter e a linha "Review these files for compliance" do arquivo vendorizado: os alvos são as telas
52
+ visitadas, não arquivos passados como parâmetro.
53
+ 4. Registre cada achado com `arquivo:linha`, na mesma escala (**CRÍTICO**, **SÉRIO**, **MODERADO**, **MENOR**) e
54
+ com o mesmo rigor de caso concreto. Se a navegação já apontou o problema, acrescente o `arquivo:linha` ao achado
55
+ existente em vez de criar outro.
56
+ 5. Sem acesso ao código-fonte da aplicação, pule este passo e registre isso no **Não verificado**, dizendo quais
57
+ telas ficaram sem conferência de código.
58
+
59
+ ## Passo 4 — Relatório técnico
45
60
 
46
61
  Grave `docs/trabalhos/<id>/relatorios/TECNICO.md` a partir de `templates/relatorios/TECNICO.md`: achados agrupados
47
62
  por **tela** e **severidade**, cada um com o elemento afetado, o critério WCAG (quando houver) e a correção
@@ -53,7 +68,7 @@ caso concreto), **Correção** e **Se não corrigir**. Antes de citar um `arquiv
53
68
  trecho no estado atual. Feche com **Não verificado**: telas, lentes ou fluxos que não foram percorridos ou medidos,
54
69
  e por quê.
55
70
 
56
- ## Passo 4 — Relatório para a gestão
71
+ ## Passo 5 — Relatório para a gestão
57
72
 
58
73
  Grave `docs/trabalhos/<id>/relatorios/CLIENTE.md` a partir de `templates/relatorios/CLIENTE.md`: quais perfis de
59
74
  pessoas têm dificuldade, em quais tarefas, e as prioridades — **sem jargão técnico**.
@@ -66,7 +81,7 @@ npx @fontdata/ai-harness evento relatorio_gerado --trabalho <id> --nome auditar-
66
81
  npx @fontdata/ai-harness evento trabalho_concluido --trabalho <id> --nome auditar-ui
67
82
  ```
68
83
 
69
- ## Passo 5 — Próximos passos
84
+ ## Passo 6 — Próximos passos
70
85
 
71
86
  Correções aprovadas seguem por `/nova-tarefa` (conjunto de melhorias) ou `/resolver-bug` (tela que não funciona),
72
87
  citando o id desta auditoria.
@@ -0,0 +1,44 @@
1
+ # Atribuição
2
+
3
+ O arquivo `web-interface-guidelines.md` desta pasta é uma cópia sem alterações do `command.md` da raiz do
4
+ repositório **Web Interface Guidelines**, da Vercel Labs, disponível em
5
+ https://github.com/vercel-labs/web-interface-guidelines (commit `434b7f91364665f2f733b310ec54809bf8f37937`),
6
+ distribuído sob a licença MIT reproduzida abaixo.
7
+
8
+ | Origem | Destino |
9
+ |---|---|
10
+ | `command.md` | `web-interface-guidelines.md` |
11
+
12
+ ## Como atualizar
13
+
14
+ 1. Clone o repositório numa pasta nova e vazia e faça `git checkout` do commit desejado. Não execute nada do
15
+ conteúdo baixado (em especial o `install.sh`).
16
+ 2. Copie o `command.md` da raiz por cima de `web-interface-guidelines.md`, sem editar o conteúdo.
17
+ 3. Troque o commit deste arquivo pelo novo e confira se o `LICENSE` de origem mudou; se mudou, substitua o
18
+ texto da licença abaixo.
19
+ 4. Rode `npx vitest run tests/vendor-web-interface-guidelines.test.ts` e confirme que o `diff` entre a cópia e o
20
+ `command.md` do commit está vazio.
21
+
22
+ ---
23
+
24
+ MIT License
25
+
26
+ Copyright (c) 2025 Vercel Labs
27
+
28
+ Permission is hereby granted, free of charge, to any person obtaining a copy
29
+ of this software and associated documentation files (the "Software"), to deal
30
+ in the Software without restriction, including without limitation the rights
31
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
32
+ copies of the Software, and to permit persons to whom the Software is
33
+ furnished to do so, subject to the following conditions:
34
+
35
+ The above copyright notice and this permission notice shall be included in all
36
+ copies or substantial portions of the Software.
37
+
38
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
41
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
43
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44
+ SOFTWARE.
@@ -0,0 +1,191 @@
1
+ ---
2
+ description: Review UI code for Vercel Web Interface Guidelines compliance
3
+ argument-hint: <file-or-pattern>
4
+ ---
5
+
6
+ # Web Interface Guidelines
7
+
8
+ Review these files for compliance: $ARGUMENTS
9
+
10
+ Read files, check against rules below. Output concise but comprehensive—sacrifice grammar for brevity. High signal-to-noise.
11
+
12
+ ## Rules
13
+
14
+ ### Accessibility
15
+
16
+ - Icon-only buttons need `aria-label`
17
+ - Form controls need `<label>` or `aria-label`
18
+ - Interactive elements need keyboard handlers (`onKeyDown`/`onKeyUp`)
19
+ - `<button>` for actions, `<a>`/`<Link>` for navigation (not `<div onClick>`)
20
+ - Images need `alt` (or `alt=""` if decorative)
21
+ - Decorative icons need `aria-hidden="true"`
22
+ - Async updates (toasts, validation) need `aria-live="polite"`
23
+ - Use semantic HTML (`<button>`, `<a>`, `<label>`, `<table>`) before ARIA
24
+ - Headings hierarchical `<h1>`–`<h6>`; include skip link for main content
25
+ - `scroll-margin-top` on heading anchors
26
+ - Meaningful media needs captions, transcripts, or descriptions as applicable
27
+ - Media controls need keyboard support; decorative media needs assistive-tech hiding
28
+
29
+ ### Focus States
30
+
31
+ - Interactive elements need visible focus: `focus-visible:ring-*` or equivalent
32
+ - Never `outline-none` / `outline: none` without focus replacement
33
+ - Use `:focus-visible` over `:focus` (avoid focus ring on click)
34
+ - Group focus with `:focus-within` for compound controls
35
+ - Sticky headers/footers/overlays must not cover the focused element
36
+
37
+ ### Forms
38
+
39
+ - Inputs need `autocomplete` and meaningful `name`
40
+ - Use correct `type` (`email`, `tel`, `url`, `number`) and `inputmode`
41
+ - Never block paste (`onPaste` + `preventDefault`)
42
+ - Labels clickable (`htmlFor` or wrapping control)
43
+ - Disable spellcheck on emails, codes, usernames (`spellCheck={false}`)
44
+ - Checkboxes/radios: label + control share single hit target (no dead zones)
45
+ - Submit button stays enabled until request starts; spinner during request
46
+ - Errors inline next to fields; focus first error on submit
47
+ - Placeholders end with `…` and show example pattern
48
+ - `autocomplete="off"` on non-auth fields to avoid password manager triggers
49
+ - Warn before navigation with unsaved changes (`beforeunload` or router guard)
50
+
51
+ ### Animation
52
+
53
+ - Honor `prefers-reduced-motion` (provide reduced variant or disable)
54
+ - Animate `transform`/`opacity` only (compositor-friendly)
55
+ - Never `transition: all`—list properties explicitly
56
+ - Set correct `transform-origin`
57
+ - SVG: transforms on `<g>` wrapper with `transform-box: fill-box; transform-origin: center`
58
+ - Animations interruptible—respond to user input mid-animation
59
+ - Autoplay motion >5 seconds alongside other content needs pause, stop, or hide controls
60
+ - Muted decorative loops must stop under `prefers-reduced-motion`
61
+
62
+ ### Typography
63
+
64
+ - `…` not `...`
65
+ - Curly quotes `“` `”` not straight `"`
66
+ - Non-breaking spaces: `10&nbsp;MB`, `⌘&nbsp;K`, brand names
67
+ - Loading states end with `…`: `"Loading…"`, `"Saving…"`
68
+ - `font-variant-numeric: tabular-nums` for number columns/comparisons
69
+ - Use `text-wrap: balance` or `text-pretty` on headings (prevents widows)
70
+
71
+ ### Content Handling
72
+
73
+ - Text containers handle long content: `truncate`, `line-clamp-*`, or `break-words`
74
+ - Flex children need `min-w-0` to allow text truncation
75
+ - Handle empty states—don't render broken UI for empty strings/arrays
76
+ - User-generated content: anticipate short, average, and very long inputs
77
+
78
+ ### Images
79
+
80
+ - `<img>` needs explicit `width` and `height` (prevents CLS)
81
+ - Below-fold images: `loading="lazy"`
82
+ - Above-fold critical images: `priority` or `fetchpriority="high"`
83
+
84
+ ### Performance
85
+
86
+ - Large lists (>50 items): virtualize (`virtua`, `content-visibility: auto`)
87
+ - No layout reads in render (`getBoundingClientRect`, `offsetHeight`, `offsetWidth`, `scrollTop`)
88
+ - Batch DOM reads/writes; avoid interleaving
89
+ - Prefer uncontrolled inputs; controlled inputs must be cheap per keystroke
90
+ - Add `<link rel="preconnect">` for CDN/asset domains
91
+ - Critical fonts: `<link rel="preload" as="font">` with `font-display: swap`
92
+ - Prefer `<video autoplay muted loop playsinline>` over animated GIF; provide a still alternative
93
+ - Short non-essential loops: Safari H.264 MP4 `<picture>` source, `prefers-reduced-motion` media condition, and still fallback
94
+
95
+ ### Navigation & State
96
+
97
+ - URL reflects state—filters, tabs, pagination, expanded panels in query params
98
+ - Links use `<a>`/`<Link>` (Cmd/Ctrl+click, middle-click support)
99
+ - Deep-link all stateful UI (if uses `useState`, consider URL sync via nuqs or similar)
100
+ - Destructive actions need confirmation modal or undo window—never immediate
101
+
102
+ ### Touch & Interaction
103
+
104
+ - `touch-action: manipulation` (prevents double-tap zoom delay)
105
+ - `-webkit-tap-highlight-color` set intentionally
106
+ - `overscroll-behavior: contain` in modals/drawers/sheets
107
+ - Page rubber-band suppression: `overscroll-behavior: none` on `<html>` inside `@media (pointer: fine)`; keep coarse-pointer page defaults for pull-to-refresh. Test hybrid touch devices: `pointer` describes the primary input, and `none` also disables scroll chaining and native swipe navigation
108
+ - During drag: disable text selection, `inert` on dragged elements
109
+ - Drag/swipe/pinch/path gestures need tap/click and keyboard alternatives unless essential
110
+ - `autoFocus` sparingly—desktop only, single primary input; avoid on mobile
111
+
112
+ ### Safe Areas & Layout
113
+
114
+ - Full-bleed layouts need `env(safe-area-inset-*)` for notches
115
+ - Avoid unwanted scrollbars: `overflow-x-hidden` on containers, fix content overflow
116
+ - Flex/grid over JS measurement for layout
117
+
118
+ ### Dark Mode & Theming
119
+
120
+ - `color-scheme: dark` on `<html>` for dark themes (fixes scrollbar, inputs)
121
+ - `<meta name="theme-color">` matches page background
122
+ - Native `<select>`: explicit `background-color` and `color` (Windows dark mode)
123
+
124
+ ### Locale & i18n
125
+
126
+ - Dates/times: use `Intl.DateTimeFormat` not hardcoded formats
127
+ - Numbers/currency: use `Intl.NumberFormat` not hardcoded formats
128
+ - Detect language via `Accept-Language` / `navigator.languages`, not IP
129
+ - Brand names, code tokens, identifiers: wrap with `translate="no"` to prevent garbled auto-translation
130
+
131
+ ### Hydration Safety
132
+
133
+ - Inputs with `value` need `onChange` (or use `defaultValue` for uncontrolled)
134
+ - Date/time rendering: guard against hydration mismatch (server vs client)
135
+ - `suppressHydrationWarning` only where truly needed
136
+
137
+ ### Hover & Interactive States
138
+
139
+ - Buttons/links need `hover:` state (visual feedback)
140
+ - Interactive states increase contrast: hover/active/focus more prominent than rest
141
+
142
+ ### Content & Copy
143
+
144
+ - Active voice: "Install the CLI" not "The CLI will be installed"
145
+ - Title Case for headings/buttons (Chicago style)
146
+ - Numerals for counts: "8 deployments" not "eight"
147
+ - Specific button labels: "Save API Key" not "Continue"
148
+ - Error messages include fix/next step, not just problem
149
+ - Second person; avoid first person
150
+ - `&` over "and" where space-constrained
151
+
152
+ ### Anti-patterns (flag these)
153
+
154
+ - `user-scalable=no` or `maximum-scale=1` disabling zoom
155
+ - `onPaste` with `preventDefault`
156
+ - `transition: all`
157
+ - `outline-none` without focus-visible replacement
158
+ - Inline `onClick` navigation without `<a>`
159
+ - `<div>` or `<span>` with click handlers (should be `<button>`)
160
+ - Images without dimensions
161
+ - Large arrays `.map()` without virtualization
162
+ - Form inputs without labels
163
+ - Icon buttons without `aria-label`
164
+ - Hardcoded date/number formats (use `Intl.*`)
165
+ - `autoFocus` without clear justification
166
+ - Animated GIF when compressed video is suitable
167
+ - Gesture-only action without tap/click and keyboard alternative
168
+
169
+ ## Output Format
170
+
171
+ Group by file. Use `file:line` format (VS Code clickable). Terse findings.
172
+
173
+ ```text
174
+ ## src/Button.tsx
175
+
176
+ src/Button.tsx:42 - icon button missing aria-label
177
+ src/Button.tsx:18 - input lacks label
178
+ src/Button.tsx:55 - animation missing prefers-reduced-motion
179
+ src/Button.tsx:67 - transition: all → list properties
180
+
181
+ ## src/Modal.tsx
182
+
183
+ src/Modal.tsx:12 - missing overscroll-behavior: contain
184
+ src/Modal.tsx:34 - "..." → "…"
185
+
186
+ ## src/Card.tsx
187
+
188
+ ✓ pass
189
+ ```
190
+
191
+ State issue + location. Skip explanation unless fix non-obvious. No preamble.
@@ -6,7 +6,7 @@ Code e multi-agents. Dê um diagnóstico **honesto e acionável**. Na dúvida, e
6
6
  ## Contexto
7
7
 
8
8
  - **Ideia:** o que o usuário descreveu ao chamar o `/harness` ou nesta conversa.
9
- - **Janela de tempo:** se não foi informada, assuma **~4 horas** (formato imersão) e **diga que assumiu**.
9
+ - **Janela de tempo:** opcional. Se o usuário informou, compare a estimativa com ela; se não, não pergunte nem assuma um valor: estime o esforço e julgue o escopo pela primeira fatia vertical entregável.
10
10
  - **Modo de execução:** TDD obrigatório e sub-agents implementando módulos independentes em paralelo.
11
11
 
12
12
  Ideia ausente ou vaga demais: **pare e faça as perguntas mínimas**, uma por vez, antes de avaliar.
@@ -18,22 +18,23 @@ Para cada um, um veredito curto com a **evidência ou o risco concreto**, sem re
18
18
  1. **Decomposição em módulos** — 2 a 4 módulos que agents separados implementariam de forma **genuinamente
19
19
  independente** (não tocam os mesmos arquivos nem dependem um do outro para começar). Não dar para quebrar assim
20
20
  já é alerta sobre o escopo.
21
- 2. **Fatia vertical entregável** — o menor caminho ponta a ponta **funcionando** ao fim da janela, mesmo simples.
22
- Sem fatia demonstrável, o escopo está errado.
21
+ 2. **Fatia vertical entregável** — o menor caminho ponta a ponta **funcionando** ao fim da janela ou, sem ela, na primeira entrega,
22
+ mesmo simples. Sem fatia demonstrável, o escopo está errado.
23
23
  3. **Complexidade oculta** — autenticação de terceiros, pagamentos, uploads, tempo real, integrações externas,
24
24
  processamento pesado, mobile nativo, infra e deploy. Para cada uma presente, diga como **cortar, simular ou
25
25
  adiar**.
26
26
  4. **Stack** — está clara e é dominada? Se precisa ser decidida antes, sinalize como pré-requisito bloqueante.
27
27
  5. **Testabilidade (TDD)** — para pelo menos 2 módulos, os **testes críticos** (um de entrada válida e um de caso
28
28
  de erro) escritos antes do código. Se o comportamento essencial é difícil de testar, explique por quê.
29
- 6. **Estimativa realista** — esforço por módulo, soma e comparação com a janela, pessimista onde houver incerteza.
29
+ 6. **Estimativa realista** — esforço por módulo, soma e comparação com a janela quando informada, pessimista onde
30
+ houver incerteza.
30
31
 
31
32
  ## Veredito
32
33
 
33
34
  Feche com **um** dos três, justificado em até 3 linhas:
34
35
 
35
- - ✅ **APROVADO** — cabe na janela. Liste em 1 linha os módulos e a fatia vertical alvo e siga para a etapa
36
- contexto (`/sincronizar-claude-md`), após confirmação.
36
+ - ✅ **APROVADO** — cabe na janela informada ou, sem ela, numa primeira entrega com a fatia vertical. Liste em 1
37
+ linha os módulos e a fatia vertical alvo e siga para a etapa contexto (`/sincronizar-claude-md`), após confirmação.
37
38
  - ✂️ **AJUSTAR** — boa ideia, grande demais. **Reescreva a ideia recortada em 2 a 3 frases**, preservando a
38
39
  essência, pronta para virar SPEC. Diga o que ficou de fora (backlog).
39
40
  - ❌ **REPROVAR** — inviável mesmo recortada. Explique o porquê e **proponha uma alternativa no mesmo domínio**
@@ -0,0 +1,83 @@
1
+ # AI, LLM, and Agent Hunting
2
+
3
+ #### When to use this file
4
+
5
+ Reach for this file when a language model participates in a trust-sensitive decision: chatbots and assistants, RAG pipelines, persistent agent memory, agent/tool-calling loops, MCP servers and clients, code that builds prompts from untrusted input, or code that consumes model output and acts on it. The important data flow is *untrusted content → model or memory → capability, authority, or sink*.
6
+
7
+ Use this alongside `ATTACK-CLASSES.md`, not instead of it. Transport, access control, query construction, filesystem use, and output rendering remain ordinary trust boundaries. This file covers the model-specific delegation layer. Split large targets by retrieval, memory, tool dispatch, MCP, and output handling.
8
+
9
+ ## Core discipline (include in every agent prompt for this domain)
10
+
11
+ ```
12
+ - Prompt injection alone is not a finding. Require a code-level boundary failure: content reaches another principal's context, invokes authority the requester lacks, discloses data they cannot read, or drives a sink they cannot reach directly.
13
+ - Model output, memory, tool descriptions, and MCP responses are untrusted inputs. Point to the code that grants authority, trusts output, writes durable state, or feeds a sink.
14
+ - A guardrail prompt is not a security boundary. Count only deterministic checks, resource-scoped authorization, isolation, binding, and constrained credentials.
15
+ - State the attacker, affected principal, effective execution identity, resource, exact action, authority used, and observable impact. An intentional direct request to use the requester's existing authority is not a delegation defect merely because a model executes it.
16
+ - Authorization and action binding are separate controls. Attacker-controlled content that causes an action under an affected principal's valid authority is an action-binding failure when that principal did not intentionally request or approve the exact action.
17
+ - Classify every candidate as `confirmed` only after source evidence and bounded local validation establish the boundary and result. Use `needs_validation` when a required provider, deployment, model, renderer, or identity behavior is not observable locally.
18
+ ```
19
+
20
+ ## Context, retrieval, and memory attack classes (subagent_type: `general`)
21
+
22
+ **Indirect injection through retrieved or ingested content**
23
+ An attacker can write a RAG document, indexed page, file, email, issue body, tool response, or metadata that enters a different principal's model context. Trace who can write each source, how retrieval scopes it, whose session consumes it, and what capability is enabled there. Check isolation, resource authorization, and binding to the consuming principal's intent separately. The defect is a missing deterministic control, not persuasive text by itself.
24
+
25
+ **Cross-session or cross-tenant context bleed**
26
+ Conversation history, embeddings, retrieval results, or prompt caches are keyed too broadly. Verify tenant and ACL filters in the query itself and every cache key. A tenant field stored on an object is not enforcement if an alternate query, shared cache, or batch path omits it.
27
+
28
+ **Persistent memory poisoning**
29
+ Attacker-controlled content or model summaries are written into memory that later shapes another task, user, or privileged session. Review who may create, update, merge, and delete memory; its provenance and tenant scope; whether low-trust observations become durable instructions or facts; and whether retrieval distinguishes user preferences from tool policy. Memory intentionally saved by a user and used only for that user's intentional, allowed requests is not a cross-boundary finding.
30
+
31
+ **Prompt role and provenance confusion**
32
+ Prompt assembly lets untrusted text impersonate a system message, prior turn, tool result, policy, or memory record. Look for string concatenation, untyped history, caller-controlled role fields, and serialization round trips that lose source labels. Confirm that the forged provenance changes a deterministic trust decision or reaches a meaningful capability.
33
+
34
+ ## Tool and action attack classes (subagent_type: `general`)
35
+
36
+ **Tool-argument injection into a downstream sink**
37
+ Model-produced arguments reach SQL, shell, file, URL-fetch, or privileged APIs without handler-side validation. Treat the tool schema as input parsing, then follow each field from decoded call to sink. Structured output narrows shape; it does not establish authorization, safe paths, safe URLs, or query semantics.
38
+
39
+ **Excessive agency and confused-deputy authority**
40
+ The agent uses a service identity or broad credential, while the tool handler does not re-check the requesting principal's permission on the named resource. Verify both the effective identity and whether the caller could perform that exact operation through the normal product interface. A shared credential with enforced per-user query scope is not a defect.
41
+
42
+ **Action-confirmation and approval binding**
43
+ A user approves one described action but execution can use changed arguments, a different resource, a different principal, or a later model turn. An action-binding defect also exists when attacker-controlled content causes a side effect under a victim's valid authority without the victim's intentional request or approval, even if generic authorization permits the victim to perform it. Review whether intent or confirmation binds the normalized tool name, complete argument object, requester, target, amount, expiry, and batch membership. Check retries and resumed sessions: an approval must not authorize a mutated or duplicate side effect.
44
+
45
+ **Tool-schema and dispatcher disagreement**
46
+ The schema accepts aliases, extra fields, duplicate keys, coercions, nested free-form objects, or out-of-range values that the dispatcher or handler interprets differently. Compare schema validation, canonicalization, generated bindings, and handler defaults. Validate again where values become resource selectors or security-relevant options.
47
+
48
+ **Unbounded delegated action loops**
49
+ A bounded request can enqueue repeated spend, send, mutation, or external API work without a per-request budget, per-action authorization, cancellation, or idempotency control. Confirm impact on shared cost, quotas, other users, or durable state. Do not test by exhausting a service; use code-level accounting and a locally bounded loop.
50
+
51
+ ## MCP and sub-agent trust classes (subagent_type: `general`)
52
+
53
+ **Sub-agent and MCP trust inheritance**
54
+ A delegated task receives the full session, credentials, memory, or capabilities rather than the least authority required. Check the principal and tenant carried into each call, capability narrowing, credential audience, and whether delegated results are treated as untrusted on return.
55
+
56
+ **MCP server and tool identity confusion**
57
+ Calls or results are routed by attacker-influenceable server names, tool names, request IDs, resource URIs, or model-selected aliases rather than the authenticated connection and outstanding request. Check whether two servers can claim the same tool or resource identity, whether reconnect changes the binding, and whether a response from one server can satisfy another server's pending call.
58
+
59
+ **MCP metadata and schema as policy**
60
+ Tool descriptions, resource metadata, prompts, completion hints, or schemas supplied by an MCP peer are trusted as policy or authorization. These fields can guide the model but cannot grant capability. Find the deterministic allowlist, server identity check, and handler authorization that remain authoritative when metadata conflicts.
61
+
62
+ ## Output and disclosure attack classes (subagent_type: `general`)
63
+
64
+ **Insecure output rendering**
65
+ Model output reaches an executing HTML, Markdown, template, URL, or command sink without the sink's required encoding and policy. For browser rendering, verify auto-loaded resources and CSP or sanitization in `CLIENT-SIDE.md`; renderer behavior outside the repository makes the candidate `needs_validation`.
66
+
67
+ **Sensitive context extraction**
68
+ The assembled context contains credentials, another user's data, private source, or policy values that themselves grant access, and user-influenced output exposes them. Read prompt assembly and data-fetch code. Disclosure of generic instructions or behavior that does not cross a data boundary is not a finding.
69
+
70
+ ## Universal moves (apply across the above)
71
+
72
+ - Draw four maps first: each execution identity, each capability, every writable context or memory source, and each output destination. Then connect the principal at the start to the authority at the end.
73
+ - Start at side-effecting tools and work backward through dispatcher, schema, confirmation, model context, retrieval, and ingestion. Start at durable memory reads and trace every writer.
74
+ - Compare direct, queued, retry, resume, batch, and delegated paths for the same action. The strongest gate must apply after arguments are final and before every side effect.
75
+
76
+ ## Validation rules (apply before reporting ANY finding here)
77
+
78
+ 1. Name the crossed boundary and observable result: attacker, affected principal or shared resource, execution identity, target, and unauthorized or unrequested action or disclosure.
79
+ 2. For confused-deputy authority claims, prove the tool lacks requester-and-resource authorization and that the attacker cannot perform the same action normally. For action-binding claims, instead prove attacker-controlled content caused an action under the affected principal's authority that the principal did not intentionally request or approve. Valid generic authorization does not establish that intent.
80
+ 3. For memory or retrieval claims, cite both the attacker-controlled write and the later cross-principal read or privileged decision. A shared record without a reachable consumer is not enough.
81
+ 4. For action binding, establish the intentional request or normalized approved object, if any, and compare it with the object the handler uses. Confirm a locally observable unrequested action, mutation, duplicate, or authority change without extending the test into harmful execution. For schema disagreement, compare the normalized validated object with the handler's object.
82
+ 5. For MCP identity claims, verify the authenticated connection, request correlation, tool namespace, and effective credential. Mark `needs_validation` if external server identity or deployment routing is required.
83
+ 6. Return `confirmed` findings only with a complete source trace and meaningful result. Return `needs_validation` for a specific unresolved boundary fact and state the bounded local or owner-observed check needed to resolve it.
@@ -0,0 +1,130 @@
1
+ # Attack Classes
2
+
3
+ #### Attack classes — choose and split based on Phase 1
4
+
5
+ Select attack classes relevant to the application type. Not every class applies to every codebase. The list below is a starting point; add application-specific classes from Phase 1 and split large codebases per subsystem. Frame work as finding, validating, fixing, and prioritizing vulnerabilities. Keep validation to source review and bounded local fixtures; do not develop payload chains, test availability on live services, or take action in shared environments.
6
+
7
+ Use `confirmed` only when source evidence and bounded validation establish the full boundary and meaningful result. Use `needs_validation` when a specific deployment, provider, platform, identity, or runtime fact is unavailable; state the missing fact and the safe owner-observed or local check that resolves it.
8
+
9
+ > **Native / binary / kernel targets** (C/C++/Rust-unsafe, kernel modules, parsers and decoders, FFI, concurrent runtimes, binary loaders, JITs, firmware): use the memory-safety, integer/ABI, concurrency, binary-loader, and privileged-interface classes in [MEMORY-SAFETY-AND-BINARY.md](MEMORY-SAFETY-AND-BINARY.md).
10
+ >
11
+ > **AI / LLM / agent targets** (chatbots, RAG, persistent memory, tool-calling agents, MCP servers/clients, prompt assembly, or model-controlled actions): use the context, memory-poisoning, action-binding, tool-schema, MCP-identity, and output classes in [AI-AND-LLM.md](AI-AND-LLM.md).
12
+ >
13
+ > **HTTP, web, and identity targets** (ordinary web apps, APIs, reverse proxies, CDNs, gateways, custom HTTP parsers, sessions, CSRF, JWT, OAuth/OIDC, SAML, MFA, passkeys, account recovery/linking, API keys, or mTLS): use [WEB-PROTOCOL-AND-AUTH.md](WEB-PROTOCOL-AND-AUTH.md).
14
+ >
15
+ > **Client-side and browser targets** (SPAs, browser extensions, embedded webviews, service workers, browser storage, cross-window messaging, CORS, WebSockets, or DOM rendering): use [CLIENT-SIDE.md](CLIENT-SIDE.md).
16
+ >
17
+ > **Supply-chain and release targets** (dependency resolution, generated inputs, CI, release/signing/promotion, updates, plugins, or extensions): use [SUPPLY-CHAIN-AND-RELEASE.md](SUPPLY-CHAIN-AND-RELEASE.md).
18
+ >
19
+ > **Cloud and deployment targets** (IAM, infrastructure as code, containers/Kubernetes, service mesh, serverless/edge, ingress, provider events, or runtime configuration): use [CLOUD-AND-DEPLOYMENT.md](CLOUD-AND-DEPLOYMENT.md).
20
+ >
21
+ > **Protocol, RPC, and messaging targets** (gRPC, GraphQL transports, Protobuf/Cap'n Proto/Thrift, custom protocols, queues, brokers, pub/sub, webhooks, or streaming RPC): use [PROTOCOLS-RPC-AND-MESSAGING.md](PROTOCOLS-RPC-AND-MESSAGING.md).
22
+ >
23
+ > **Resource-exhaustion and availability targets** (untrusted work can consume shared CPU, memory, disk, connections, workers, queues, quotas, or operator-owned spend): use [RESOURCE-EXHAUSTION-AND-AVAILABILITY.md](RESOURCE-EXHAUSTION-AND-AVAILABILITY.md).
24
+ >
25
+ > **Data-isolation and lifecycle targets** (multi-tenant stores, caches/search, object links, analytics, export/backup, migration, deletion, retention, or restore): use [DATA-ISOLATION-AND-LIFECYCLE.md](DATA-ISOLATION-AND-LIFECYCLE.md).
26
+ >
27
+ > **Desktop, mobile, and local-IPC targets** (native apps, deep links, webview bridges, exported components, privileged helpers, local daemons, Unix sockets/XPC/Binder/D-Bus): use [DESKTOP-MOBILE-AND-LOCAL-IPC.md](DESKTOP-MOBILE-AND-LOCAL-IPC.md).
28
+
29
+ **Injection** (subagent_type: `general`)
30
+ Trace untrusted input from entry point to dangerous sink. What counts as a "dangerous sink" depends on the application:
31
+ - Web apps: SQL queries, HTML output, shell commands, template engines, file paths, HTTP redirects, deserialization
32
+ - Libraries: any function that processes caller-supplied data without validation — buffer operations, parsers, format strings
33
+ - CLI tools: shell command construction, file path handling, environment variable interpolation
34
+ - Services: query construction, message serialization, log injection, LDAP/XPATH queries
35
+ - Client-side (browser/JS): DOM XSS, prototype pollution, `postMessage`/origin trust, and other browser-side classes — covered by the [CLIENT-SIDE.md](CLIENT-SIDE.md) companion blocks when selected
36
+
37
+ Do not stop at the obvious direct paths. Look for indirect injection: data stored safely, then retrieved and used in a dangerous context by different code. Look for injection through field names, keys, headers, and metadata — not just values. Look for injection into secondary systems (logs, caches, search indexes, analytics).
38
+
39
+ **Access control** (subagent_type: `general`)
40
+ Verify that a caller cannot do something outside its authority. Go beyond checking whether permission checks exist — verify they check the *right* permission for the *right* resource via the *right* mechanism:
41
+ - Is there a path to the same state change that checks a different (weaker) permission?
42
+ - Can a field in the request body override what the permission system intended to restrict?
43
+ - Are there endpoints that gate on authentication but forget authorization?
44
+ - Does the same resource have multiple access paths with inconsistent checks?
45
+ - What about bulk/batch/export/import operations — do they enforce per-item permissions?
46
+
47
+ For complex access models, split into separate agents for auth bypass vs authorization logic.
48
+
49
+ **Resource and file handling** (subagent_type: `general`)
50
+ - Path traversal (reading/writing outside intended directories) — including through symlinks, encoded sequences, and null bytes
51
+ - SSRF (making the application fetch attacker-controlled URLs) — including through redirects, DNS rebinding, and URL parser differentials
52
+ - Unsafe deserialization, archive extraction (zip slip), temp file handling
53
+ - Memory safety (if applicable): buffer overflows, use-after-free, integer overflow
54
+ - Race conditions on file operations (TOCTOU between check and use)
55
+
56
+ **Cryptography and secrets** (subagent_type: `general`)
57
+ - Weak randomness for security-critical values (tokens, keys, nonces)
58
+ - Hardcoded secrets, secrets in logs, error messages, URLs, or client-visible responses
59
+ - Broken key derivation, missing HMAC verification, nonce reuse
60
+ - Timing side-channels on secret comparison
61
+ - Misuse of crypto primitives (ECB mode, unauthenticated encryption, static IVs, etc.)
62
+ - What happens when crypto operations fail? Does the error path fall back to no-crypto?
63
+
64
+ **Business logic** (subagent_type: `general`)
65
+ Hunt logic errors by hand: standard scanners cannot find them, and they yield high-impact findings. For each major workflow:
66
+ - **State machine violations**: Can you skip steps? Go backwards? Reach an invalid state? What happens if you replay a completed flow? What about partial failure — if step 2 of 3 fails, is step 1 rolled back?
67
+ - **Race conditions with business impact**: Concurrent operations that produce invalid states (double-spend, double-approve, lost updates). Focus on operations that check-then-act non-atomically.
68
+ - **Numeric/quantity manipulation**: Negative values, zero values, overflow, precision loss, type coercion between string and number.
69
+ - **Access boundary violations**: Not "does the permission check exist" but "is it the right check for the business rule?" Can input to one operation bypass a restriction enforced on a different operation for the same effect?
70
+ - **Implicit trust assumptions**: Data from storage, config, other components, or plugins assumed safe because "we validated it on the way in." What if a different code path wrote it?
71
+ - **Time-based logic**: Expiry checks, scheduling, rate windows, clock skew. What happens at exact boundary moments? What about timezone differences between components?
72
+ - **Default and fallback behavior**: What is the security posture when config is missing? When a feature flag is off? When a dependency is unavailable? When the system is mid-migration?
73
+
74
+ **Feature abuse and data leakage** (subagent_type: `general`)
75
+ Legitimate features used for unintended purposes. Look for bugs in the design, not only in the code:
76
+ - **Export/backup as exfiltration**: Can a low-privilege user trigger an export, snapshot, or backup that includes data above their access level? Can they export other users' data? Does the export include deleted/draft/private content? Revision history that was supposed to be pruned?
77
+ - **Import/restore as injection**: Can import overwrite existing data? Can it create records that bypass normal validation? Can it inject content into collections the user has no write access to? Does it respect the same permission model as the UI?
78
+ - **Search/filter/sort as oracle**: Can search queries reveal whether content exists that the user cannot directly access? Do filter parameters let users probe statuses, roles, or fields they should not know about? Does sorting by a hidden field reveal its values through result ordering?
79
+ - **Enumeration through side effects**: Do error messages differ between "does not exist" and "no access"? Do response times differ? Response sizes? HTTP status codes? Can you enumerate users through password reset, invite, or registration flows?
80
+ - **Preview/draft/staging leakage**: Are preview tokens scoped to one item or do they unlock broader access? Can draft content be discovered through search, RSS feeds, sitemaps, or API listing endpoints? Can cache headers cause a CDN to serve private content publicly?
81
+ - **Notification/webhook as SSRF**: Can a user set a notification URL, webhook URL, or callback URL that the server fetches? Is it validated against internal networks? What about after a redirect?
82
+
83
+ **Chained vulnerabilities and trust boundaries** (subagent_type: `general`)
84
+ Individually allowed or contained behavior can become a vulnerability when another component or lifecycle step relies on a stronger guarantee:
85
+ - **Multi-step boundary failures**: Map what a low-privilege principal may read, write, invoke, and retain, then connect only concrete outputs to later trust decisions. Confirm each prerequisite and do not assume a downstream effect.
86
+ - **Cross-component trust gaps**: Component A validates input and passes it to component B. Compare the exact guarantee A produces with what B assumes, including truncation, type coercion, normalization, tenant scope, and plugin/extension access.
87
+ - **Second-order use**: Data safe when stored may become dangerous in a later context. A field name becomes a JSON path, a slug becomes a file path, escaped text enters raw rendering, or a stored string becomes a URL, regex, template, or policy expression.
88
+ - **Scope and capability growth**: Token, API-key, plugin, OAuth, MCP, or AI capabilities become broader after delegation, refresh, caching, role change, or composition. Name the concrete operation the resulting principal should not have.
89
+ - **Timing and ordering**: Review setup, migration, soft-delete, revoke/cache expiry, check/use, and validate/consume windows. Confirm stale state is accepted before reporting.
90
+ - **Rollback and recovery**: Undelete, restore, revision rollback, and cancellation must apply current ownership, validation, and authorization. Confirm which invalid state is restored.
91
+
92
+ **Wildcard** (subagent_type: `general`)
93
+ You are not given a category. Find vulnerabilities outside the standard classes already assigned.
94
+
95
+ Read code that looks boring or disconnected from security. Follow incomplete, experimental, compatibility, and fallback features, but retain the same concrete boundary and validation requirements as every other class.
96
+
97
+ Use these starting points, but do not limit yourself to them:
98
+ - What is the strangest code in the codebase? Why does it exist? What happens if it is abused?
99
+ - Are there any features that feel half-finished, experimental, or bolted on? Those have the weakest security because they got the least review.
100
+ - What happens if you use the API in a way the frontend never would? The UI constrains users, but the API does not. What API calls are possible but never made by the client?
101
+ - Are there any hidden or undocumented endpoints, parameters, headers, or features? Look at route registrations, middleware, and config for things that are not in the docs.
102
+ - What happens when you mix features that were not designed to work together? Localization + preview + caching. Import + plugins + webhooks. OAuth + impersonation + API keys.
103
+ - Is there anything interesting in the git history? Reverted security fixes, commented-out auth checks, secrets that were committed then removed (still in history).
104
+ - Which valid-account actions affect other users, shared integrity, availability, or operator-owned cost? Verify containment, quotas, authorization, and recovery around those actions.
105
+ - Which operations are irreversible or require elevated confirmation? Bind authorization and approval to the final principal, action, and resource.
106
+ - What assumptions does the code make about the environment? That the database is local, that the clock is accurate, that DNS is trustworthy, that the filesystem is case-sensitive?
107
+ - Look at the test files — what are they **not** testing? Compare the edge cases the developer thought about (tests exist) with the ones they did not (no tests).
108
+
109
+ Pursue anomalies inside your assigned scope until the invariant is settled. If something looks strange, read it until you can state whether it is safe. If a function has a comment explaining why it is safe, verify the explanation. If a variable is named `temp` or `hack` or `legacy`, read it closely.
110
+
111
+ **Obvious things** (subagent_type: `general`)
112
+ Other agents hunt subtle bugs. This agent checks the basic exposures that are easy to overlook because everyone assumes someone else already checked them:
113
+ - Are there any hardcoded passwords, API keys, tokens, or secrets in the source? (grep for `password`, `secret`, `apikey`, `token`, `Bearer`, `-----BEGIN`, common default passwords)
114
+ - Are there any TODO/FIXME/HACK/XXX comments that reference security? (`TODO: add auth`, `FIXME: validate input`, `HACK: skip permission check`)
115
+ - Is debug mode / dev mode properly gated? Can it be enabled in production via environment variable, query parameter, or header?
116
+ - Are there test/example/seed credentials that work in production?
117
+ - Is there a `/debug`, `/admin`, `/test`, `/status`, `/health`, `/metrics`, `/env`, `/.env`, `/config` endpoint that is unprotected?
118
+ - Are there any `.env`, `.env.local`, `credentials.json`, `*.pem`, `*.key` files checked into the repo?
119
+ - Does the `.gitignore` actually cover secrets, uploads, and local config?
120
+ - Are dependencies pinned? Are there known CVEs in the dependency tree? (check lockfiles)
121
+ - Are there any `eval()`, `exec()`, `child_process`, `Function()`, `vm.runInContext`, `import()` with dynamic input?
122
+ - Are CORS headers set to `*` or overly permissive? Is `Access-Control-Allow-Credentials` combined with a wildcard origin?
123
+ - Are cookies missing `HttpOnly`, `Secure`, or `SameSite` attributes?
124
+ - Are there any open redirects? (parameters named `redirect`, `return`, `next`, `url`, `goto`, `continue` that feed into redirects without validation)
125
+ - Is TLS enforced? Are there any HTTP-only endpoints?
126
+ - Are error responses in production returning stack traces, internal paths, or SQL errors?
127
+
128
+ This agent does not need to be creative. It needs to be thorough and literal. Check every item. Report each result.
129
+
130
+ **Important**: For any finding this agent reports, it must verify the full code path, not just surface appearance. If a cookie is missing `HttpOnly`, check whether the cookie contains security-sensitive data and whether JS needs to read it by design. If an error message contains a field name, check whether the field is ever actually populated with sensitive data. A flag is not a finding — trace the impact before reporting.
@@ -0,0 +1,83 @@
1
+ # Client-Side and Browser Hunting
2
+
3
+ #### When to use this file
4
+
5
+ Reach for this file when meaningful trust decisions or untrusted rendering happen in a browser: single-page apps, browser extensions, embedded webviews, service workers, offline applications, and code that renders attacker-influenceable content into the DOM, receives cross-window messages, or uses browser storage. These paths include sources the server never sees, such as URL fragments, `window.name`, `postMessage`, and previously cached content.
6
+
7
+ Use alongside `ATTACK-CLASSES.md`. This file covers browser sources and sinks, origin boundaries, browser persistence, and cross-site state oracles. Use `DESKTOP-MOBILE-AND-LOCAL-IPC.md` for the native side of a webview bridge, and `WEB-PROTOCOL-AND-AUTH.md` for server-side CSRF, sessions, and auth callbacks.
8
+
9
+ ## Core discipline (include in every agent prompt for this domain)
10
+
11
+ ```
12
+ - A client-side candidate needs a controllable source and an executing or disclosing sink. Name both and show attacker-influenced data reaching the sink.
13
+ - The impact must reach a victim's session, another origin, or shared persistence. Self-injection and disclosure of the attacker's own data are not findings.
14
+ - Framework escaping, browser same-origin policy, CSP, COOP/CORP, service-worker scope, and modern noopener defaults are real controls. Verify them before assigning impact.
15
+ - Browser storage and caches are shared by origin and may outlive login state. Identify who writes, who reads, and which account, tenant, or worker lifecycle clears each record.
16
+ - Use `confirmed` only for complete source evidence plus bounded local browser tests. Use `needs_validation` when renderer, extension permission, deployed header, or browser-policy behavior is required but unavailable.
17
+ ```
18
+
19
+ ## DOM and object-state attack classes (subagent_type: `general`)
20
+
21
+ **DOM-based XSS**
22
+ Trace `location` fields, `document.referrer`, `window.name`, message data, storage, and browser-controlled document state into `innerHTML`, `outerHTML`, `document.write`, string-evaluating APIs, executable URLs, jQuery HTML APIs, or framework escape hatches. Interpolation escaped by the framework is not a finding.
23
+
24
+ **DOM clobbering**
25
+ Attacker-injected `id` or `name` attributes shadow a global, form property, configuration object, or initialization flag later trusted by code. Require both a markup path that preserves the attribute and a security-relevant use of the clobbered value.
26
+
27
+ **Prototype pollution and gadget chain**
28
+ An attacker-controlled key reaches a recursive write such as deep merge or path assignment and modifies prototype state. Then a reachable gadget consumes the polluted property to change authorization, execution, navigation, or rendering. `JSON.parse`, a shallow copy, or pollution without a gadget is not enough.
29
+
30
+ ## Cross-origin messaging and network attack classes (subagent_type: `general`)
31
+
32
+ **`postMessage` origin and source trust**
33
+ A handler performs a sensitive action with `event.data` without an exact origin allowlist and, where multiple frames share an origin, the expected `event.source`. On the send side, sensitive data sent to `*` reaches an unintended embedder. Weak substring, prefix, suffix, or unanchored-regex origin matching is not an origin check.
34
+
35
+ **Cross-site WebSocket request use**
36
+ A WebSocket upgrade accepts ambient cookies from an untrusted origin without an `Origin` check or channel-specific token, allowing the victim's session to read or mutate data. Confirm both the upgrade behavior and a security-relevant message handler.
37
+
38
+ **Credentialed CORS trust**
39
+ The server reflects or weakly matches `Origin` while allowing credentials and returns sensitive responses. A bare wildcard with credentials is rejected by browsers; report only the actual reflected/allowed origin path and cross-origin data or mutation.
40
+
41
+ ## Service-worker and browser-storage attack classes (subagent_type: `general`)
42
+
43
+ **Service-worker registration and scope takeover**
44
+ Attacker-influenceable content can become the registered worker script, control a path that receives an over-broad `Service-Worker-Allowed` scope, or alter update imports without integrity control. Verify the final script URL, response MIME type, origin, scope, and who controls every imported script. A normal same-origin worker with intended scope is not a defect.
45
+
46
+ **Service-worker cache and identity confusion**
47
+ The worker caches personalized responses without including account, tenant, authorization state, or request mode in its policy, then serves them after account switch or logout. Review fetch-event routing, cache names and keys, navigation fallbacks, cache cleanup, and whether error/offline paths return another user's prior response.
48
+
49
+ **Browser-storage disclosure and stale authorization**
50
+ Tokens, private responses, draft data, or authorization decisions remain in `localStorage`, `sessionStorage`, IndexedDB, Cache Storage, extension storage, or client state and become readable by another account or less-trusted same-origin component. Storage of a token alone is not a finding; require a realistic reader with less authority, or continued use after revocation/logout.
51
+
52
+ **Cross-context storage and broadcast confusion**
53
+ `storage` events, `BroadcastChannel`, shared workers, or origin-wide caches carry identity or commands between tabs without binding them to the current session. Check account switching, private/public windows, tenant changes, and stale tabs that can overwrite newer auth state.
54
+
55
+ ## Cross-site information leak classes (subagent_type: `general`)
56
+
57
+ **XS-Leaks and cross-origin state oracles**
58
+ An attacker page can distinguish protected cross-origin state through resource load/error events, frame or window state, redirect behavior, timing, cache state, or response size while the browser attaches victim credentials. Require one concrete secret-bearing predicate such as whether a private object, role, or account exists. Generic timing variance or public-resource availability is not a finding.
59
+
60
+ **Window and opener state disclosure**
61
+ A cross-origin window's permitted metadata or navigation result reveals protected state, or a retained opener/named-window relationship lets an attacker-controlled page influence a privileged navigation. Check COOP, frame protections, `noopener`, exact origin, and whether the observable state is confidential.
62
+
63
+ ## UI-redress and navigation attack classes (subagent_type: `general`)
64
+
65
+ **Clickjacking**
66
+ A framed, state-changing action lacks effective `frame-ancestors`, `X-Frame-Options`, or equivalent UI isolation. Require the sensitive action and confirm it can complete in the framed state; missing headers on read-only content are hardening notes.
67
+
68
+ **Client-side navigation confusion**
69
+ A client source controls redirect or navigation without scheme and destination policy, including executable `javascript:` or `data:` destinations. Reverse tabnabbing applies only where code explicitly keeps `window.opener`, uses `window.open` without isolation, or supports a browser without implicit `noopener`.
70
+
71
+ ## Universal moves (apply across the above)
72
+
73
+ - Start from DOM, navigation, worker, message, and storage sinks, then trace backward to browser-only and server-controlled sources. Record the browser policy that should stop the path.
74
+ - Test account switch, logout, worker update, offline fallback, and stale-tab state with a local test origin and dummy accounts. Do not use production users, origins, or shared services.
75
+ - For XS-Leaks, list only predicates proved by source and local browser behavior. Then identify the response headers or rendering choice that would remove the oracle.
76
+
77
+ ## Validation rules (apply before reporting ANY finding here)
78
+
79
+ 1. Cite the source, sink, browser policy, affected origin/session, and observable mutation or disclosure.
80
+ 2. For prototype pollution, prove the recursive write and a security-relevant gadget. For DOM clobbering, prove the markup survives and the shadowed value is used.
81
+ 3. For service workers and storage, prove lifecycle reachability: an attacker-controlled write or cache entry must reach a different account, tenant, or later authorization state.
82
+ 4. For messaging, CORS, WebSocket, and XS-Leaks, show exact origin/source validation and the protected state or action exposed. Confirm that CSP, COOP/CORP, cookies, and SameSite policy do not already block it.
83
+ 5. Return `confirmed` findings only with a complete client path and bounded local evidence. Return `needs_validation` with the precise deployed header, extension permission, browser version, or renderer behavior an owner must verify.