@bluefly/openstandardagents 0.2.7 → 0.2.9

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 (327) hide show
  1. package/.devfile.yaml +1 -1
  2. package/.env.example +1 -1
  3. package/.github/AGENTS.md +245 -0
  4. package/.github/agents/github-issue-triage.ossa.yaml +99 -0
  5. package/.github/agents/github-pr-triage.ossa.yaml +137 -0
  6. package/.github/workflows/issue-sync-to-gitlab.yml +138 -0
  7. package/.github/workflows/pr-triage-to-gitlab.yml +164 -0
  8. package/.version.json +2 -2
  9. package/.wiki-config.json +24 -0
  10. package/CHANGELOG.md +44 -18
  11. package/CODEOWNERS +75 -0
  12. package/CONTRIBUTING.md +103 -4
  13. package/README.md +178 -243
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +2 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/repositories/schema.repository.d.ts +6 -1
  19. package/dist/repositories/schema.repository.d.ts.map +1 -1
  20. package/dist/repositories/schema.repository.js +49 -27
  21. package/dist/repositories/schema.repository.js.map +1 -1
  22. package/dist/services/migration.service.d.ts +4 -3
  23. package/dist/services/migration.service.d.ts.map +1 -1
  24. package/dist/services/migration.service.js +11 -10
  25. package/dist/services/migration.service.js.map +1 -1
  26. package/dist/services/release-automation/release.service.js +1 -1
  27. package/dist/services/release-automation/release.service.js.map +1 -1
  28. package/dist/services/release-automation/schemas/release.schema.js +1 -1
  29. package/dist/services/release-automation/webhook.service.js +3 -3
  30. package/dist/services/release-automation/webhook.service.js.map +1 -1
  31. package/dist/services/runtime/claude/claude-adapter.d.ts +1 -1
  32. package/dist/services/runtime/claude/claude-adapter.d.ts.map +1 -1
  33. package/dist/services/runtime/claude/claude-adapter.js +2 -2
  34. package/dist/services/runtime/claude/claude-adapter.js.map +1 -1
  35. package/dist/spec/v0.2.8/CHANGELOG.md +401 -0
  36. package/dist/spec/v0.2.8/README.md +72 -0
  37. package/dist/spec/v0.2.8/migrations/v0.2.3-to-v0.2.4.md +599 -0
  38. package/dist/spec/v0.2.8/migrations/v0.2.5-RC-to-v0.2.6.md +65 -0
  39. package/dist/spec/v0.2.8/migrations/v0.2.6-to-v0.2.8.md +81 -0
  40. package/{spec/v0.2.6-dev/ossa-0.2.5.schema.json → dist/spec/v0.2.8/ossa-0.2.8.schema.json} +1509 -52
  41. package/dist/spec/v0.2.8/ossa-0.2.8.yaml +581 -0
  42. package/dist/spec/v0.2.9/a2a-protocol.md +1337 -0
  43. package/dist/spec/v0.2.9/agent.md +1946 -0
  44. package/dist/spec/v0.2.9/capabilities/index.yaml +25 -0
  45. package/dist/spec/v0.2.9/capabilities/memory.yaml +251 -0
  46. package/dist/spec/v0.2.9/capability-schema.md +576 -0
  47. package/dist/spec/v0.2.9/compliance-profiles.md +533 -0
  48. package/dist/spec/v0.2.9/conformance-testing.md +1527 -0
  49. package/dist/spec/v0.2.9/gitlab-duo-integration.md +621 -0
  50. package/dist/spec/v0.2.9/ossa-0.2.9.schema.json +3699 -0
  51. package/dist/spec/v0.2.9/runtime-semantics.md +464 -0
  52. package/dist/spec/v0.2.9/security-model.md +1245 -0
  53. package/dist/spec/v0.2.9/semantic-conventions.md +347 -0
  54. package/dist/spec/v0.2.9/types.ts +522 -0
  55. package/dist/types/index.d.ts +3 -2
  56. package/dist/types/index.d.ts.map +1 -1
  57. package/dist/types/policy.d.ts +377 -0
  58. package/dist/types/policy.d.ts.map +1 -0
  59. package/dist/types/policy.js +84 -0
  60. package/dist/types/policy.js.map +1 -0
  61. package/dist/utils/index.d.ts +6 -0
  62. package/dist/utils/index.d.ts.map +1 -0
  63. package/dist/utils/index.js +6 -0
  64. package/dist/utils/index.js.map +1 -0
  65. package/dist/utils/version.d.ts +68 -0
  66. package/dist/utils/version.d.ts.map +1 -0
  67. package/dist/utils/version.js +156 -0
  68. package/dist/utils/version.js.map +1 -0
  69. package/docs/specs/policy-dsl.md +925 -0
  70. package/eslint-report.json +1 -0
  71. package/examples/adk-integration/code-review-workflow.yml +1 -1
  72. package/examples/adk-integration/customer-support.yml +1 -1
  73. package/examples/adk-integration/data-pipeline.yml +1 -1
  74. package/examples/advanced/reasoning-agent.yaml +136 -0
  75. package/examples/advanced/workflows/hybrid-model-strategy.yaml +1 -1
  76. package/examples/agent-manifests/critics/critic-agent.yaml +1 -1
  77. package/examples/agent-manifests/governors/governor-agent.yaml +1 -1
  78. package/examples/agent-manifests/integrators/integrator-agent.yaml +1 -1
  79. package/examples/agent-manifests/judges/judge-agent.yaml +1 -1
  80. package/examples/agent-manifests/monitors/monitor-agent.yaml +1 -1
  81. package/examples/agent-manifests/orchestrators/orchestrator-agent.yaml +1 -1
  82. package/examples/agent-manifests/sample-compliant-agent.yaml +1 -1
  83. package/examples/agent-manifests/workers/worker-agent.yaml +1 -1
  84. package/examples/agents-md/code-agent.ossa.json +100 -0
  85. package/examples/agents-md/monorepo-agent.ossa.yaml +180 -0
  86. package/examples/anthropic/claude-assistant.ossa.json +1 -1
  87. package/examples/autogen/multi-agent.ossa.json +1 -1
  88. package/examples/claude-code/code-reviewer.ossa.yaml +78 -0
  89. package/examples/claude-code/ossa-validator.ossa.yaml +80 -0
  90. package/examples/common_npm/agent-router.ossa.yaml +1 -0
  91. package/examples/common_npm/agent-router.v0.2.2.ossa.yaml +1 -1
  92. package/examples/crewai/research-team.ossa.json +1 -1
  93. package/examples/cursor/code-review-agent.ossa.json +1 -1
  94. package/examples/drupal/gitlab-ml-recommender.ossa.yaml +1 -0
  95. package/examples/drupal/gitlab-ml-recommender.v0.2.2.ossa.yaml +1 -1
  96. package/examples/extensions/agents-md-v1.yml +175 -0
  97. package/examples/extensions/drupal-v1.yml +1 -1
  98. package/examples/extensions/kagent-v1.yml +1 -1
  99. package/examples/getting-started/hello-world-complete.ossa.yaml +1 -1
  100. package/examples/integration-patterns/agent-to-agent-orchestration.ossa.yaml +4 -4
  101. package/examples/kagent/compliance-validator.ossa.yaml +1 -1
  102. package/examples/kagent/cost-optimizer.ossa.yaml +1 -1
  103. package/examples/kagent/documentation-agent.ossa.yaml +1 -1
  104. package/examples/kagent/k8s-troubleshooter-v1.ossa.yaml +1 -0
  105. package/examples/kagent/k8s-troubleshooter-v1.v0.2.2.ossa.yaml +1 -1
  106. package/examples/kagent/k8s-troubleshooter.ossa.yaml +1 -1
  107. package/examples/kagent/security-scanner.ossa.yaml +1 -1
  108. package/examples/langchain/chain-agent.ossa.json +1 -1
  109. package/examples/langflow/workflow-agent.ossa.json +1 -1
  110. package/examples/langgraph/state-machine-agent.ossa.json +1 -1
  111. package/examples/llamaindex/rag-agent.ossa.json +1 -1
  112. package/examples/migration-guides/from-langchain-to-ossa.yaml +4 -4
  113. package/examples/multi-agent/README.md +74 -0
  114. package/examples/multi-agent/conditional-router.ossa.yaml +42 -0
  115. package/examples/multi-agent/parallel-execution.ossa.yaml +54 -0
  116. package/examples/multi-agent/sequential-pipeline.ossa.yaml +45 -0
  117. package/examples/openai/basic-agent.ossa.yaml +1 -1
  118. package/examples/openai/multi-tool-agent.ossa.json +1 -1
  119. package/examples/openai/swarm-agent.ossa.json +1 -1
  120. package/examples/production/document-analyzer-openai.yml +1 -1
  121. package/examples/quickstart/support-agent.ossa.yaml +1 -1
  122. package/examples/spec-examples/audit-agent.yml +1 -1
  123. package/examples/spec-examples/chat-agent.yml +1 -1
  124. package/examples/spec-examples/compliance-agent.yml +1 -1
  125. package/examples/spec-examples/monitoring-agent.yml +1 -1
  126. package/examples/spec-examples/workflow-agent.yml +1 -1
  127. package/examples/templates/ossa-compliance.yaml +1 -1
  128. package/examples/vercel/edge-agent.ossa.json +1 -1
  129. package/gl-code-quality-report.json +62 -0
  130. package/llms-ctx-full.txt +39 -0
  131. package/llms-ctx.txt +39 -0
  132. package/llms.txt +47 -0
  133. package/package.json +6 -3
  134. package/scripts/README.md +25 -0
  135. package/scripts/compliance-audit.ts +796 -0
  136. package/scripts/eslint-to-codequality.cjs +34 -0
  137. package/scripts/generate-agents-catalog.ts +2 -1
  138. package/scripts/generate-api-docs.ts +2 -1
  139. package/scripts/generate-examples-docs.ts +2 -1
  140. package/scripts/generate-llms-ctx.sh +17 -0
  141. package/scripts/generate-schema-docs.ts +31 -10
  142. package/scripts/sync-version.js +4 -12
  143. package/scripts/validate-schema.ts +2 -1
  144. package/spec/v0.2.8/CHANGELOG.md +401 -0
  145. package/spec/v0.2.8/README.md +72 -0
  146. package/spec/v0.2.8/migrations/v0.2.3-to-v0.2.4.md +599 -0
  147. package/spec/v0.2.8/migrations/v0.2.5-RC-to-v0.2.6.md +65 -0
  148. package/spec/v0.2.8/migrations/v0.2.6-to-v0.2.8.md +81 -0
  149. package/spec/{v0.2.6-dev/ossa-0.2.6-dev.schema.json → v0.2.8/ossa-0.2.8.schema.json} +1509 -52
  150. package/spec/v0.2.8/ossa-0.2.8.yaml +581 -0
  151. package/spec/v0.2.9/a2a-protocol.md +1337 -0
  152. package/spec/v0.2.9/agent.md +1946 -0
  153. package/spec/v0.2.9/capabilities/index.yaml +25 -0
  154. package/spec/v0.2.9/capabilities/memory.yaml +251 -0
  155. package/spec/v0.2.9/capability-schema.md +576 -0
  156. package/spec/v0.2.9/compliance-profiles.md +533 -0
  157. package/spec/v0.2.9/conformance-testing.md +1527 -0
  158. package/spec/v0.2.9/gitlab-duo-integration.md +621 -0
  159. package/spec/v0.2.9/ossa-0.2.9.schema.json +3699 -0
  160. package/spec/v0.2.9/runtime-semantics.md +464 -0
  161. package/spec/v0.2.9/security-model.md +1245 -0
  162. package/spec/v0.2.9/semantic-conventions.md +347 -0
  163. package/spec/v0.2.9/types.ts +522 -0
  164. package/test-results/junit.xml +337 -0
  165. package/.github/workflows/pr-comment.yml +0 -33
  166. package/bin/validate-ossa-0.2.5-RC.ts +0 -244
  167. package/dist/spec/v0.2.6-dev/ossa-0.2.5.schema.json +0 -1696
  168. package/dist/spec/v0.2.6-dev/ossa-0.2.6-dev.schema.json +0 -1696
  169. package/scripts/lib/exec.ts +0 -37
  170. package/scripts/lib/file-ops.ts +0 -58
  171. package/scripts/lib/version.ts +0 -83
  172. package/website/.lighthouserc.ts +0 -24
  173. package/website/.prettierrc +0 -10
  174. package/website/DESIGN_SYSTEM_IMPLEMENTATION.md +0 -445
  175. package/website/Dockerfile +0 -30
  176. package/website/app/about/page.tsx +0 -304
  177. package/website/app/blog/[slug]/page.tsx +0 -208
  178. package/website/app/blog/page.tsx +0 -249
  179. package/website/app/design-guide/page.tsx +0 -511
  180. package/website/app/docs/[[...slug]]/page.tsx +0 -847
  181. package/website/app/docs/core-concepts/project-structure/page.tsx +0 -349
  182. package/website/app/ecosystem/page.tsx +0 -410
  183. package/website/app/examples/page.tsx +0 -133
  184. package/website/app/globals.scss +0 -370
  185. package/website/app/layout.tsx +0 -106
  186. package/website/app/license/page.tsx +0 -183
  187. package/website/app/not-found.tsx +0 -18
  188. package/website/app/page.tsx +0 -686
  189. package/website/app/page.tsx.bak +0 -679
  190. package/website/app/page.tsx.bak2 +0 -649
  191. package/website/app/playground/page.tsx +0 -487
  192. package/website/app/robots.ts +0 -19
  193. package/website/app/rss.xml/route.ts +0 -74
  194. package/website/app/schema/page.tsx +0 -1001
  195. package/website/app/sitemap.ts +0 -56
  196. package/website/app/specification/page.tsx +0 -287
  197. package/website/components/InstallCommand.tsx +0 -96
  198. package/website/components/Logo.tsx +0 -97
  199. package/website/components/StructuredData.tsx +0 -65
  200. package/website/components/docs/DocsSearch.tsx +0 -104
  201. package/website/components/docs/DocsSidebar.tsx +0 -155
  202. package/website/components/docs/MarkdownContent.tsx +0 -401
  203. package/website/components/docs/VersionSelector.tsx +0 -105
  204. package/website/components/examples/ExamplesViewer.tsx +0 -293
  205. package/website/components/layout/Footer.tsx +0 -116
  206. package/website/components/layout/Header.tsx +0 -172
  207. package/website/components/schema/SchemaComponentsAccordion.tsx +0 -84
  208. package/website/components/schema/SchemaExplorer.tsx +0 -213
  209. package/website/components/ui/Badge.tsx +0 -82
  210. package/website/components/ui/Button.tsx +0 -116
  211. package/website/components/ui/Card.tsx +0 -167
  212. package/website/components/ui/Checkbox.tsx +0 -141
  213. package/website/components/ui/Input.tsx +0 -169
  214. package/website/components/ui/Radio.tsx +0 -141
  215. package/website/components/ui/Select.tsx +0 -182
  216. package/website/components/ui/Tag.tsx +0 -158
  217. package/website/components/ui/Textarea.tsx +0 -195
  218. package/website/components/ui/index.ts +0 -11
  219. package/website/content/blog/OpenAPI-AI-Agents-Standard.md +0 -285
  220. package/website/content/blog/Why-Formal-Standards-Matter-Now.md +0 -198
  221. package/website/content/blog/gitlab-kubernetes-agent-ecosystem.md +0 -286
  222. package/website/content/blog/introducing-ossa-framework.md +0 -328
  223. package/website/content/blog/ossa-production-results.md +0 -279
  224. package/website/content/blog/welcome-to-ossa.md +0 -43
  225. package/website/content/blog/why-ai-agents-need-open-standard.md +0 -98
  226. package/website/content/docs/00-home.md +0 -153
  227. package/website/content/docs/adapters/openai-adapter.md +0 -693
  228. package/website/content/docs/agents/catalog.md +0 -28
  229. package/website/content/docs/aiflow-framework-integration-with-ossa.md +0 -107
  230. package/website/content/docs/api-reference/index.md +0 -38
  231. package/website/content/docs/api-reference/ossa-core-api.md +0 -634
  232. package/website/content/docs/api-reference/ossa-registry-api.md +0 -515
  233. package/website/content/docs/api-reference/unified-agent-gateway.md +0 -599
  234. package/website/content/docs/architecture/execution-flow.md +0 -335
  235. package/website/content/docs/architecture/multi-agent-systems.md +0 -737
  236. package/website/content/docs/architecture/overview.md +0 -121
  237. package/website/content/docs/architecture/stack-integration.md +0 -461
  238. package/website/content/docs/changelog.md +0 -246
  239. package/website/content/docs/cli-reference/index.md +0 -111
  240. package/website/content/docs/cli-reference/ossa-agents.md +0 -70
  241. package/website/content/docs/cli-reference/ossa-export.md +0 -56
  242. package/website/content/docs/cli-reference/ossa-generate.md +0 -66
  243. package/website/content/docs/cli-reference/ossa-gitlab-agent.md +0 -57
  244. package/website/content/docs/cli-reference/ossa-import.md +0 -56
  245. package/website/content/docs/cli-reference/ossa-init.md +0 -57
  246. package/website/content/docs/cli-reference/ossa-migrate.md +0 -62
  247. package/website/content/docs/cli-reference/ossa-run.md +0 -66
  248. package/website/content/docs/cli-reference/ossa-schema.md +0 -57
  249. package/website/content/docs/cli-reference/ossa-setup.md +0 -57
  250. package/website/content/docs/cli-reference/ossa-validate.md +0 -66
  251. package/website/content/docs/configuration/index.md +0 -97
  252. package/website/content/docs/contributing.md +0 -599
  253. package/website/content/docs/deployment/github-mirroring.md +0 -924
  254. package/website/content/docs/documentation.md +0 -100
  255. package/website/content/docs/ecosystem/framework-support.md +0 -1361
  256. package/website/content/docs/ecosystem/overview.md +0 -366
  257. package/website/content/docs/errors/index.md +0 -10
  258. package/website/content/docs/examples/aiflow-framework-integration-with-ossa.md +0 -107
  259. package/website/content/docs/examples/catalog.md +0 -300
  260. package/website/content/docs/for-audiences/students-researchers.md +0 -122
  261. package/website/content/docs/getting-started/index.md +0 -92
  262. package/website/content/docs/getting-started/installation.md +0 -155
  263. package/website/content/docs/getting-started/running-agents.md +0 -309
  264. package/website/content/docs/getting-started.md +0 -91
  265. package/website/content/docs/integrations/aiflow.md +0 -104
  266. package/website/content/docs/integrations/drupal.md +0 -105
  267. package/website/content/docs/migration-guides/agent-schema-comparison.md +0 -232
  268. package/website/content/docs/migration-guides/anthropic-mcp-to-ossa.md +0 -1750
  269. package/website/content/docs/migration-guides/crewai-to-ossa.md +0 -274
  270. package/website/content/docs/migration-guides/drupal-eca-to-ossa.md +0 -2017
  271. package/website/content/docs/migration-guides/general-agent-schema.yml +0 -247
  272. package/website/content/docs/migration-guides/index.md +0 -133
  273. package/website/content/docs/migration-guides/langchain-to-ossa.md +0 -1714
  274. package/website/content/docs/migration-guides/langflow-to-ossa.md +0 -2075
  275. package/website/content/docs/migration-guides/migration-manifest.json +0 -64
  276. package/website/content/docs/migration-guides/openai-to-ossa.md +0 -1202
  277. package/website/content/docs/openapi-extensions/examples.md +0 -550
  278. package/website/content/docs/openapi-extensions/index.md +0 -551
  279. package/website/content/docs/openapi-extensions/operation-extensions.md +0 -457
  280. package/website/content/docs/openapi-extensions/root-extensions.md +0 -410
  281. package/website/content/docs/ossa-compliant-badge.md +0 -251
  282. package/website/content/docs/pre-release/index.md +0 -175
  283. package/website/content/docs/quick-reference.md +0 -17
  284. package/website/content/docs/readme.md +0 -35
  285. package/website/content/docs/releases/v0.2.6.md +0 -99
  286. package/website/content/docs/schema-reference/agent-capabilities.md +0 -50
  287. package/website/content/docs/schema-reference/agent-id.md +0 -52
  288. package/website/content/docs/schema-reference/agent-name.md +0 -50
  289. package/website/content/docs/schema-reference/agent-role.md +0 -54
  290. package/website/content/docs/schema-reference/agent-spec.md +0 -406
  291. package/website/content/docs/schema-reference/agent-version.md +0 -50
  292. package/website/content/docs/schema-reference/autonomy.md +0 -568
  293. package/website/content/docs/schema-reference/constraints.md +0 -543
  294. package/website/content/docs/schema-reference/index.md +0 -45
  295. package/website/content/docs/schema-reference/llm-config.md +0 -445
  296. package/website/content/docs/schema-reference/observability.md +0 -654
  297. package/website/content/docs/schema-reference/ossa-manifest.md +0 -309
  298. package/website/content/docs/schema-reference/taxonomy.md +0 -509
  299. package/website/content/docs/schema-reference/tools.md +0 -628
  300. package/website/content/docs/templates/blog-post.md +0 -43
  301. package/website/content/docs/types-reference/index.md +0 -105
  302. package/website/content/docs/use-cases/00-index.md +0 -395
  303. package/website/content/docs/use-cases/cicd-code-review.md +0 -1236
  304. package/website/content/docs/use-cases/customer-support.md +0 -1234
  305. package/website/content/docs/use-cases/enterprise-compliance.md +0 -1208
  306. package/website/content/docs/use-cases/research-multi-agent.md +0 -1161
  307. package/website/content/docs/versioning.md +0 -288
  308. package/website/dev.sh +0 -53
  309. package/website/docker-compose.dev.yml +0 -36
  310. package/website/lib/version.ts +0 -35
  311. package/website/lib/versions.json +0 -103
  312. package/website/next.config.ts +0 -18
  313. package/website/nginx.conf +0 -32
  314. package/website/package-lock.json +0 -9679
  315. package/website/package.json +0 -59
  316. package/website/postcss.config.mjs +0 -9
  317. package/website/scripts/fetch-versions.js +0 -166
  318. package/website/scripts/generate-examples-index.js +0 -163
  319. package/website/scripts/merge-docs-to-wiki.ts +0 -207
  320. package/website/scripts/sync-version.js +0 -72
  321. package/website/scripts/sync-wiki.ts +0 -322
  322. package/website/scripts/upload-wiki.ts +0 -199
  323. package/website/styles/_spacing.scss +0 -453
  324. package/website/styles/_tokens.scss +0 -245
  325. package/website/styles/_typography.scss +0 -361
  326. package/website/styles/_variables.scss +0 -287
  327. package/website/tailwind.config.ts +0 -170
@@ -1,1208 +0,0 @@
1
- # Enterprise Financial Compliance Agent
2
-
3
- ## Problem Statement
4
-
5
- Financial institutions must maintain continuous compliance with regulations like SOC2, PCI-DSS, and GDPR. Manual compliance audits are:
6
- - **Slow**: Quarterly audits take weeks of manual review
7
- - **Expensive**: Compliance teams spend 40% of time on repetitive checks
8
- - **Error-prone**: Human reviewers miss edge cases in complex systems
9
- - **Reactive**: Issues discovered after violations occur
10
-
11
- **Solution**: An automated OSSA compliance agent that continuously monitors infrastructure, validates controls, generates audit trails, and enforces cost limits while maintaining strict security constraints.
12
-
13
- ## Architecture Overview
14
-
15
- ```mermaid
16
- graph TB
17
- subgraph "Compliance Agent"
18
- Agent[OSSA Compliance Agent]
19
- Scanner[Infrastructure Scanner]
20
- Validator[Policy Validator]
21
- Reporter[Audit Reporter]
22
- Remediation[Auto-Remediation]
23
- end
24
-
25
- subgraph "Infrastructure"
26
- K8s[Kubernetes Clusters]
27
- DB[(Databases)]
28
- S3[Object Storage]
29
- Logs[Audit Logs]
30
- end
31
-
32
- subgraph "Compliance Framework"
33
- PCI[PCI-DSS Controls]
34
- SOC2[SOC2 Requirements]
35
- GDPR[GDPR Articles]
36
- end
37
-
38
- subgraph "Outputs"
39
- Dashboard[Compliance Dashboard]
40
- Alerts[Security Alerts]
41
- Reports[Audit Reports]
42
- Evidence[Evidence Collection]
43
- end
44
-
45
- Agent --> Scanner
46
- Scanner --> K8s
47
- Scanner --> DB
48
- Scanner --> S3
49
- Scanner --> Logs
50
-
51
- Validator --> PCI
52
- Validator --> SOC2
53
- Validator --> GDPR
54
-
55
- Agent --> Reporter
56
- Reporter --> Dashboard
57
- Reporter --> Reports
58
- Reporter --> Evidence
59
-
60
- Agent --> Remediation
61
- Remediation -.->|Auto-fix| K8s
62
-
63
- Validator -.->|Violations| Alerts
64
-
65
- style Agent fill:#e1f5ff
66
- style Alerts fill:#ffe1e1
67
- style Reports fill:#e1ffe1
68
- ```
69
-
70
- ## OSSA Manifest
71
-
72
- ```yaml
73
- apiVersion: ossa/v0.2.x
74
- kind: Agent
75
- metadata:
76
- name: financial-compliance-agent
77
- namespace: compliance
78
- labels:
79
- app: compliance
80
- tier: security
81
- criticality: high
82
- annotations:
83
- compliance.ossa.io/frameworks: "pci-dss,soc2,gdpr"
84
- compliance.ossa.io/audit-retention: "2555d" # 7 years
85
- cost.ossa.io/budget-daily: "50.00"
86
- cost.ossa.io/alert-threshold: "0.80"
87
-
88
- spec:
89
- type: worker
90
- description: |
91
- Automated financial compliance agent for continuous infrastructure
92
- monitoring, policy validation, and regulatory audit reporting.
93
-
94
- Supports PCI-DSS v4.0, SOC2 Type II, and GDPR compliance frameworks.
95
-
96
- runtime:
97
- type: kubernetes
98
- image: registry.example.com/agents/compliance:2.1.0
99
- command: ["/app/compliance-agent"]
100
- args:
101
- - "--mode=continuous"
102
- - "--scan-interval=3600"
103
- - "--auto-remediate=false"
104
- resources:
105
- limits:
106
- cpu: "2000m"
107
- memory: "4Gi"
108
- ephemeral-storage: "10Gi"
109
- requests:
110
- cpu: "500m"
111
- memory: "1Gi"
112
- env:
113
- - name: LOG_LEVEL
114
- value: "info"
115
- - name: COMPLIANCE_FRAMEWORKS
116
- value: "pci-dss,soc2,gdpr"
117
- - name: AUDIT_LOG_RETENTION_DAYS
118
- value: "2555"
119
- - name: ENABLE_AUTO_REMEDIATION
120
- value: "false"
121
- - name: COST_LIMIT_DAILY_USD
122
- value: "50.00"
123
-
124
- capabilities:
125
- - name: scan_infrastructure
126
- description: |
127
- Scan Kubernetes infrastructure, databases, and storage for
128
- compliance violations across all configured frameworks.
129
- input_schema:
130
- type: object
131
- required: [namespace, frameworks]
132
- properties:
133
- namespace:
134
- type: string
135
- description: Kubernetes namespace to scan
136
- frameworks:
137
- type: array
138
- items:
139
- type: string
140
- enum: [pci-dss, soc2, gdpr, hipaa]
141
- description: Compliance frameworks to validate against
142
- controls:
143
- type: array
144
- items:
145
- type: string
146
- description: Specific control IDs to check (optional)
147
- depth:
148
- type: string
149
- enum: [shallow, deep, comprehensive]
150
- default: deep
151
- description: Scan depth level
152
- output_schema:
153
- type: object
154
- required: [scan_id, compliant, violations, timestamp]
155
- properties:
156
- scan_id:
157
- type: string
158
- format: uuid
159
- compliant:
160
- type: boolean
161
- compliance_score:
162
- type: number
163
- minimum: 0
164
- maximum: 100
165
- violations:
166
- type: array
167
- items:
168
- type: object
169
- required: [control_id, severity, resource, description]
170
- properties:
171
- control_id:
172
- type: string
173
- description: "e.g., PCI-DSS 3.4, SOC2 CC6.1"
174
- framework:
175
- type: string
176
- severity:
177
- type: string
178
- enum: [critical, high, medium, low, info]
179
- resource:
180
- type: object
181
- properties:
182
- type: {type: string}
183
- namespace: {type: string}
184
- name: {type: string}
185
- description:
186
- type: string
187
- remediation:
188
- type: string
189
- evidence:
190
- type: array
191
- items: {type: string}
192
- summary:
193
- type: object
194
- properties:
195
- total_resources_scanned: {type: integer}
196
- violations_by_severity:
197
- type: object
198
- properties:
199
- critical: {type: integer}
200
- high: {type: integer}
201
- medium: {type: integer}
202
- low: {type: integer}
203
- timestamp:
204
- type: string
205
- format: date-time
206
-
207
- - name: validate_policy
208
- description: |
209
- Validate a specific resource against compliance policies
210
- and return detailed pass/fail results with evidence.
211
- input_schema:
212
- type: object
213
- required: [resource_type, resource_spec, policies]
214
- properties:
215
- resource_type:
216
- type: string
217
- enum: [deployment, service, secret, configmap, pvc, database]
218
- resource_spec:
219
- type: object
220
- description: Full resource specification (YAML/JSON)
221
- policies:
222
- type: array
223
- items:
224
- type: string
225
- description: Policy IDs to validate against
226
- output_schema:
227
- type: object
228
- properties:
229
- valid:
230
- type: boolean
231
- policy_results:
232
- type: array
233
- items:
234
- type: object
235
- properties:
236
- policy_id: {type: string}
237
- passed: {type: boolean}
238
- message: {type: string}
239
- evidence: {type: array, items: {type: string}}
240
-
241
- - name: generate_audit_report
242
- description: |
243
- Generate comprehensive audit report for specified time period
244
- with evidence collection and compliance attestation.
245
- input_schema:
246
- type: object
247
- required: [start_date, end_date, format]
248
- properties:
249
- start_date:
250
- type: string
251
- format: date
252
- end_date:
253
- type: string
254
- format: date
255
- format:
256
- type: string
257
- enum: [pdf, html, json, csv]
258
- frameworks:
259
- type: array
260
- items:
261
- type: string
262
- description: Filter by frameworks
263
- include_evidence:
264
- type: boolean
265
- default: true
266
- output_schema:
267
- type: object
268
- required: [report_id, report_url, generated_at]
269
- properties:
270
- report_id:
271
- type: string
272
- format: uuid
273
- report_url:
274
- type: string
275
- format: uri
276
- summary:
277
- type: object
278
- properties:
279
- period: {type: string}
280
- total_scans: {type: integer}
281
- compliance_score_avg: {type: number}
282
- critical_violations: {type: integer}
283
- remediated_violations: {type: integer}
284
- generated_at:
285
- type: string
286
- format: date-time
287
- expires_at:
288
- type: string
289
- format: date-time
290
-
291
- - name: auto_remediate
292
- description: |
293
- Automatically remediate approved compliance violations.
294
- Requires explicit approval for critical/high severity issues.
295
- input_schema:
296
- type: object
297
- required: [violation_id, action]
298
- properties:
299
- violation_id:
300
- type: string
301
- action:
302
- type: string
303
- enum: [apply, simulate, rollback]
304
- approval_token:
305
- type: string
306
- description: Required for critical/high severity
307
- output_schema:
308
- type: object
309
- properties:
310
- remediated:
311
- type: boolean
312
- actions_taken:
313
- type: array
314
- items:
315
- type: string
316
- rollback_available:
317
- type: boolean
318
- rollback_id:
319
- type: string
320
-
321
- policies:
322
- security:
323
- encryption_at_rest: required
324
- encryption_in_transit: required
325
- secrets_management: vault
326
- network_policies: required
327
- pod_security_standards: restricted
328
-
329
- compliance:
330
- frameworks:
331
- - pci-dss-v4.0
332
- - soc2-type2
333
- - gdpr
334
- data_residency: [US, EU]
335
- audit_logging: comprehensive
336
- retention_days: 2555 # 7 years for financial records
337
-
338
- cost_management:
339
- budget:
340
- daily_limit_usd: 50.00
341
- monthly_limit_usd: 1500.00
342
- alert_threshold: 0.80
343
- actions_on_limit:
344
- - notify_admin
345
- - reduce_scan_frequency
346
- - disable_non_critical_scans
347
- optimization:
348
- scan_scheduling: off_peak_hours
349
- resource_pooling: enabled
350
- cache_results: 3600 # 1 hour
351
-
352
- monitoring:
353
- health_checks:
354
- enabled: true
355
- interval_seconds: 30
356
- metrics:
357
- prometheus: true
358
- custom_metrics:
359
- - compliance_score
360
- - violations_by_severity
361
- - scan_duration_seconds
362
- - cost_per_scan_usd
363
- alerts:
364
- critical_violations: immediate
365
- high_violations: 15_minutes
366
- cost_threshold_exceeded: immediate
367
- agent_unhealthy: immediate
368
-
369
- integration:
370
- protocol: grpc
371
- api_version: v1
372
- endpoints:
373
- scan:
374
- path: /v1/compliance/scan
375
- method: POST
376
- rate_limit: 100/hour
377
- validate:
378
- path: /v1/compliance/validate
379
- method: POST
380
- rate_limit: 1000/hour
381
- report:
382
- path: /v1/compliance/reports
383
- method: GET
384
- rate_limit: 50/hour
385
- remediate:
386
- path: /v1/compliance/remediate
387
- method: POST
388
- rate_limit: 10/hour
389
-
390
- authentication:
391
- type: mutual-tls
392
- config:
393
- ca_cert_path: /etc/certs/ca.crt
394
- server_cert_path: /etc/certs/server.crt
395
- server_key_path: /etc/certs/server.key
396
- client_verification: required
397
-
398
- authorization:
399
- rbac:
400
- enabled: true
401
- roles:
402
- - name: compliance_admin
403
- permissions: [scan, validate, report, remediate]
404
- - name: compliance_viewer
405
- permissions: [report]
406
- - name: compliance_auditor
407
- permissions: [scan, report]
408
-
409
- monitoring:
410
- health_check:
411
- endpoint: http://localhost:8080/health
412
- interval_seconds: 30
413
- timeout_seconds: 5
414
- failure_threshold: 3
415
-
416
- readiness_check:
417
- endpoint: http://localhost:8080/ready
418
- interval_seconds: 10
419
-
420
- traces:
421
- enabled: true
422
- exporter: jaeger
423
- endpoint: http://jaeger-collector:14268/api/traces
424
- sample_rate: 0.1
425
-
426
- metrics:
427
- enabled: true
428
- exporter: prometheus
429
- port: 9090
430
- path: /metrics
431
-
432
- logs:
433
- level: info
434
- format: json
435
- output: stdout
436
- audit_log_path: /var/log/audit/compliance.log
437
-
438
- metadata:
439
- version: 2.1.0
440
- author:
441
- name: Security Team
442
- email: security@example.com
443
- organization: Example Corp
444
- license: Proprietary
445
- tags:
446
- - compliance
447
- - security
448
- - audit
449
- - pci-dss
450
- - soc2
451
- - gdpr
452
- keywords:
453
- - automated compliance
454
- - continuous monitoring
455
- - audit automation
456
- - policy validation
457
- documentation_url: https://docs.example.com/agents/compliance
458
- source_repository: https://github.com/example/compliance-agent
459
- issue_tracker: https://github.com/example/compliance-agent/issues
460
- ```
461
-
462
- ## Implementation (TypeScript)
463
-
464
- ```typescript
465
- /**
466
- * Enterprise Financial Compliance Agent
467
- *
468
- * Production-ready OSSA agent for continuous compliance monitoring
469
- * with cost controls and security constraints.
470
- */
471
-
472
- import { Agent, OSSARuntime } from '@ossa/runtime';
473
- import { PrometheusMetrics } from '@ossa/monitoring';
474
- import { VaultSecretManager } from '@ossa/security';
475
- import { ComplianceFramework } from './frameworks';
476
- import { CostLimiter } from './cost-management';
477
- import { AuditLogger } from './audit';
478
-
479
- interface ComplianceConfig {
480
- frameworks: string[];
481
- scanInterval: number;
482
- autoRemediate: boolean;
483
- costLimitDaily: number;
484
- auditRetentionDays: number;
485
- }
486
-
487
- interface ScanResult {
488
- scanId: string;
489
- compliant: boolean;
490
- complianceScore: number;
491
- violations: Violation[];
492
- summary: ScanSummary;
493
- timestamp: Date;
494
- }
495
-
496
- interface Violation {
497
- controlId: string;
498
- framework: string;
499
- severity: 'critical' | 'high' | 'medium' | 'low' | 'info';
500
- resource: {
501
- type: string;
502
- namespace: string;
503
- name: string;
504
- };
505
- description: string;
506
- remediation: string;
507
- evidence: string[];
508
- }
509
-
510
- interface ScanSummary {
511
- totalResourcesScanned: number;
512
- violationsBySeverity: {
513
- critical: number;
514
- high: number;
515
- medium: number;
516
- low: number;
517
- };
518
- }
519
-
520
- export class ComplianceAgent extends Agent {
521
- private config: ComplianceConfig;
522
- private frameworks: Map<string, ComplianceFramework>;
523
- private costLimiter: CostLimiter;
524
- private auditLogger: AuditLogger;
525
- private metrics: PrometheusMetrics;
526
- private secretManager: VaultSecretManager;
527
-
528
- constructor(runtime: OSSARuntime) {
529
- super(runtime);
530
-
531
- this.config = this.loadConfig();
532
- this.frameworks = this.initializeFrameworks();
533
- this.costLimiter = new CostLimiter({
534
- dailyLimit: this.config.costLimitDaily,
535
- alertThreshold: 0.80,
536
- });
537
- this.auditLogger = new AuditLogger({
538
- retentionDays: this.config.auditRetentionDays,
539
- encryptionEnabled: true,
540
- });
541
- this.metrics = new PrometheusMetrics();
542
- this.secretManager = new VaultSecretManager();
543
- }
544
-
545
- private loadConfig(): ComplianceConfig {
546
- return {
547
- frameworks: process.env.COMPLIANCE_FRAMEWORKS?.split(',') || ['pci-dss', 'soc2'],
548
- scanInterval: parseInt(process.env.SCAN_INTERVAL || '3600', 10),
549
- autoRemediate: process.env.ENABLE_AUTO_REMEDIATION === 'true',
550
- costLimitDaily: parseFloat(process.env.COST_LIMIT_DAILY_USD || '50.00'),
551
- auditRetentionDays: parseInt(process.env.AUDIT_LOG_RETENTION_DAYS || '2555', 10),
552
- };
553
- }
554
-
555
- private initializeFrameworks(): Map<string, ComplianceFramework> {
556
- const frameworks = new Map();
557
-
558
- for (const frameworkId of this.config.frameworks) {
559
- const framework = ComplianceFramework.load(frameworkId);
560
- frameworks.set(frameworkId, framework);
561
- }
562
-
563
- return frameworks;
564
- }
565
-
566
- /**
567
- * Scan infrastructure for compliance violations
568
- */
569
- async scanInfrastructure(params: {
570
- namespace: string;
571
- frameworks: string[];
572
- controls?: string[];
573
- depth?: 'shallow' | 'deep' | 'comprehensive';
574
- }): Promise<ScanResult> {
575
- const scanId = this.generateScanId();
576
- const startTime = Date.now();
577
-
578
- // Check cost limits before proceeding
579
- const estimatedCost = this.estimateScanCost(params.depth || 'deep');
580
- if (!await this.costLimiter.checkAndReserve(estimatedCost)) {
581
- throw new Error('Daily cost limit exceeded. Scan blocked.');
582
- }
583
-
584
- try {
585
- this.auditLogger.log({
586
- action: 'scan_started',
587
- scanId,
588
- params,
589
- timestamp: new Date(),
590
- });
591
-
592
- // Discover resources in namespace
593
- const resources = await this.discoverResources(params.namespace);
594
- this.metrics.recordGauge('resources_discovered', resources.length);
595
-
596
- // Run compliance checks across all frameworks
597
- const violations: Violation[] = [];
598
-
599
- for (const frameworkId of params.frameworks) {
600
- const framework = this.frameworks.get(frameworkId);
601
- if (!framework) {
602
- throw new Error(`Unknown framework: ${frameworkId}`);
603
- }
604
-
605
- const frameworkViolations = await framework.scan({
606
- resources,
607
- controls: params.controls,
608
- depth: params.depth || 'deep',
609
- });
610
-
611
- violations.push(...frameworkViolations);
612
- }
613
-
614
- // Calculate compliance score
615
- const complianceScore = this.calculateComplianceScore(violations, resources.length);
616
-
617
- // Generate summary
618
- const summary = this.generateSummary(violations, resources.length);
619
-
620
- const result: ScanResult = {
621
- scanId,
622
- compliant: violations.filter(v => v.severity === 'critical' || v.severity === 'high').length === 0,
623
- complianceScore,
624
- violations,
625
- summary,
626
- timestamp: new Date(),
627
- };
628
-
629
- // Record metrics
630
- const duration = Date.now() - startTime;
631
- this.metrics.recordHistogram('scan_duration_seconds', duration / 1000);
632
- this.metrics.recordCounter('scans_total', 1, { status: 'success' });
633
- this.metrics.recordGauge('compliance_score', complianceScore);
634
- this.metrics.recordGauge('violations_critical', summary.violationsBySeverity.critical);
635
- this.metrics.recordGauge('violations_high', summary.violationsBySeverity.high);
636
-
637
- // Log audit trail
638
- this.auditLogger.log({
639
- action: 'scan_completed',
640
- scanId,
641
- result: {
642
- compliant: result.compliant,
643
- score: complianceScore,
644
- violationCount: violations.length,
645
- },
646
- timestamp: new Date(),
647
- });
648
-
649
- // Send alerts for critical violations
650
- if (summary.violationsBySeverity.critical > 0) {
651
- await this.sendCriticalAlert(result);
652
- }
653
-
654
- // Record actual cost
655
- const actualCost = this.calculateActualCost(duration, resources.length);
656
- await this.costLimiter.recordActual(actualCost);
657
- this.metrics.recordHistogram('cost_per_scan_usd', actualCost);
658
-
659
- return result;
660
-
661
- } catch (error) {
662
- this.metrics.recordCounter('scans_total', 1, { status: 'error' });
663
- this.auditLogger.log({
664
- action: 'scan_failed',
665
- scanId,
666
- error: error.message,
667
- timestamp: new Date(),
668
- });
669
- throw error;
670
- }
671
- }
672
-
673
- /**
674
- * Validate a specific resource against policies
675
- */
676
- async validatePolicy(params: {
677
- resourceType: string;
678
- resourceSpec: any;
679
- policies: string[];
680
- }): Promise<{ valid: boolean; policyResults: any[] }> {
681
- this.auditLogger.log({
682
- action: 'policy_validation_started',
683
- resourceType: params.resourceType,
684
- policies: params.policies,
685
- timestamp: new Date(),
686
- });
687
-
688
- const results = [];
689
-
690
- for (const policyId of params.policies) {
691
- const policy = await this.loadPolicy(policyId);
692
- const result = await policy.validate(params.resourceSpec);
693
- results.push({
694
- policyId,
695
- passed: result.passed,
696
- message: result.message,
697
- evidence: result.evidence,
698
- });
699
- }
700
-
701
- const valid = results.every(r => r.passed);
702
-
703
- this.auditLogger.log({
704
- action: 'policy_validation_completed',
705
- valid,
706
- timestamp: new Date(),
707
- });
708
-
709
- return { valid, policyResults: results };
710
- }
711
-
712
- /**
713
- * Generate audit report
714
- */
715
- async generateAuditReport(params: {
716
- startDate: string;
717
- endDate: string;
718
- format: 'pdf' | 'html' | 'json' | 'csv';
719
- frameworks?: string[];
720
- includeEvidence?: boolean;
721
- }): Promise<any> {
722
- const reportId = this.generateReportId();
723
-
724
- this.auditLogger.log({
725
- action: 'report_generation_started',
726
- reportId,
727
- params,
728
- timestamp: new Date(),
729
- });
730
-
731
- // Retrieve scan history
732
- const scans = await this.auditLogger.queryScanHistory({
733
- startDate: new Date(params.startDate),
734
- endDate: new Date(params.endDate),
735
- frameworks: params.frameworks,
736
- });
737
-
738
- // Calculate aggregates
739
- const summary = {
740
- period: `${params.startDate} to ${params.endDate}`,
741
- totalScans: scans.length,
742
- complianceScoreAvg: this.calculateAverage(scans.map(s => s.complianceScore)),
743
- criticalViolations: scans.reduce((sum, s) => sum + s.violations.filter(v => v.severity === 'critical').length, 0),
744
- remediatedViolations: await this.countRemediatedViolations(params.startDate, params.endDate),
745
- };
746
-
747
- // Generate report in requested format
748
- const reportUrl = await this.formatAndStoreReport({
749
- reportId,
750
- format: params.format,
751
- scans,
752
- summary,
753
- includeEvidence: params.includeEvidence ?? true,
754
- });
755
-
756
- this.auditLogger.log({
757
- action: 'report_generation_completed',
758
- reportId,
759
- timestamp: new Date(),
760
- });
761
-
762
- return {
763
- reportId,
764
- reportUrl,
765
- summary,
766
- generatedAt: new Date().toISOString(),
767
- expiresAt: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString(), // 30 days
768
- };
769
- }
770
-
771
- /**
772
- * Auto-remediate violations
773
- */
774
- async autoRemediate(params: {
775
- violationId: string;
776
- action: 'apply' | 'simulate' | 'rollback';
777
- approvalToken?: string;
778
- }): Promise<any> {
779
- const violation = await this.loadViolation(params.violationId);
780
-
781
- // Check if auto-remediation is enabled
782
- if (!this.config.autoRemediate && params.action === 'apply') {
783
- throw new Error('Auto-remediation is disabled in configuration');
784
- }
785
-
786
- // Require approval for critical/high severity
787
- if ((violation.severity === 'critical' || violation.severity === 'high') && !params.approvalToken) {
788
- throw new Error('Approval token required for critical/high severity violations');
789
- }
790
-
791
- if (params.approvalToken) {
792
- await this.validateApprovalToken(params.approvalToken, violation);
793
- }
794
-
795
- this.auditLogger.log({
796
- action: 'remediation_started',
797
- violationId: params.violationId,
798
- action: params.action,
799
- timestamp: new Date(),
800
- });
801
-
802
- const remediation = await this.loadRemediationPlan(violation);
803
- const actions: string[] = [];
804
- let rollbackId: string | null = null;
805
-
806
- if (params.action === 'simulate') {
807
- // Dry run
808
- for (const step of remediation.steps) {
809
- actions.push(`[SIMULATED] ${step.description}`);
810
- }
811
- } else if (params.action === 'apply') {
812
- // Create rollback point
813
- rollbackId = await this.createRollbackPoint(violation.resource);
814
-
815
- // Apply remediation
816
- for (const step of remediation.steps) {
817
- await step.execute();
818
- actions.push(step.description);
819
- }
820
- } else if (params.action === 'rollback') {
821
- // Rollback previous remediation
822
- await this.executeRollback(params.violationId);
823
- actions.push('Rollback completed');
824
- }
825
-
826
- this.auditLogger.log({
827
- action: 'remediation_completed',
828
- violationId: params.violationId,
829
- actions,
830
- timestamp: new Date(),
831
- });
832
-
833
- return {
834
- remediated: params.action === 'apply',
835
- actionsTaken: actions,
836
- rollbackAvailable: rollbackId !== null,
837
- rollbackId,
838
- };
839
- }
840
-
841
- // Helper methods
842
- private generateScanId(): string {
843
- return `scan-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
844
- }
845
-
846
- private generateReportId(): string {
847
- return `report-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
848
- }
849
-
850
- private estimateScanCost(depth: string): number {
851
- const baseCost = 0.10; // $0.10 per scan
852
- const depthMultiplier = { shallow: 0.5, deep: 1.0, comprehensive: 2.0 };
853
- return baseCost * (depthMultiplier[depth] || 1.0);
854
- }
855
-
856
- private calculateActualCost(duration: number, resourceCount: number): number {
857
- const baseCost = 0.10;
858
- const durationCost = (duration / 1000 / 60) * 0.01; // $0.01 per minute
859
- const resourceCost = (resourceCount / 100) * 0.05; // $0.05 per 100 resources
860
- return baseCost + durationCost + resourceCost;
861
- }
862
-
863
- private calculateComplianceScore(violations: Violation[], totalResources: number): number {
864
- const weights = { critical: 10, high: 5, medium: 2, low: 1, info: 0 };
865
- const totalWeight = violations.reduce((sum, v) => sum + weights[v.severity], 0);
866
- const maxPossibleWeight = totalResources * weights.critical;
867
- return Math.max(0, 100 - (totalWeight / maxPossibleWeight) * 100);
868
- }
869
-
870
- private generateSummary(violations: Violation[], totalResources: number): ScanSummary {
871
- return {
872
- totalResourcesScanned: totalResources,
873
- violationsBySeverity: {
874
- critical: violations.filter(v => v.severity === 'critical').length,
875
- high: violations.filter(v => v.severity === 'high').length,
876
- medium: violations.filter(v => v.severity === 'medium').length,
877
- low: violations.filter(v => v.severity === 'low').length,
878
- },
879
- };
880
- }
881
-
882
- private async sendCriticalAlert(result: ScanResult): Promise<void> {
883
- // Send alerts via configured channels (email, Slack, PagerDuty, etc.)
884
- console.error(`CRITICAL COMPLIANCE VIOLATION DETECTED: ${result.scanId}`);
885
- }
886
-
887
- // Placeholder methods (implement based on your infrastructure)
888
- private async discoverResources(namespace: string): Promise<any[]> {
889
- // Implement Kubernetes resource discovery
890
- return [];
891
- }
892
-
893
- private async loadPolicy(policyId: string): Promise<any> {
894
- // Load policy from policy store
895
- return {};
896
- }
897
-
898
- private async loadViolation(violationId: string): Promise<Violation> {
899
- // Load violation from database
900
- return {} as Violation;
901
- }
902
-
903
- private async loadRemediationPlan(violation: Violation): Promise<any> {
904
- // Load remediation plan for violation type
905
- return {};
906
- }
907
-
908
- private async createRollbackPoint(resource: any): Promise<string> {
909
- // Create backup/snapshot for rollback
910
- return 'rollback-id';
911
- }
912
-
913
- private async executeRollback(violationId: string): Promise<void> {
914
- // Execute rollback
915
- }
916
-
917
- private async validateApprovalToken(token: string, violation: Violation): Promise<void> {
918
- // Validate approval token
919
- }
920
-
921
- private async countRemediatedViolations(startDate: string, endDate: string): Promise<number> {
922
- // Count remediated violations in period
923
- return 0;
924
- }
925
-
926
- private calculateAverage(numbers: number[]): number {
927
- return numbers.reduce((sum, n) => sum + n, 0) / numbers.length;
928
- }
929
-
930
- private async formatAndStoreReport(params: any): Promise<string> {
931
- // Format and store report, return URL
932
- return 'https://reports.example.com/report-id';
933
- }
934
- }
935
-
936
- // Entry point
937
- async function main() {
938
- const runtime = new OSSARuntime({
939
- manifestPath: '/etc/ossa/manifest.yaml',
940
- });
941
-
942
- const agent = new ComplianceAgent(runtime);
943
- await agent.start();
944
- }
945
-
946
- main().catch(console.error);
947
- ```
948
-
949
- ## Deployment Instructions
950
-
951
- ### Prerequisites
952
-
953
- ```bash
954
- # Kubernetes cluster (v1.24+)
955
- # Vault for secrets management
956
- # Prometheus for monitoring
957
- # Jaeger for distributed tracing
958
- ```
959
-
960
- ### Step 1: Deploy Supporting Infrastructure
961
-
962
- ```yaml
963
- # prometheus-deployment.yaml
964
- apiVersion: v1
965
- kind: Namespace
966
- metadata:
967
- name: monitoring
968
-
969
- ---
970
- apiVersion: apps/v1
971
- kind: Deployment
972
- metadata:
973
- name: prometheus
974
- namespace: monitoring
975
- spec:
976
- replicas: 1
977
- selector:
978
- matchLabels:
979
- app: prometheus
980
- template:
981
- metadata:
982
- labels:
983
- app: prometheus
984
- spec:
985
- containers:
986
- - name: prometheus
987
- image: prom/prometheus:latest
988
- ports:
989
- - containerPort: 9090
990
- ```
991
-
992
- ### Step 2: Deploy Compliance Agent
993
-
994
- ```bash
995
- # Create namespace
996
- kubectl create namespace compliance
997
-
998
- # Create secrets
999
- kubectl create secret generic compliance-certs \
1000
- --from-file=ca.crt=/path/to/ca.crt \
1001
- --from-file=server.crt=/path/to/server.crt \
1002
- --from-file=server.key=/path/to/server.key \
1003
- -n compliance
1004
-
1005
- # Deploy agent
1006
- kubectl apply -f - <<EOF
1007
- apiVersion: apps/v1
1008
- kind: Deployment
1009
- metadata:
1010
- name: compliance-agent
1011
- namespace: compliance
1012
- labels:
1013
- app: compliance
1014
- spec:
1015
- replicas: 2
1016
- selector:
1017
- matchLabels:
1018
- app: compliance
1019
- template:
1020
- metadata:
1021
- labels:
1022
- app: compliance
1023
- annotations:
1024
- prometheus.io/scrape: "true"
1025
- prometheus.io/port: "9090"
1026
- spec:
1027
- serviceAccountName: compliance-agent
1028
- containers:
1029
- - name: agent
1030
- image: registry.example.com/agents/compliance:2.1.0
1031
- env:
1032
- - name: COMPLIANCE_FRAMEWORKS
1033
- value: "pci-dss,soc2,gdpr"
1034
- - name: COST_LIMIT_DAILY_USD
1035
- value: "50.00"
1036
- - name: AUDIT_LOG_RETENTION_DAYS
1037
- value: "2555"
1038
- resources:
1039
- requests:
1040
- cpu: 500m
1041
- memory: 1Gi
1042
- limits:
1043
- cpu: 2000m
1044
- memory: 4Gi
1045
- volumeMounts:
1046
- - name: certs
1047
- mountPath: /etc/certs
1048
- readOnly: true
1049
- ports:
1050
- - containerPort: 8080
1051
- name: http
1052
- - containerPort: 9090
1053
- name: metrics
1054
- livenessProbe:
1055
- httpGet:
1056
- path: /health
1057
- port: 8080
1058
- initialDelaySeconds: 30
1059
- periodSeconds: 30
1060
- readinessProbe:
1061
- httpGet:
1062
- path: /ready
1063
- port: 8080
1064
- initialDelaySeconds: 10
1065
- periodSeconds: 10
1066
- volumes:
1067
- - name: certs
1068
- secret:
1069
- secretName: compliance-certs
1070
- ---
1071
- apiVersion: v1
1072
- kind: Service
1073
- metadata:
1074
- name: compliance-agent
1075
- namespace: compliance
1076
- spec:
1077
- selector:
1078
- app: compliance
1079
- ports:
1080
- - port: 8080
1081
- name: http
1082
- - port: 9090
1083
- name: metrics
1084
- EOF
1085
- ```
1086
-
1087
- ### Step 3: Configure RBAC
1088
-
1089
- ```yaml
1090
- apiVersion: v1
1091
- kind: ServiceAccount
1092
- metadata:
1093
- name: compliance-agent
1094
- namespace: compliance
1095
- ---
1096
- apiVersion: rbac.authorization.k8s.io/v1
1097
- kind: ClusterRole
1098
- metadata:
1099
- name: compliance-agent
1100
- rules:
1101
- - apiGroups: [""]
1102
- resources: ["pods", "services", "secrets", "configmaps", "persistentvolumeclaims"]
1103
- verbs: ["get", "list", "watch"]
1104
- - apiGroups: ["apps"]
1105
- resources: ["deployments", "statefulsets", "daemonsets"]
1106
- verbs: ["get", "list", "watch"]
1107
- - apiGroups: ["networking.k8s.io"]
1108
- resources: ["networkpolicies"]
1109
- verbs: ["get", "list", "watch"]
1110
- ---
1111
- apiVersion: rbac.authorization.k8s.io/v1
1112
- kind: ClusterRoleBinding
1113
- metadata:
1114
- name: compliance-agent
1115
- roleRef:
1116
- apiGroup: rbac.authorization.k8s.io
1117
- kind: ClusterRole
1118
- name: compliance-agent
1119
- subjects:
1120
- - kind: ServiceAccount
1121
- name: compliance-agent
1122
- namespace: compliance
1123
- ```
1124
-
1125
- ### Step 4: Verify Deployment
1126
-
1127
- ```bash
1128
- # Check agent status
1129
- kubectl get pods -n compliance
1130
-
1131
- # View logs
1132
- kubectl logs -n compliance deployment/compliance-agent -f
1133
-
1134
- # Check metrics
1135
- curl http://compliance-agent.compliance.svc.cluster.local:9090/metrics
1136
-
1137
- # Run test scan
1138
- kubectl exec -n compliance deployment/compliance-agent -- \
1139
- curl -X POST http://localhost:8080/v1/compliance/scan \
1140
- -H "Content-Type: application/json" \
1141
- -d '{"namespace": "default", "frameworks": ["pci-dss"]}'
1142
- ```
1143
-
1144
- ### Step 5: Configure Monitoring
1145
-
1146
- ```bash
1147
- # Add Prometheus scrape config
1148
- kubectl apply -f - <<EOF
1149
- apiVersion: v1
1150
- kind: ConfigMap
1151
- metadata:
1152
- name: prometheus-config
1153
- namespace: monitoring
1154
- data:
1155
- prometheus.yml: |
1156
- global:
1157
- scrape_interval: 15s
1158
- scrape_configs:
1159
- - job_name: 'compliance-agent'
1160
- kubernetes_sd_configs:
1161
- - role: pod
1162
- namespaces:
1163
- names:
1164
- - compliance
1165
- relabel_configs:
1166
- - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
1167
- action: keep
1168
- regex: true
1169
- EOF
1170
- ```
1171
-
1172
- ## Production Checklist
1173
-
1174
- - [ ] Secrets stored in Vault, not ConfigMaps
1175
- - [ ] Mutual TLS configured for all endpoints
1176
- - [ ] RBAC policies restricted to minimum required permissions
1177
- - [ ] Cost alerts configured in monitoring system
1178
- - [ ] Audit logs encrypted at rest
1179
- - [ ] Backup/disaster recovery plan tested
1180
- - [ ] High availability: Multiple replicas across zones
1181
- - [ ] Resource quotas configured
1182
- - [ ] Network policies enforced
1183
- - [ ] Compliance reports automatically archived to long-term storage
1184
-
1185
- ## Cost Management
1186
-
1187
- The agent enforces daily cost limits:
1188
- - **Daily budget**: $50 (configurable)
1189
- - **Alert threshold**: 80% of budget
1190
- - **Actions on limit**: Reduce scan frequency, disable non-critical scans, notify admin
1191
- - **Actual costs logged**: Every scan records actual cost for billing
1192
-
1193
- ## Security Considerations
1194
-
1195
- - All secrets managed via HashiCorp Vault
1196
- - Mutual TLS for all network communication
1197
- - Pod Security Standards: `restricted` profile enforced
1198
- - Network policies deny all traffic except allowed
1199
- - Audit logs encrypted with 7-year retention
1200
- - No auto-remediation without explicit approval for critical/high severity
1201
- - RBAC strictly enforced
1202
-
1203
- ## Further Reading
1204
-
1205
- - [PCI-DSS v4.0 Requirements](https://www.pcisecuritystandards.org/)
1206
- - [SOC2 Trust Service Criteria](https://www.aicpa.org/soc)
1207
- - [GDPR Compliance Guide](https://gdpr.eu/)
1208
- - [OSSA Runtime Documentation](https://openstandardagents.org/docs/runtime)