@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,849 @@
1
+ # Secrets Management Anti-Patterns
2
+
3
+ > **Domain:** Security
4
+ > **Severity:** Critical -- secrets mismanagement is the root cause of 22% of all data breaches (Verizon DBIR 2025).
5
+ > **Last updated:** 2026-03-08
6
+ > **Applies to:** All languages, frameworks, platforms, CI/CD pipelines, and cloud environments.
7
+
8
+ ---
9
+
10
+ ## Why This Matters
11
+
12
+ In 2024 alone, GitHub detected over 39 million leaked secrets across its repositories. Only 2.6%
13
+ of exposed secrets are revoked within the first hour, while 91.6% remain valid after five days.
14
+ The average credential breach costs organizations $4.88 million (IBM 2024). Every anti-pattern
15
+ in this module has been exploited in real-world breaches -- from Uber losing 57 million user
16
+ records to a single leaked API key compromising the U.S. Treasury Department.
17
+
18
+ ---
19
+
20
+ ## Anti-Patterns
21
+
22
+ ### AP-01: Hardcoded Credentials in Source Code
23
+
24
+ **What it looks like:**
25
+ ```python
26
+ # Embedded directly in application code
27
+ db_password = "super_secret_p@ssw0rd"
28
+ aws_access_key = "AKIAIOSFODNN7EXAMPLE"
29
+ api_key = "sk-proj-abc123def456ghi789"
30
+ ```
31
+
32
+ **Why it happens:** Developers hardcode credentials during prototyping and forget to remove them,
33
+ or believe that private repositories are safe enough.
34
+
35
+ **Why it is dangerous:** Source code is copied, forked, shared, backed up, and decompiled. A
36
+ single `git push` to a public repo exposes the secret to automated scanners that detect leaked
37
+ keys within minutes. Even in private repos, every developer with read access has every secret.
38
+
39
+ **Real-world incident:** In 2016, attackers found AWS access keys hardcoded in a private GitHub
40
+ repository belonging to an Uber engineer. They used the credentials to access an S3 bucket
41
+ containing data on 57 million users and 600,000 driver license numbers. Uber paid the attackers
42
+ $100,000 to delete the data, then concealed the breach for over a year. The eventual disclosure
43
+ led to a $148 million settlement with all 50 U.S. states, and former CSO Joe Sullivan was
44
+ convicted of obstruction of justice.
45
+
46
+ **Fix:** Use environment variables or a secrets manager (HashiCorp Vault, AWS Secrets Manager,
47
+ Doppler). Never pass secrets as constructor arguments or string literals. Run pre-commit hooks
48
+ with tools like `gitleaks` or `git-secrets` to block commits containing high-entropy strings or
49
+ known key patterns.
50
+
51
+ ---
52
+
53
+ ### AP-02: Committing .env Files to Version Control
54
+
55
+ **What it looks like:**
56
+ ```
57
+ # .env checked into the repo
58
+ DATABASE_URL=postgres://admin:password123@prod-db:5432/myapp
59
+ STRIPE_SECRET_KEY=sk_live_abcdef123456
60
+ SENDGRID_API_KEY=SG.xxxxxxxxxxxxxxxxxxxx
61
+ ```
62
+
63
+ **Why it happens:** Developers add `.env` for local development convenience and forget to
64
+ add it to `.gitignore` before the first commit, or the `.gitignore` entry is misspelled.
65
+
66
+ **Why it is dangerous:** `.env` files are designed to hold secrets. Once committed, the file
67
+ exists in git history forever (see AP-03). Even if removed in a subsequent commit, every clone
68
+ of the repository contains the full history.
69
+
70
+ **Real-world incident:** In 2024, attackers executed a large-scale extortion campaign by scanning
71
+ 26.8 million IP addresses for publicly exposed `.env` files. They harvested 1,185 AWS access
72
+ keys, 333 PayPal OAuth tokens, and 235 GitHub tokens from these files. The compromised AWS
73
+ infrastructure was used to encrypt S3 buckets for ransom.
74
+
75
+ **Fix:** Add `.env` to `.gitignore` before `git init`. Provide a `.env.example` with placeholder
76
+ values and no real secrets. Use a secrets manager for team-shared configuration. Run CI checks
77
+ that fail the build if `.env` is detected in the repository tree.
78
+
79
+ ---
80
+
81
+ ### AP-03: Secrets Persisting in Git History
82
+
83
+ **What it looks like:**
84
+ ```bash
85
+ # Developer realizes the mistake and removes the secret
86
+ git rm .env
87
+ git commit -m "Remove .env file"
88
+ # But the secret is still in the previous commit
89
+ git log --all --full-history -- .env # Shows the commit that added it
90
+ git show <commit-hash>:.env # Reveals the secret in full
91
+ ```
92
+
93
+ **Why it happens:** Developers assume that deleting a file or overwriting a value removes it.
94
+ Git is an append-only data structure by design -- every committed byte is preserved in history.
95
+
96
+ **Why it is dangerous:** Automated tools like TruffleHog and GitLeaks scan entire repository
97
+ histories, not just HEAD. Attackers know this. A secret that was "removed" three years ago is
98
+ just as exploitable as one committed today.
99
+
100
+ **Real-world incident:** Toyota's T-Connect access key was committed to a public GitHub
101
+ repository by a subcontractor in December 2017 and went undetected for nearly five years until
102
+ September 2022. Even though the code was eventually updated, the key remained in git history,
103
+ potentially compromising 296,019 customer records including email addresses and customer IDs.
104
+
105
+ **Fix:** If a secret is committed, treat it as compromised immediately. Rotate the secret first,
106
+ then clean history with `git filter-repo` or BFG Repo Cleaner. Force-push the cleaned history
107
+ and notify all collaborators to re-clone. Never rely on history rewriting alone -- the secret
108
+ may already be in forks, CI caches, or attacker databases.
109
+
110
+ ---
111
+
112
+ ### AP-04: Sharing Secrets via Slack, Email, or Chat
113
+
114
+ **What it looks like:**
115
+ ```
116
+ [Slack DM]
117
+ @alice: Hey, what's the prod database password?
118
+ @bob: It's Pr0d_DB_2024! Don't share it with anyone else.
119
+ ```
120
+
121
+ **Why it happens:** It is the path of least resistance. Developers need a credential now, and
122
+ messaging a colleague is faster than setting up a secrets manager.
123
+
124
+ **Why it is dangerous:** Chat messages are stored on third-party servers, indexed, searchable,
125
+ backed up, and retained for years in enterprise plans. A breach of the collaboration platform
126
+ exposes every secret ever shared. Slack's own 2024 breach involved leaked employee credentials
127
+ that granted attackers access to sensitive corporate data.
128
+
129
+ **Real-world incident:** GitGuardian research found that 6.1% of Jira tickets and 2.4% of
130
+ Slack channels in enterprise environments contain at least one valid secret. These secrets are
131
+ rarely rotated because teams forget they were shared this way. Slack messages from five years
132
+ ago still contain live production credentials.
133
+
134
+ **Fix:** Use a secrets manager with short-lived, scoped access tokens. If a secret must be
135
+ shared one-time, use a self-destructing link service (e.g., Vault's cubbyhole, 1Password
136
+ share links, or `onetimesecret.com`). Establish a policy: any secret shared in plaintext must
137
+ be rotated immediately.
138
+
139
+ ---
140
+
141
+ ### AP-05: Reusing the Same Secret Across Environments
142
+
143
+ **What it looks like:**
144
+ ```yaml
145
+ # config.yaml used in dev, staging, AND production
146
+ database:
147
+ host: "${DB_HOST}"
148
+ password: "the-same-password-everywhere"
149
+ stripe:
150
+ api_key: "sk_live_same_key_in_all_envs"
151
+ ```
152
+
153
+ **Why it happens:** Using one set of credentials is simpler to manage. Teams avoid the overhead
154
+ of provisioning environment-specific secrets.
155
+
156
+ **Why it is dangerous:** A compromise of the least-secured environment (typically development or
157
+ staging) immediately grants access to production. There is no blast radius containment. Exposed
158
+ secrets account for nearly 30% of all data breaches, and reuse across environments multiplies
159
+ the impact of every single leak.
160
+
161
+ **Real-world incident:** In 2023, New Relic disclosed unauthorized access to their staging
162
+ environment that allowed attackers to execute queries and exfiltrate customer data. The lateral
163
+ movement was possible because environment boundaries were insufficiently isolated.
164
+
165
+ **Fix:** Provision unique credentials per environment. Use naming conventions that make
166
+ environment obvious (`prod-db-readonly`, `staging-api-writer`). Configure secrets managers to
167
+ enforce environment scoping. Never allow dev/staging credentials to have any access to
168
+ production resources.
169
+
170
+ ---
171
+
172
+ ### AP-06: Never Rotating Secrets or Keys
173
+
174
+ **What it looks like:**
175
+ ```
176
+ # API key created 3 years ago, never changed
177
+ AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE # Created: 2023-01-15
178
+ AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG # Last rotated: never
179
+ ```
180
+
181
+ **Why it happens:** Rotation is disruptive. It requires coordinated updates across all services
182
+ that use the credential. Without automation, teams avoid it.
183
+
184
+ **Why it is dangerous:** The longer a secret lives, the larger the window for compromise. Industry
185
+ research shows the average lifespan of unrotated secrets exceeds 600 days, and 71% of
186
+ organizations fail to rotate secrets within recommended intervals. An attacker who obtains a
187
+ never-rotated key has indefinite access.
188
+
189
+ **Real-world incident:** In November 2023, Cloudflare's internal Atlassian server was breached
190
+ by suspected nation-state hackers. The attackers used an access token and three service account
191
+ credentials that were compromised in an earlier Okta breach but had not been rotated. Cloudflare
192
+ believed the credentials were not in active use. The oversight led to a 10-day intrusion.
193
+ Remediation required rotating all 5,000 production credentials, segmenting systems, and
194
+ rebooting every company system.
195
+
196
+ **Fix:** Implement automated rotation via your secrets manager (AWS Secrets Manager, Vault
197
+ dynamic secrets, Google Cloud Secret Manager). Set maximum credential lifetimes (90 days for
198
+ long-lived, 1 hour for dynamic). Alert on credentials that exceed their rotation window. Prefer
199
+ short-lived tokens (OAuth2, STS AssumeRole) over static keys.
200
+
201
+ ---
202
+
203
+ ### AP-07: Storing Secrets in Plaintext Configuration Files
204
+
205
+ **What it looks like:**
206
+ ```xml
207
+ <!-- application-config.xml deployed to every server -->
208
+ <database>
209
+ <username>admin</username>
210
+ <password>Welcome123!</password>
211
+ <connection-string>jdbc:mysql://prod-db:3306/app</connection-string>
212
+ </database>
213
+ ```
214
+
215
+ **Why it happens:** Configuration files are a natural place for settings. Developers extend
216
+ this pattern to secrets without realizing these files are copied to build artifacts, logged by
217
+ deployment tools, and backed up without encryption.
218
+
219
+ **Why it is dangerous:** Plaintext config files end up in Docker images (see AP-08), deployment
220
+ artifacts, CI caches, and backup archives. Anyone with filesystem access -- including lower-
221
+ privileged service accounts, container escape exploits, or backup restore access -- can read
222
+ every secret.
223
+
224
+ **Real-world incident:** The 2021 Twitch breach (125GB data leak) revealed that credentials,
225
+ API keys, and configuration secrets were stored in plaintext across thousands of internal Git
226
+ repositories. The server misconfiguration that exposed the data would have had far less impact
227
+ if secrets had been stored in a vault rather than plaintext files.
228
+
229
+ **Fix:** Store only references in config files (e.g., `password: ${vault:secret/db/password}`).
230
+ Inject secrets at runtime from a secrets manager. Encrypt configuration files at rest if they
231
+ must contain sensitive values. Never deploy config files containing production secrets to
232
+ source control or artifact repositories.
233
+
234
+ ---
235
+
236
+ ### AP-08: Secrets Baked into Docker Images and Layers
237
+
238
+ **What it looks like:**
239
+ ```dockerfile
240
+ # Secrets embedded in the image -- they persist in every layer
241
+ FROM node:18
242
+ ENV DATABASE_URL=postgres://admin:secret@db:5432/app
243
+ COPY .env /app/.env
244
+ RUN echo "API_KEY=sk-live-abc123" >> /app/config
245
+ # Even if you delete later, the layer with the secret still exists
246
+ RUN rm /app/.env
247
+ ```
248
+
249
+ **Why it happens:** Developers treat Dockerfiles like shell scripts, copying in `.env` files or
250
+ setting secrets as ENV directives. The layered filesystem architecture of Docker means that
251
+ every instruction creates a permanent, extractable layer.
252
+
253
+ **Why it is dangerous:** Docker images are pushed to registries (Docker Hub, ECR, GCR) and shared
254
+ across teams and environments. Any user with pull access can inspect every layer with
255
+ `docker history` or `docker save` and extract secrets that were "deleted" in later layers.
256
+
257
+ **Real-world incident:** In November 2025, security researchers at Flare discovered that 10,456
258
+ Docker Hub images exposed one or more secrets, including live API keys, cloud access tokens, and
259
+ CI/CD credentials. 42% of the affected images contained five or more secrets each. The exposure
260
+ impacted over 100 organizations, including a Fortune 500 company and a major national bank.
261
+ Nearly 4,000 AI model API keys were among the leaked credentials.
262
+
263
+ **Fix:** Never `COPY` `.env` files or set secrets via `ENV` in Dockerfiles. Use Docker BuildKit
264
+ secrets (`--mount=type=secret`) for build-time secrets. Inject runtime secrets via environment
265
+ variables from orchestrators (Kubernetes Secrets, ECS task definitions) or sidecar vault agents.
266
+ Use multi-stage builds to ensure build-time dependencies do not leak into the final image.
267
+
268
+ ---
269
+
270
+ ### AP-09: Secrets Exposed in CI/CD Logs
271
+
272
+ **What it looks like:**
273
+ ```yaml
274
+ # GitHub Actions workflow
275
+ steps:
276
+ - name: Deploy
277
+ run: |
278
+ echo "Deploying with key: ${{ secrets.API_KEY }}"
279
+ curl -H "Authorization: Bearer $API_KEY" https://api.example.com/deploy
280
+ # CI system masks known secrets, but string manipulation breaks masking
281
+ echo $API_KEY | base64 # Outputs the key in base64, unmasked
282
+ ```
283
+
284
+ **Why it happens:** Developers debug CI failures by printing environment variables. Build tools
285
+ echo commands that include interpolated secrets. CI masking is fragile -- encoding, splitting,
286
+ or transforming a secret defeats the mask.
287
+
288
+ **Why it is dangerous:** CI/CD logs are stored for weeks or months, often with broad read access.
289
+ Logs may be shipped to centralized logging systems (ELK, Datadog, Splunk) where retention
290
+ policies differ and access controls are more permissive.
291
+
292
+ **Real-world incident:** Travis CI exposed over 73,000 sensitive tokens -- including signing
293
+ keys, API credentials, and access tokens -- through public build logs. A flaw in the Travis CI
294
+ API exposed more than 700 million historical clear-text logs, impacting over 900,000 open-source
295
+ projects and 600,000 users. Separately, CircleCI's 2023 breach exposed customer environment
296
+ variables, keys, and tokens, forcing mass secret rotation across thousands of companies.
297
+
298
+ **Fix:** Never `echo`, `print`, or log secrets in CI pipelines. Use built-in secret masking and
299
+ verify it works by reviewing logs. Avoid piping secrets through transformations that break
300
+ masking. Prefer OIDC federation (GitHub Actions OIDC to AWS, GCP) over storing long-lived
301
+ credentials in CI. Set aggressive log retention policies and restrict log access.
302
+
303
+ ---
304
+
305
+ ### AP-10: API Keys Embedded in Frontend JavaScript
306
+
307
+ **What it looks like:**
308
+ ```javascript
309
+ // Bundled into client-side code, visible in browser DevTools
310
+ const STRIPE_KEY = "sk_live_abcdef123456";
311
+ const FIREBASE_CONFIG = {
312
+ apiKey: "AIzaSyD-secret-key-here",
313
+ authDomain: "myapp.firebaseapp.com",
314
+ };
315
+ fetch("https://api.openai.com/v1/chat/completions", {
316
+ headers: { "Authorization": `Bearer sk-proj-MY_OPENAI_KEY` }
317
+ });
318
+ ```
319
+
320
+ **Why it happens:** Frontend developers need to call APIs and embed keys directly in JavaScript
321
+ bundles. They confuse publishable keys (safe for client-side) with secret keys (server-only).
322
+
323
+ **Why it is dangerous:** Client-side JavaScript is fully visible to anyone who opens browser
324
+ DevTools, views page source, or intercepts network requests. Minification and obfuscation
325
+ provide zero security -- they are trivially reversed. An exposed secret key grants full API
326
+ access, potentially allowing data exfiltration, unauthorized charges, or account takeover.
327
+
328
+ **Real-world incident:** Security researchers discovered a Supabase API key hardcoded in
329
+ client-side JavaScript on the Moltbook platform. The key granted unauthenticated read and write
330
+ access to the entire production database, exposing 1.5 million API keys belonging to users. A
331
+ separate incident involved a Firebase API key hardcoded in frontend code that enabled full
332
+ database access, including user deletion capabilities.
333
+
334
+ **Fix:** Only expose publishable/restricted keys on the client side. Route all secret-key API
335
+ calls through a backend proxy or serverless function (AWS Lambda, Cloudflare Workers). Apply
336
+ domain restrictions and API key scoping where the provider supports it (e.g., Google Maps API
337
+ key restrictions). Never ship OpenAI, Stripe secret, or database keys to the browser.
338
+
339
+ ---
340
+
341
+ ### AP-11: Using Default Passwords in Production
342
+
343
+ **What it looks like:**
344
+ ```
345
+ # Default credentials left unchanged
346
+ admin / admin
347
+ root / root
348
+ sa / (blank)
349
+ postgres / postgres
350
+ admin / password
351
+ ```
352
+
353
+ **Why it happens:** Default credentials ship with databases, routers, IoT devices, and admin
354
+ panels. Teams deploy to production without changing them, assuming internal network placement
355
+ is sufficient protection.
356
+
357
+ **Why it is dangerous:** Default credentials are publicly documented. Automated scanners and
358
+ botnets attempt them continuously. A single default password on one device can cascade into a
359
+ full network compromise.
360
+
361
+ **Real-world incident:** In October 2016, the Mirai botnet compromised over 600,000 IoT devices
362
+ by scanning the internet for open Telnet ports and attempting only 61 default username/password
363
+ combinations. The resulting DDoS attack against DNS provider Dyn exceeded 1 Tbps and took down
364
+ GitHub, Twitter, Reddit, Netflix, Airbnb, and many other major services. The attack demonstrated
365
+ that factory-default credentials on commodity devices can threaten critical internet
366
+ infrastructure.
367
+
368
+ **Fix:** Change all default credentials before any system reaches a network. Use configuration
369
+ management to enforce unique, randomly generated passwords. Implement automated scanning for
370
+ default credentials as part of deployment checklists. For IoT, require unique per-device
371
+ credentials at manufacturing time.
372
+
373
+ ---
374
+
375
+ ### AP-12: Secrets in URL Parameters and Query Strings
376
+
377
+ **What it looks like:**
378
+ ```
379
+ https://api.example.com/data?api_key=sk_live_abc123&token=eyJhbGciOi...
380
+ https://app.example.com/reset-password?token=secret-reset-token-123
381
+ https://webhook.example.com/callback?secret=webhook_signing_key
382
+ ```
383
+
384
+ **Why it happens:** REST API conventions and quick integrations often pass tokens as query
385
+ parameters. OAuth redirect flows put tokens in URLs. Developers default to GET requests for
386
+ simplicity.
387
+
388
+ **Why it is dangerous:** URLs are logged everywhere: web server access logs, proxy logs, CDN
389
+ logs, browser history, browser bookmarks, analytics platforms, and the HTTP `Referer` header
390
+ sent to third-party domains when users click outbound links. OWASP classifies this as CWE-598
391
+ (Use of GET Request Method With Sensitive Query Strings).
392
+
393
+ **Fix:** Pass secrets in HTTP headers (`Authorization: Bearer <token>`) or POST request bodies.
394
+ Configure web servers to strip sensitive query parameters from access logs. Use short-lived,
395
+ single-use tokens for URL-based flows (e.g., password reset links). Never include persistent
396
+ API keys in URLs.
397
+
398
+ ---
399
+
400
+ ### AP-13: Operating Without a Secrets Manager
401
+
402
+ **What it looks like:**
403
+ ```bash
404
+ # "Secrets management" via a shared text file
405
+ cat ~/team-secrets.txt
406
+ # PROD_DB_PASS=hunter2
407
+ # STRIPE_KEY=sk_live_xxx
408
+ # AWS_KEY=AKIA...
409
+
410
+ # Or: secrets scattered across .env files, CI variables, sticky notes
411
+ ```
412
+
413
+ **Why it happens:** Teams start small and manage a handful of secrets manually. As the system
414
+ grows, the count increases to hundreds, but the process never evolves. The perceived overhead
415
+ of a secrets manager seems too high for "just a few keys."
416
+
417
+ **Why it is dangerous:** Without centralization, there is no audit trail, no rotation automation,
418
+ no access control, and no way to respond to a breach quickly. When a secret is compromised, the
419
+ team cannot answer: "Where is this secret used? Who has access? When was it last rotated?"
420
+
421
+ **Real-world incident:** The 2024 large-scale `.env` extortion campaign succeeded because
422
+ organizations stored production credentials in flat files on web servers with no centralized
423
+ management. Attackers simply scraped thousands of publicly accessible `.env` files containing
424
+ AWS keys, payment tokens, and GitHub credentials. Organizations with secrets managers were
425
+ able to rotate compromised credentials within minutes; those without spent days in triage.
426
+
427
+ **Fix:** Adopt a secrets manager appropriate to your scale: HashiCorp Vault, AWS Secrets
428
+ Manager, GCP Secret Manager, Azure Key Vault, Doppler, or 1Password Secrets Automation. Even
429
+ for small teams, managed services like Doppler or Infisical provide a low-overhead starting
430
+ point. Centralization is the prerequisite for rotation, auditing, and access control.
431
+
432
+ ---
433
+
434
+ ### AP-14: Overly Broad Secret Access (Everyone Has Prod Keys)
435
+
436
+ **What it looks like:**
437
+ ```
438
+ # Every developer, contractor, and CI pipeline uses the same root credentials
439
+ AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE # Full admin access
440
+ AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG # Shared across 40 engineers
441
+ ```
442
+
443
+ **Why it happens:** Principle of least privilege is hard. Creating scoped credentials for each
444
+ user and service requires upfront investment. It is faster to share one admin key.
445
+
446
+ **Why it is dangerous:** If any single developer's machine is compromised, the attacker gets
447
+ full production access. There is no way to attribute actions to individuals. Revoking access
448
+ for a departing employee means rotating a credential used by 40 people and every CI pipeline.
449
+
450
+ **Real-world incident:** Mercedes-Benz suffered a breach in September 2023 when researchers
451
+ discovered a GitHub token belonging to an employee in a public repository. The token granted
452
+ "unrestricted and unmonitored" access to the company's entire internal GitHub Enterprise Server,
453
+ exposing database connection strings, cloud access keys, blueprints, design documents, SSO
454
+ passwords, API keys, and other critical internal information.
455
+
456
+ **Fix:** Issue per-user and per-service credentials with minimum required permissions. Use
457
+ role-based access control (RBAC) through IAM policies, Vault policies, or Kubernetes RBAC.
458
+ Implement break-glass procedures for emergency admin access. Audit who accesses which secrets
459
+ and alert on anomalies. Automate credential provisioning for CI pipelines using OIDC federation.
460
+
461
+ ---
462
+
463
+ ### AP-15: Secrets Leaked in Error Messages and Stack Traces
464
+
465
+ **What it looks like:**
466
+ ```python
467
+ # Unhandled exception exposes connection string in stack trace
468
+ try:
469
+ conn = psycopg2.connect("postgresql://admin:S3cretP@ss@prod-db:5432/app")
470
+ except Exception as e:
471
+ logger.error(f"Database connection failed: {e}")
472
+ # Stack trace includes the full connection string with password
473
+ raise
474
+ ```
475
+
476
+ **Why it is dangerous:** Error messages, stack traces, and debug output are displayed to users
477
+ in development mode, shipped to logging platforms, and included in bug reports and issue
478
+ trackers. Research shows that 32.4% of secret leaks in issue trackers originate from bug
479
+ reports containing logs and stack traces.
480
+
481
+ **Real-world incidents:** Twitter, Facebook, and Google all had incidents where user passwords
482
+ were logged in plaintext due to application errors. Twitter logged unhashed passwords. Facebook
483
+ logged tens of millions of unhashed user passwords. Google logged unhashed GSuite passwords.
484
+ Ubuntu's server installer logged passwords during installation.
485
+
486
+ **Fix:** Never interpolate secrets into log messages or error strings. Use structured logging
487
+ that explicitly excludes sensitive fields. Sanitize connection strings before logging. Set
488
+ production applications to return generic error messages (HTTP 500) without stack traces.
489
+ Implement log scrubbing to detect and redact patterns matching known secret formats.
490
+
491
+ ---
492
+
493
+ ### AP-16: No Audit Trail for Secret Access
494
+
495
+ **What it looks like:**
496
+ ```
497
+ # Secrets stored in flat files or passed around without tracking
498
+ # No answers to:
499
+ # - Who accessed the production database password last Tuesday?
500
+ # - Was the AWS key used from an unusual IP address?
501
+ # - When was this secret last read, and by which service?
502
+ ```
503
+
504
+ **Why it happens:** Auditing requires infrastructure (centralized logging, SIEM integration) and
505
+ ongoing monitoring. Teams prioritize feature delivery and treat security logging as a
506
+ nice-to-have.
507
+
508
+ **Why it is dangerous:** Without audit logs, incident response is blind. You cannot determine
509
+ the blast radius of a compromise, who accessed what, or when unauthorized use began. Regulatory
510
+ frameworks (SOC 2, PCI-DSS, HIPAA) require demonstrable audit trails for credential access.
511
+
512
+ **Real-world incident:** In Uber's 2016 breach, the lack of audit trails around GitHub
513
+ repository access and AWS credential usage contributed to the company's inability to detect
514
+ the breach quickly. The intrusion went undetected for months, and the cover-up was possible in
515
+ part because monitoring and attribution were inadequate.
516
+
517
+ **Fix:** Use a secrets manager that provides native audit logging (Vault audit backend, AWS
518
+ CloudTrail for Secrets Manager). Log every secret read, write, and rotation event. Ship audit
519
+ logs to a SIEM with alerting on anomalous patterns (new IP, unusual time, bulk reads). Make
520
+ secret access logs immutable and separate from the systems they protect.
521
+
522
+ ---
523
+
524
+ ### AP-17: Secrets in Docker Compose and IaC Files Committed to Repos
525
+
526
+ **What it looks like:**
527
+ ```yaml
528
+ # docker-compose.yml committed to the repository
529
+ services:
530
+ db:
531
+ image: postgres:15
532
+ environment:
533
+ POSTGRES_PASSWORD: "production_password_123"
534
+ app:
535
+ environment:
536
+ DATABASE_URL: "postgres://admin:production_password_123@db:5432/myapp"
537
+ JWT_SECRET: "my-super-secret-jwt-signing-key"
538
+ ```
539
+
540
+ ```hcl
541
+ # terraform.tfvars committed to the repository
542
+ db_password = "terraform-managed-secret"
543
+ api_key = "sk-live-xxxxxxxxxxxxxxxx"
544
+ ```
545
+
546
+ **Why it happens:** Docker Compose and Terraform files are treated as "just configuration" and
547
+ committed alongside application code. Developers want reproducible environments and include
548
+ all necessary values.
549
+
550
+ **Why it is dangerous:** These files are committed to version control, cloned by every developer,
551
+ and often deployed without modification across environments. Terraform state files can contain
552
+ secrets in plaintext even when `.tfvars` is gitignored.
553
+
554
+ **Fix:** Use `docker compose` with external secret references (`${DB_PASSWORD}` from
555
+ environment or `.env` file excluded from git). For Terraform, use `terraform.tfvars` in
556
+ `.gitignore` and fetch secrets from a vault at plan/apply time. Encrypt Terraform state with
557
+ backend encryption (S3 + KMS, Terraform Cloud). Never hardcode secrets in IaC manifests.
558
+
559
+ ---
560
+
561
+ ### AP-18: Symmetric Encryption with Shared Keys
562
+
563
+ **What it looks like:**
564
+ ```python
565
+ # Same key used by every service, hardcoded or shared in config
566
+ ENCRYPTION_KEY = "ThisIsOurSharedEncryptionKey2024"
567
+
568
+ def encrypt(data):
569
+ return AES.encrypt(data, ENCRYPTION_KEY)
570
+
571
+ def decrypt(data):
572
+ return AES.decrypt(data, ENCRYPTION_KEY)
573
+ ```
574
+
575
+ **Why it happens:** Symmetric encryption is simpler to implement than asymmetric or envelope
576
+ encryption. A single shared key eliminates the complexity of key distribution.
577
+
578
+ **Why it is dangerous:** If the shared key is compromised, all data encrypted with it is
579
+ exposed -- past, present, and future. The key itself becomes a high-value secret that must be
580
+ managed with extreme care. Sharing the same key across services means every service is a
581
+ potential leak vector.
582
+
583
+ **Fix:** Use envelope encryption: encrypt data with a data encryption key (DEK), then encrypt
584
+ the DEK with a key encryption key (KEK) managed by a KMS (AWS KMS, Google Cloud KMS, Azure
585
+ Key Vault). Rotate DEKs frequently. Use asymmetric encryption for cross-service communication.
586
+ Never hardcode encryption keys -- load them from a KMS at runtime.
587
+
588
+ ---
589
+
590
+ ### AP-19: Storing Secrets in Browser localStorage
591
+
592
+ **What it looks like:**
593
+ ```javascript
594
+ // After login, store the token in localStorage
595
+ localStorage.setItem("auth_token", "eyJhbGciOiJIUzI1NiIs...");
596
+ localStorage.setItem("api_key", "sk-live-abc123");
597
+ localStorage.setItem("refresh_token", "rt_xxxxxxxxxxxx");
598
+ ```
599
+
600
+ **Why it happens:** localStorage is persistent, easy to use, and survives page refreshes. Many
601
+ tutorials and boilerplate projects store JWTs in localStorage by default.
602
+
603
+ **Why it is dangerous:** Any JavaScript running on the page can read localStorage -- including
604
+ injected scripts from XSS vulnerabilities, malicious browser extensions, and compromised
605
+ third-party scripts. A single XSS vulnerability enables immediate exfiltration of every stored
606
+ secret.
607
+
608
+ **Real-world incident:** The RustFS Console stored S3 administrative credentials (AccessKey,
609
+ SecretKey, SessionToken) in browser localStorage. A stored XSS vulnerability allowed attackers
610
+ to steal these credentials by injecting JavaScript that read localStorage and exfiltrated the
611
+ tokens to an attacker-controlled server.
612
+
613
+ **Fix:** Store authentication tokens in HttpOnly, Secure, SameSite cookies that are inaccessible
614
+ to JavaScript. If you must use localStorage (e.g., for a token needed by client-side API calls),
615
+ minimize token lifetime, use refresh token rotation, and implement robust XSS prevention (CSP
616
+ headers, input sanitization, subresource integrity).
617
+
618
+ ---
619
+
620
+ ### AP-20: Environment Variables Visible to Child Processes
621
+
622
+ **What it looks like:**
623
+ ```bash
624
+ # Parent process sets secrets as environment variables
625
+ export DATABASE_URL="postgres://admin:secret@db:5432/app"
626
+ export API_KEY="sk-live-xxxx"
627
+
628
+ # Every child process inherits the full environment
629
+ node server.js # Has DATABASE_URL, API_KEY
630
+ ./run-migrations.sh # Has DATABASE_URL, API_KEY
631
+ python analytics.py # Has DATABASE_URL, API_KEY -- but doesn't need them
632
+ ```
633
+
634
+ **Why it happens:** Environment variables are the twelve-factor app standard for configuration.
635
+ Setting them at the process level is simple, and inheritance to child processes is an operating
636
+ system default.
637
+
638
+ **Why it is dangerous:** Child processes, third-party scripts, crash reporters, and debug tools
639
+ inherit the full environment. A compromised or malicious dependency can read `process.env` and
640
+ exfiltrate secrets. Core dumps and `/proc/<pid>/environ` on Linux expose environment variables
641
+ to any user with read access to the process.
642
+
643
+ **Fix:** Pass only required secrets to each process. Use `env -i` to launch child processes
644
+ with a clean environment. Prefer secret injection at the application level (reading from a
645
+ vault client) over environment-level injection. On Kubernetes, use projected volumes or CSI
646
+ secret store drivers instead of environment variables. Restrict access to `/proc/*/environ`
647
+ via security contexts.
648
+
649
+ ---
650
+
651
+ ## Root Cause Analysis
652
+
653
+ Secrets management failures stem from a small number of recurring root causes:
654
+
655
+ ### 1. Convenience Over Security
656
+ Developers optimize for speed. Hardcoding a key takes 5 seconds; setting up a secrets manager
657
+ takes hours. Without organizational mandates and tooling that makes the secure path easy,
658
+ convenience wins every time.
659
+
660
+ ### 2. Invisible Attack Surface
661
+ Secrets in git history, Docker layers, CI logs, and browser storage are not visible during
662
+ normal development. The threat model fails because developers do not see these storage locations
663
+ as part of the attack surface.
664
+
665
+ ### 3. Absence of Automation
666
+ Manual rotation, manual access provisioning, and manual auditing do not scale. Humans forget.
667
+ Processes drift. Automation is the only way to maintain secrets hygiene at scale.
668
+
669
+ ### 4. Lack of Organizational Ownership
670
+ When no team owns secrets management, it becomes everyone's problem and no one's responsibility.
671
+ Secrets proliferate without governance, and the organization cannot answer basic questions:
672
+ "How many secrets do we have? Where are they? Who can access them?"
673
+
674
+ ### 5. Misconception About Private = Secure
675
+ Teams treat private repositories, internal networks, and staging environments as trusted zones.
676
+ A private repo with 50 collaborators has 50 potential leak vectors. "Private" does not mean
677
+ "secure."
678
+
679
+ ### 6. Fear of Rotation
680
+ Teams avoid rotation because it is disruptive and error-prone when done manually. This creates
681
+ a vicious cycle: the longer secrets live, the more systems depend on them, making rotation
682
+ progressively harder and riskier.
683
+
684
+ ---
685
+
686
+ ## Self-Check Questions
687
+
688
+ Use these questions during code review, architecture review, or security audit to identify
689
+ secrets anti-patterns:
690
+
691
+ ### Source Code and Version Control
692
+ - [ ] Does `git log --all -p | grep -iE "(password|secret|api_key|token)" ` return results?
693
+ - [ ] Is `.env` listed in `.gitignore`? Was it added before the first commit?
694
+ - [ ] Are there any hardcoded strings that look like API keys, tokens, or passwords?
695
+ - [ ] Does the repository contain config files with database connection strings?
696
+ - [ ] Are Docker Compose files or Terraform tfvars committed with real credentials?
697
+
698
+ ### Secrets Management Infrastructure
699
+ - [ ] Is there a centralized secrets manager (Vault, AWS SM, Doppler, etc.)?
700
+ - [ ] Does every secret have a defined rotation schedule?
701
+ - [ ] Is rotation automated, or does it require manual intervention?
702
+ - [ ] Are secrets scoped per environment (dev/staging/prod)?
703
+ - [ ] Are secrets scoped per service (principle of least privilege)?
704
+
705
+ ### CI/CD Pipeline
706
+ - [ ] Do CI logs contain any secret values, even encoded or transformed?
707
+ - [ ] Does the pipeline use OIDC federation instead of long-lived credentials?
708
+ - [ ] Are CI secret variables marked as masked and non-exportable?
709
+ - [ ] What is the log retention policy? Who can access historical logs?
710
+
711
+ ### Runtime and Deployment
712
+ - [ ] Are Docker images scanned for embedded secrets before push?
713
+ - [ ] Do environment variables contain secrets visible to child processes that do not need them?
714
+ - [ ] Are error messages and stack traces sanitized to remove credentials?
715
+ - [ ] Do frontend bundles contain any secret API keys?
716
+
717
+ ### Operational Hygiene
718
+ - [ ] Is there an audit trail for secret access (who, when, from where)?
719
+ - [ ] Can the team enumerate all secrets and their locations within one hour?
720
+ - [ ] Is there a documented incident response plan for leaked secrets?
721
+ - [ ] Are departing employees' credentials revoked within the same business day?
722
+ - [ ] When was the last secrets rotation drill?
723
+
724
+ ---
725
+
726
+ ## Code Smell Quick Reference
727
+
728
+ | Smell | Where to Look | Tool to Detect |
729
+ |---|---|---|
730
+ | High-entropy strings in source | `.py`, `.js`, `.ts`, `.go`, `.java`, `.rb` | gitleaks, TruffleHog, git-secrets |
731
+ | `.env` in repo | `git ls-files \| grep -i env` | pre-commit hooks, CI checks |
732
+ | Secrets in git history | Full history scan | TruffleHog (`--since-commit`), BFG |
733
+ | Secrets in Docker layers | Dockerfile `ENV`, `COPY .env` | Trivy, Snyk Container, Grype |
734
+ | Hardcoded connection strings | Config files (`.xml`, `.yaml`, `.json`, `.properties`) | SAST tools (Semgrep, SonarQube) |
735
+ | Secrets in CI logs | Build output, workflow logs | CI platform audit, manual review |
736
+ | API keys in JS bundles | `bundle.js`, `main.js`, webpack output | Browser DevTools, Semgrep |
737
+ | Default credentials | Admin panels, databases, IoT | Nessus, OpenVAS, manual checklist |
738
+ | Secrets in URLs | Access logs, Referer headers | WAF rules, log analysis |
739
+ | Long-lived unrotated keys | IAM console, secrets manager age report | AWS IAM Access Analyzer, Vault |
740
+ | Secrets in error logs | Application logs, Sentry/Datadog | Log scrubbing rules, regex filters |
741
+ | Broad access credentials | IAM policies, Vault ACLs | IAM Access Analyzer, policy review |
742
+ | Tokens in localStorage | Browser DevTools, source code | ESLint rules, Semgrep |
743
+ | Secrets in IaC files | `.tf`, `.tfvars`, `docker-compose.yml` | tfsec, checkov, kics |
744
+ | Unencrypted Terraform state | `.tfstate` files, S3 buckets | checkov, terraform plan audit |
745
+
746
+ ---
747
+
748
+ ## Prevention Toolkit
749
+
750
+ ### Pre-Commit Layer
751
+ ```bash
752
+ # Install gitleaks as a pre-commit hook
753
+ # .pre-commit-config.yaml
754
+ repos:
755
+ - repo: https://github.com/gitleaks/gitleaks
756
+ rev: v8.18.0
757
+ hooks:
758
+ - id: gitleaks
759
+ ```
760
+
761
+ ### CI/CD Layer
762
+ ```yaml
763
+ # GitHub Actions: scan for secrets on every push
764
+ - name: Gitleaks
765
+ uses: gitleaks/gitleaks-action@v2
766
+ env:
767
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
768
+ ```
769
+
770
+ ### Runtime Layer
771
+ ```python
772
+ # Python: load secrets from vault, never from environment or config
773
+ from hvac import Client
774
+
775
+ vault = Client(url="https://vault.internal:8200")
776
+ db_password = vault.secrets.kv.v2.read_secret("database/prod")["data"]["password"]
777
+ ```
778
+
779
+ ### Docker Layer
780
+ ```dockerfile
781
+ # Use BuildKit secrets -- never ENV or COPY for sensitive data
782
+ # syntax=docker/dockerfile:1
783
+ FROM node:18
784
+ RUN --mount=type=secret,id=npm_token \
785
+ NPM_TOKEN=$(cat /run/secrets/npm_token) npm install
786
+ ```
787
+
788
+ ---
789
+
790
+ ## Incident Response Checklist
791
+
792
+ When a secret is confirmed or suspected to be leaked:
793
+
794
+ 1. **Rotate immediately.** Do not investigate first. Revoke and replace the compromised
795
+ credential within minutes.
796
+ 2. **Assess blast radius.** Determine what the secret protects, what systems it grants access
797
+ to, and what data is at risk.
798
+ 3. **Check access logs.** Review audit logs for the compromised credential for unauthorized
799
+ usage patterns (unusual IPs, times, volumes).
800
+ 4. **Scan for lateral damage.** Determine if the leaked secret provides access to other secrets
801
+ (e.g., a GitHub token that exposes repos containing AWS keys).
802
+ 5. **Clean the source.** Remove the secret from git history, Docker layers, CI logs, Slack
803
+ messages, or wherever it was exposed.
804
+ 6. **Notify affected parties.** Follow breach disclosure requirements (GDPR 72-hour rule, state
805
+ notification laws, customer communication).
806
+ 7. **Conduct a post-mortem.** Document how the leak occurred, what detection failed, and what
807
+ systemic changes will prevent recurrence.
808
+
809
+ ---
810
+
811
+ ## Key Statistics
812
+
813
+ | Metric | Value | Source |
814
+ |---|---|---|
815
+ | Secrets leaked on GitHub in 2024 | 39 million | GitHub Security Blog |
816
+ | Secrets revoked within 1 hour | 2.6% | GitGuardian 2024 |
817
+ | Secrets still valid after 5 days | 91.6% | GitGuardian 2024 |
818
+ | Average breach cost (credentials) | $4.88 million | IBM Cost of Data Breach 2024 |
819
+ | Breaches involving stolen credentials | 22% | Verizon DBIR 2025 |
820
+ | Organizations failing rotation targets | 71% | Industry research |
821
+ | Average unrotated secret lifespan | 600+ days | Industry research |
822
+ | Docker Hub images leaking secrets | 10,456 | Flare Research 2025 |
823
+ | Travis CI tokens exposed via logs | 73,000+ | Travis CI disclosure |
824
+ | IoT devices compromised by Mirai | 600,000+ | Cloudflare / CISA 2016 |
825
+
826
+ ---
827
+
828
+ ## Sources
829
+
830
+ - [GitHub Found 39M Secret Leaks in 2024](https://github.blog/security/application-security/next-evolution-github-advanced-security/) -- GitHub Blog
831
+ - [Over 12 Million Auth Secrets Leaked on GitHub in 2023](https://www.bleepingcomputer.com/news/security/over-12-million-auth-secrets-and-keys-leaked-on-github-in-2023/) -- BleepingComputer
832
+ - [Uber Breach: How Did a Private GitHub Repository Fail Uber?](https://www.techtarget.com/searchsecurity/answer/Uber-breach-How-did-a-private-GitHub-repository-fail-Uber) -- TechTarget
833
+ - [Uber Data Breach: What Happened, Impact, and Lessons](https://www.huntress.com/threat-library/data-breach/uber-data-breach) -- Huntress
834
+ - [Toyota Accidentally Exposed a Secret Key on GitHub for Five Years](https://blog.gitguardian.com/toyota-accidently-exposed-a-secret-key-publicly-on-github-for-five-years/) -- GitGuardian
835
+ - [Toyota Discloses Data Leak After Access Key Exposed on GitHub](https://www.bleepingcomputer.com/news/security/toyota-discloses-data-leak-after-access-key-exposed-on-github/) -- BleepingComputer
836
+ - [A Mishandled GitHub Token Exposed Mercedes-Benz Source Code](https://www.bleepingcomputer.com/news/security/a-mishandled-github-token-exposed-mercedes-benz-source-code/) -- BleepingComputer
837
+ - [Samsung Confirms Source Code Stolen in Breach](https://www.bankinfosecurity.com/hackers-report-leaking-190gb-samsung-data-source-code-a-18665) -- BankInfoSecurity
838
+ - [Twitch Leak: A Deep Dive into the Source Code Security Threats](https://blog.gitguardian.com/security-threats-from-the-twitch-leak/) -- GitGuardian
839
+ - [CircleCI Security Incident: Rotate Your Secrets](https://snyk.io/blog/supply-chain-security-incident-circleci-secrets/) -- Snyk
840
+ - [Rotate or Breach: Security Insights from Cloudflare](https://www.akeyless.io/blog/rotate-or-breach-security-insights-from-cloudflare/) -- Akeyless
841
+ - [Over 10,000 Docker Hub Images Found Leaking Credentials](https://www.bleepingcomputer.com/news/security/over-10-000-docker-hub-images-found-leaking-credentials-auth-keys/) -- BleepingComputer
842
+ - [How Secrets Leak in CI/CD Pipelines](https://trufflesecurity.com/blog/secrets-leak-in-ci-cd) -- Truffle Security
843
+ - [Mirai Botnet: A Retrospective Analysis](https://blog.cloudflare.com/inside-mirai-the-infamous-iot-botnet-a-retrospective-analysis/) -- Cloudflare
844
+ - [Information Exposure Through Query Strings in URL](https://owasp.org/www-community/vulnerabilities/Information_exposure_through_query_strings_in_url) -- OWASP
845
+ - [Secrets Management Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html) -- OWASP
846
+ - [Why localStorage Is Unsafe for Tokens and Secrets](https://www.trevorlasn.com/blog/the-problem-with-local-storage) -- Trevor Lasn
847
+ - [Secrets Exposed: Why Your CISO Should Worry About Slack](https://thehackernews.com/2024/09/secrets-exposed-why-your-ciso-should.html) -- The Hacker News
848
+ - [Massive GitHub Leak: 39M API Keys and Credentials Exposed](https://gbhackers.com/massive-github-leak/) -- GBHackers
849
+ - [Secrets Management: Best Practices for 2026](https://www.strongdm.com/blog/secrets-management) -- StrongDM