@trac3er/oh-my-god 2.0.4 → 2.0.7
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.
- package/.agents/skills/omg/AGENTS.fragment.md +57 -4
- package/.agents/skills/omg/algorithms/SKILL.md +11 -0
- package/.agents/skills/omg/algorithms/openai.yaml +11 -0
- package/.agents/skills/omg/api-twin/SKILL.md +11 -0
- package/.agents/skills/omg/api-twin/openai.yaml +12 -0
- package/.agents/skills/omg/claim-judge/SKILL.md +11 -0
- package/.agents/skills/omg/claim-judge/openai.yaml +13 -0
- package/.agents/skills/omg/codex-rules.md +33 -0
- package/.agents/skills/omg/control-plane/SKILL.md +1 -1
- package/.agents/skills/omg/control-plane/openai.yaml +1 -1
- package/.agents/skills/omg/data-lineage/SKILL.md +11 -0
- package/.agents/skills/omg/data-lineage/openai.yaml +12 -0
- package/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
- package/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
- package/.agents/skills/omg/eval-gate/SKILL.md +11 -0
- package/.agents/skills/omg/eval-gate/openai.yaml +12 -0
- package/.agents/skills/omg/health/SKILL.md +11 -0
- package/.agents/skills/omg/health/openai.yaml +11 -0
- package/.agents/skills/omg/hook-governor/SKILL.md +1 -1
- package/.agents/skills/omg/hook-governor/openai.yaml +1 -1
- package/.agents/skills/omg/incident-replay/SKILL.md +11 -0
- package/.agents/skills/omg/incident-replay/openai.yaml +12 -0
- package/.agents/skills/omg/lsp-pack/SKILL.md +1 -1
- package/.agents/skills/omg/lsp-pack/openai.yaml +1 -1
- package/.agents/skills/omg/mcp-fabric/SKILL.md +1 -1
- package/.agents/skills/omg/mcp-fabric/openai.yaml +1 -1
- package/.agents/skills/omg/plan-council/SKILL.md +11 -0
- package/.agents/skills/omg/plan-council/openai.yaml +12 -0
- package/.agents/skills/omg/preflight/SKILL.md +11 -0
- package/.agents/skills/omg/preflight/openai.yaml +12 -0
- package/.agents/skills/omg/proof-gate/SKILL.md +11 -0
- package/.agents/skills/omg/proof-gate/openai.yaml +13 -0
- package/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
- package/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
- package/.agents/skills/omg/robotics/SKILL.md +11 -0
- package/.agents/skills/omg/robotics/openai.yaml +11 -0
- package/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +1 -1
- package/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +1 -1
- package/.agents/skills/omg/security-check/SKILL.md +11 -0
- package/.agents/skills/omg/security-check/openai.yaml +13 -0
- package/.agents/skills/omg/test-intent-lock/SKILL.md +11 -0
- package/.agents/skills/omg/test-intent-lock/openai.yaml +13 -0
- package/.agents/skills/omg/tracebank/SKILL.md +11 -0
- package/.agents/skills/omg/tracebank/openai.yaml +12 -0
- package/.agents/skills/omg/vision/SKILL.md +11 -0
- package/.agents/skills/omg/vision/openai.yaml +11 -0
- package/.claude-plugin/marketplace.json +5 -5
- package/.claude-plugin/plugin.json +1 -1
- package/.claude-plugin/scripts/uninstall.sh +2 -2
- package/.mcp.json +0 -22
- package/CHANGELOG.md +13 -0
- package/OMG-setup.sh +64 -14
- package/OMG_COMPAT_CONTRACT.md +1 -1
- package/README.md +8 -6
- package/agents/omg-security-auditor.md +1 -1
- package/artifacts/release/.agents/skills/omg/AGENTS.fragment.md +52 -0
- package/artifacts/release/.agents/skills/omg/algorithms/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/algorithms/openai.yaml +11 -0
- package/artifacts/release/.agents/skills/omg/api-twin/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/api-twin/openai.yaml +12 -0
- package/artifacts/release/.agents/skills/omg/codex-mcp.toml +4 -0
- package/artifacts/release/.agents/skills/omg/codex-rules.md +29 -0
- package/artifacts/release/.agents/skills/omg/control-plane/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/control-plane/openai.yaml +14 -0
- package/artifacts/release/.agents/skills/omg/data-lineage/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/data-lineage/openai.yaml +12 -0
- package/artifacts/release/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
- package/artifacts/release/.agents/skills/omg/eval-gate/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/eval-gate/openai.yaml +12 -0
- package/artifacts/release/.agents/skills/omg/health/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/health/openai.yaml +11 -0
- package/artifacts/release/.agents/skills/omg/hook-governor/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/hook-governor/openai.yaml +11 -0
- package/artifacts/release/.agents/skills/omg/incident-replay/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/incident-replay/openai.yaml +12 -0
- package/artifacts/release/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
- package/artifacts/release/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
- package/artifacts/release/.agents/skills/omg/preflight/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/preflight/openai.yaml +12 -0
- package/artifacts/release/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
- package/artifacts/release/.agents/skills/omg/robotics/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/robotics/openai.yaml +11 -0
- package/artifacts/release/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
- package/artifacts/release/.agents/skills/omg/security-check/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/security-check/openai.yaml +13 -0
- package/artifacts/release/.agents/skills/omg/tracebank/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/tracebank/openai.yaml +12 -0
- package/artifacts/release/.agents/skills/omg/vision/SKILL.md +11 -0
- package/artifacts/release/.agents/skills/omg/vision/openai.yaml +11 -0
- package/artifacts/release/.claude-plugin/marketplace.json +36 -0
- package/artifacts/release/.claude-plugin/plugin.json +23 -0
- package/artifacts/release/.mcp.json +40 -0
- package/artifacts/release/OMG_COMPAT_CONTRACT.md +92 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/AGENTS.fragment.md +52 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/algorithms/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/algorithms/openai.yaml +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/api-twin/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/api-twin/openai.yaml +12 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/codex-mcp.toml +4 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/codex-rules.md +29 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/control-plane/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/control-plane/openai.yaml +14 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/data-lineage/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/data-lineage/openai.yaml +12 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/eval-gate/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/eval-gate/openai.yaml +12 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/health/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/health/openai.yaml +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/hook-governor/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/hook-governor/openai.yaml +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/incident-replay/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/incident-replay/openai.yaml +12 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/preflight/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/preflight/openai.yaml +12 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/robotics/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/robotics/openai.yaml +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/security-check/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/security-check/openai.yaml +13 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/tracebank/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/tracebank/openai.yaml +12 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/vision/SKILL.md +11 -0
- package/artifacts/release/dist/enterprise/bundle/.agents/skills/omg/vision/openai.yaml +11 -0
- package/artifacts/release/dist/enterprise/bundle/OMG_COMPAT_CONTRACT.md +92 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/algorithms.yaml +45 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/api-twin.yaml +48 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/control-plane.yaml +151 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/data-lineage.yaml +47 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/delta-classifier.yaml +47 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/eval-gate.yaml +47 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/health.yaml +45 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/hook-governor.yaml +97 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/incident-replay.yaml +47 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/lsp-pack.yaml +48 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/mcp-fabric.yaml +53 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/preflight.yaml +48 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/remote-supervisor.yaml +49 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/robotics.yaml +45 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/secure-worktree-pipeline.yaml +54 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/security-check.yaml +50 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/tracebank.yaml +47 -0
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/vision.yaml +45 -0
- package/artifacts/release/dist/enterprise/bundle/registry/omg-capability.schema.json +296 -0
- package/artifacts/release/dist/enterprise/manifest.json +243 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/AGENTS.fragment.md +7 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/algorithms/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/algorithms/openai.yaml +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/api-twin/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/api-twin/openai.yaml +12 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/codex-mcp.toml +4 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/control-plane/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/control-plane/openai.yaml +14 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/data-lineage/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/data-lineage/openai.yaml +12 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/eval-gate/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/eval-gate/openai.yaml +12 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/health/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/health/openai.yaml +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/hook-governor/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/hook-governor/openai.yaml +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/incident-replay/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/incident-replay/openai.yaml +12 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/preflight/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/preflight/openai.yaml +12 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/robotics/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/robotics/openai.yaml +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/security-check/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/security-check/openai.yaml +13 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/tracebank/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/tracebank/openai.yaml +12 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/vision/SKILL.md +11 -0
- package/artifacts/release/dist/public/bundle/.agents/skills/omg/vision/openai.yaml +11 -0
- package/artifacts/release/dist/public/bundle/.claude-plugin/marketplace.json +36 -0
- package/artifacts/release/dist/public/bundle/.claude-plugin/plugin.json +23 -0
- package/artifacts/release/dist/public/bundle/.mcp.json +40 -0
- package/artifacts/release/dist/public/bundle/OMG_COMPAT_CONTRACT.md +92 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/algorithms.yaml +45 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/api-twin.yaml +48 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/control-plane.yaml +151 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/data-lineage.yaml +47 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/delta-classifier.yaml +47 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/eval-gate.yaml +47 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/health.yaml +45 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/hook-governor.yaml +97 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/incident-replay.yaml +47 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/lsp-pack.yaml +48 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/mcp-fabric.yaml +53 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/preflight.yaml +48 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/remote-supervisor.yaml +49 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/robotics.yaml +45 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/secure-worktree-pipeline.yaml +54 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/security-check.yaml +50 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/tracebank.yaml +47 -0
- package/artifacts/release/dist/public/bundle/registry/bundles/vision.yaml +45 -0
- package/artifacts/release/dist/public/bundle/registry/omg-capability.schema.json +296 -0
- package/artifacts/release/dist/public/bundle/settings.json +526 -0
- package/artifacts/release/dist/public/manifest.json +255 -0
- package/artifacts/release/registry/bundles/algorithms.yaml +45 -0
- package/artifacts/release/registry/bundles/api-twin.yaml +48 -0
- package/artifacts/release/registry/bundles/control-plane.yaml +151 -0
- package/artifacts/release/registry/bundles/data-lineage.yaml +47 -0
- package/artifacts/release/registry/bundles/delta-classifier.yaml +47 -0
- package/artifacts/release/registry/bundles/eval-gate.yaml +47 -0
- package/artifacts/release/registry/bundles/health.yaml +45 -0
- package/artifacts/release/registry/bundles/hook-governor.yaml +97 -0
- package/artifacts/release/registry/bundles/incident-replay.yaml +47 -0
- package/artifacts/release/registry/bundles/lsp-pack.yaml +48 -0
- package/artifacts/release/registry/bundles/mcp-fabric.yaml +53 -0
- package/artifacts/release/registry/bundles/preflight.yaml +48 -0
- package/artifacts/release/registry/bundles/remote-supervisor.yaml +49 -0
- package/artifacts/release/registry/bundles/robotics.yaml +45 -0
- package/artifacts/release/registry/bundles/secure-worktree-pipeline.yaml +54 -0
- package/artifacts/release/registry/bundles/security-check.yaml +50 -0
- package/artifacts/release/registry/bundles/tracebank.yaml +47 -0
- package/artifacts/release/registry/bundles/vision.yaml +45 -0
- package/artifacts/release/registry/omg-capability.schema.json +296 -0
- package/artifacts/release/settings.json +594 -0
- package/build/lib/agents/__init__.py +1 -0
- package/build/lib/agents/designer.md +67 -0
- package/build/lib/agents/explore.md +60 -0
- package/build/lib/agents/model_roles.py +196 -0
- package/build/lib/agents/omg-api-builder.md +23 -0
- package/build/lib/agents/omg-architect-mode.md +41 -0
- package/build/lib/agents/omg-architect.md +13 -0
- package/build/lib/agents/omg-backend-engineer.md +41 -0
- package/build/lib/agents/omg-critic.md +16 -0
- package/build/lib/agents/omg-database-engineer.md +41 -0
- package/build/lib/agents/omg-escalation-router.md +17 -0
- package/build/lib/agents/omg-executor.md +12 -0
- package/build/lib/agents/omg-frontend-designer.md +41 -0
- package/build/lib/agents/omg-implement-mode.md +49 -0
- package/build/lib/agents/omg-infra-engineer.md +41 -0
- package/build/lib/agents/omg-qa-tester.md +16 -0
- package/build/lib/agents/omg-research-mode.md +41 -0
- package/build/lib/agents/omg-security-auditor.md +41 -0
- package/build/lib/agents/omg-testing-engineer.md +41 -0
- package/build/lib/agents/plan.md +80 -0
- package/build/lib/agents/quick_task.md +64 -0
- package/build/lib/agents/reviewer.md +83 -0
- package/build/lib/agents/task.md +71 -0
- package/build/lib/commands/OMG:ai-commit.md +113 -0
- package/build/lib/commands/OMG:api-twin.md +22 -0
- package/build/lib/commands/OMG:arch.md +313 -0
- package/build/lib/commands/OMG:ccg.md +22 -0
- package/build/lib/commands/OMG:compat.md +57 -0
- package/build/lib/commands/OMG:cost.md +181 -0
- package/build/lib/commands/OMG:crazy.md +125 -0
- package/build/lib/commands/OMG:create-agent.md +183 -0
- package/build/lib/commands/OMG:deps.md +248 -0
- package/build/lib/commands/OMG:doctor.md +37 -0
- package/build/lib/commands/OMG:domain-init.md +11 -0
- package/build/lib/commands/OMG:escalate.md +52 -0
- package/build/lib/commands/OMG:health-check.md +45 -0
- package/build/lib/commands/OMG:init.md +134 -0
- package/build/lib/commands/OMG:mode.md +44 -0
- package/build/lib/commands/OMG:preflight.md +26 -0
- package/build/lib/commands/OMG:project-init.md +11 -0
- package/build/lib/commands/OMG:ralph-start.md +43 -0
- package/build/lib/commands/OMG:ralph-stop.md +23 -0
- package/build/lib/commands/OMG:security-check.md +28 -0
- package/build/lib/commands/OMG:session-branch.md +85 -0
- package/build/lib/commands/OMG:session-fork.md +53 -0
- package/build/lib/commands/OMG:session-merge.md +134 -0
- package/build/lib/commands/OMG:setup.md +78 -0
- package/build/lib/commands/OMG:stats.md +225 -0
- package/build/lib/commands/OMG:teams.md +39 -0
- package/build/lib/commands/OMG:theme.md +44 -0
- package/build/lib/commands/__init__.py +1 -0
- package/build/lib/control_plane/__init__.py +2 -0
- package/build/lib/control_plane/openapi.yaml +260 -0
- package/build/lib/control_plane/server.py +147 -0
- package/build/lib/control_plane/service.py +222 -0
- package/build/lib/hooks/__init__.py +0 -0
- package/build/lib/hooks/_agent_registry.py +423 -0
- package/build/lib/hooks/_analytics.py +291 -0
- package/build/lib/hooks/_budget.py +31 -0
- package/build/lib/hooks/_common.py +569 -0
- package/build/lib/hooks/_compression_optimizer.py +119 -0
- package/build/lib/hooks/_cost_ledger.py +176 -0
- package/build/lib/hooks/_learnings.py +126 -0
- package/build/lib/hooks/_memory.py +103 -0
- package/build/lib/hooks/_protected_context.py +150 -0
- package/build/lib/hooks/_token_counter.py +221 -0
- package/build/lib/hooks/branch_manager.py +236 -0
- package/build/lib/hooks/budget_governor.py +232 -0
- package/build/lib/hooks/circuit-breaker.py +270 -0
- package/build/lib/hooks/compression_feedback.py +254 -0
- package/build/lib/hooks/config-guard.py +216 -0
- package/build/lib/hooks/context_pressure.py +53 -0
- package/build/lib/hooks/credential_store.py +1020 -0
- package/build/lib/hooks/fetch-rate-limits.py +212 -0
- package/build/lib/hooks/firewall.py +48 -0
- package/build/lib/hooks/hashline-formatter-bridge.py +224 -0
- package/build/lib/hooks/hashline-injector.py +273 -0
- package/build/lib/hooks/hashline-validator.py +216 -0
- package/build/lib/hooks/idle-detector.py +95 -0
- package/build/lib/hooks/intentgate-keyword-detector.py +188 -0
- package/build/lib/hooks/magic-keyword-router.py +195 -0
- package/build/lib/hooks/policy_engine.py +641 -0
- package/build/lib/hooks/post-tool-failure.py +19 -0
- package/build/lib/hooks/post-write.py +219 -0
- package/build/lib/hooks/post_write.py +46 -0
- package/build/lib/hooks/pre-compact.py +398 -0
- package/build/lib/hooks/pre-tool-inject.py +98 -0
- package/build/lib/hooks/prompt-enhancer.py +672 -0
- package/build/lib/hooks/quality-runner.py +191 -0
- package/build/lib/hooks/query.py +512 -0
- package/build/lib/hooks/secret-guard.py +61 -0
- package/build/lib/hooks/secret_audit.py +144 -0
- package/build/lib/hooks/security_validators.py +75 -0
- package/build/lib/hooks/session-end-capture.py +137 -0
- package/build/lib/hooks/session-start.py +277 -0
- package/build/lib/hooks/setup_wizard.py +646 -0
- package/build/lib/hooks/shadow_manager.py +344 -0
- package/build/lib/hooks/state_migration.py +225 -0
- package/build/lib/hooks/stop-gate.py +7 -0
- package/build/lib/hooks/stop_dispatcher.py +945 -0
- package/build/lib/hooks/test-validator.py +361 -0
- package/build/lib/hooks/test_generator_hook.py +123 -0
- package/build/lib/hooks/todo-state-tracker.py +114 -0
- package/build/lib/hooks/tool-ledger.py +149 -0
- package/build/lib/hooks/trust_review.py +585 -0
- package/build/lib/plugins/README.md +60 -0
- package/build/lib/plugins/__init__.py +1 -0
- package/build/lib/plugins/advanced/commands/OMG:code-review.md +114 -0
- package/build/lib/plugins/advanced/commands/OMG:deep-plan.md +265 -0
- package/build/lib/plugins/advanced/commands/OMG:handoff.md +115 -0
- package/build/lib/plugins/advanced/commands/OMG:learn.md +110 -0
- package/build/lib/plugins/advanced/commands/OMG:maintainer.md +31 -0
- package/build/lib/plugins/advanced/commands/OMG:ralph-start.md +43 -0
- package/build/lib/plugins/advanced/commands/OMG:ralph-stop.md +23 -0
- package/build/lib/plugins/advanced/commands/OMG:security-review.md +16 -0
- package/build/lib/plugins/advanced/commands/OMG:sequential-thinking.md +20 -0
- package/build/lib/plugins/advanced/commands/OMG:ship.md +46 -0
- package/build/lib/plugins/advanced/plugin.json +87 -0
- package/build/lib/plugins/core/plugin.json +145 -0
- package/build/lib/plugins/dephealth/__init__.py +0 -0
- package/build/lib/plugins/dephealth/cve_scanner.py +188 -0
- package/build/lib/plugins/dephealth/license_checker.py +135 -0
- package/build/lib/plugins/dephealth/manifest_detector.py +423 -0
- package/build/lib/plugins/dephealth/vuln_analyzer.py +169 -0
- package/build/lib/plugins/testgen/__init__.py +0 -0
- package/build/lib/plugins/testgen/codamosa_engine.py +402 -0
- package/build/lib/plugins/testgen/edge_case_synthesizer.py +184 -0
- package/build/lib/plugins/testgen/framework_detector.py +271 -0
- package/build/lib/plugins/testgen/skeleton_generator.py +219 -0
- package/build/lib/plugins/viz/__init__.py +0 -0
- package/build/lib/plugins/viz/ast_parser.py +139 -0
- package/build/lib/plugins/viz/diagram_generator.py +192 -0
- package/build/lib/plugins/viz/graph_builder.py +444 -0
- package/build/lib/plugins/viz/native_parsers.py +259 -0
- package/build/lib/plugins/viz/regex_parser.py +112 -0
- package/build/lib/registry/__init__.py +1 -0
- package/build/lib/registry/bundles/algorithms.yaml +45 -0
- package/build/lib/registry/bundles/api-twin.yaml +48 -0
- package/build/lib/registry/bundles/claim-judge.yaml +49 -0
- package/build/lib/registry/bundles/control-plane.yaml +151 -0
- package/build/lib/registry/bundles/data-lineage.yaml +47 -0
- package/build/lib/registry/bundles/delta-classifier.yaml +47 -0
- package/build/lib/registry/bundles/eval-gate.yaml +47 -0
- package/build/lib/registry/bundles/health.yaml +45 -0
- package/build/lib/registry/bundles/hook-governor.yaml +97 -0
- package/build/lib/registry/bundles/incident-replay.yaml +47 -0
- package/build/lib/registry/bundles/lsp-pack.yaml +48 -0
- package/build/lib/registry/bundles/mcp-fabric.yaml +53 -0
- package/build/lib/registry/bundles/plan-council.yaml +51 -0
- package/build/lib/registry/bundles/preflight.yaml +48 -0
- package/build/lib/registry/bundles/proof-gate.yaml +49 -0
- package/build/lib/registry/bundles/remote-supervisor.yaml +49 -0
- package/build/lib/registry/bundles/robotics.yaml +45 -0
- package/build/lib/registry/bundles/secure-worktree-pipeline.yaml +54 -0
- package/build/lib/registry/bundles/security-check.yaml +50 -0
- package/build/lib/registry/bundles/test-intent-lock.yaml +49 -0
- package/build/lib/registry/bundles/tracebank.yaml +47 -0
- package/build/lib/registry/bundles/vision.yaml +45 -0
- package/build/lib/registry/omg-capability.schema.json +296 -0
- package/build/lib/registry/verify_artifact.py +90 -0
- package/build/lib/runtime/__init__.py +32 -0
- package/build/lib/runtime/adapters/__init__.py +13 -0
- package/build/lib/runtime/adapters/claude.py +63 -0
- package/build/lib/runtime/adapters/gpt.py +56 -0
- package/build/lib/runtime/adapters/local.py +56 -0
- package/build/lib/runtime/adoption.py +212 -0
- package/build/lib/runtime/api_twin.py +450 -0
- package/build/lib/runtime/asset_loader.py +62 -0
- package/build/lib/runtime/business_workflow.py +234 -0
- package/build/lib/runtime/claim_judge.py +95 -0
- package/build/lib/runtime/cli_provider.py +85 -0
- package/build/lib/runtime/compat.py +1459 -0
- package/build/lib/runtime/contract_compiler.py +1918 -0
- package/build/lib/runtime/custom_agent_loader.py +366 -0
- package/build/lib/runtime/data_lineage.py +73 -0
- package/build/lib/runtime/delta_classifier.py +81 -0
- package/build/lib/runtime/dispatcher.py +47 -0
- package/build/lib/runtime/domain_packs.py +46 -0
- package/build/lib/runtime/ecosystem.py +371 -0
- package/build/lib/runtime/eval_gate.py +96 -0
- package/build/lib/runtime/guide_assert.py +45 -0
- package/build/lib/runtime/incident_replay.py +47 -0
- package/build/lib/runtime/legacy_compat.py +7 -0
- package/build/lib/runtime/mcp_config_writers.py +233 -0
- package/build/lib/runtime/mcp_lifecycle.py +175 -0
- package/build/lib/runtime/mcp_memory_server.py +135 -0
- package/build/lib/runtime/memory_parsers/__init__.py +0 -0
- package/build/lib/runtime/memory_parsers/chatgpt_parser.py +257 -0
- package/build/lib/runtime/memory_parsers/claude_import.py +107 -0
- package/build/lib/runtime/memory_parsers/export.py +97 -0
- package/build/lib/runtime/memory_parsers/gemini_import.py +91 -0
- package/build/lib/runtime/memory_parsers/kimi_import.py +91 -0
- package/build/lib/runtime/memory_store.py +215 -0
- package/build/lib/runtime/omc_compat.py +7 -0
- package/build/lib/runtime/omg_compat_contract_snapshot.json +916 -0
- package/build/lib/runtime/omg_contract_snapshot.json +916 -0
- package/build/lib/runtime/omg_mcp_server.py +212 -0
- package/build/lib/runtime/playwright_pack.py +169 -0
- package/build/lib/runtime/preflight.py +117 -0
- package/build/lib/runtime/proof_chain.py +228 -0
- package/build/lib/runtime/proof_gate.py +163 -0
- package/build/lib/runtime/providers/__init__.py +0 -0
- package/build/lib/runtime/providers/codex_provider.py +102 -0
- package/build/lib/runtime/providers/gemini_provider.py +109 -0
- package/build/lib/runtime/providers/kimi_provider.py +132 -0
- package/build/lib/runtime/remote_supervisor.py +64 -0
- package/build/lib/runtime/runtime_profile.py +61 -0
- package/build/lib/runtime/security_check.py +965 -0
- package/build/lib/runtime/subagent_dispatcher.py +469 -0
- package/build/lib/runtime/team_router.py +1167 -0
- package/build/lib/runtime/test_intent_lock.py +91 -0
- package/build/lib/runtime/tmux_session_manager.py +169 -0
- package/build/lib/runtime/tracebank.py +95 -0
- package/build/lib/runtime/untrusted_content.py +269 -0
- package/commands/OMG:doctor.md +37 -0
- package/commands/OMG:preflight.md +1 -1
- package/commands/__init__.py +1 -0
- package/control_plane/__init__.py +2 -0
- package/control_plane/openapi.yaml +260 -0
- package/control_plane/server.py +147 -0
- package/control_plane/service.py +222 -0
- package/dist/enterprise/bundle/.agents/skills/omg/AGENTS.fragment.md +50 -3
- package/dist/enterprise/bundle/.agents/skills/omg/algorithms/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/algorithms/openai.yaml +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/api-twin/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/api-twin/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/codex-rules.md +29 -0
- package/dist/enterprise/bundle/.agents/skills/omg/data-lineage/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/data-lineage/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/eval-gate/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/eval-gate/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/health/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/health/openai.yaml +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/incident-replay/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/incident-replay/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/preflight/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/preflight/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/robotics/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/robotics/openai.yaml +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/security-check/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/security-check/openai.yaml +13 -0
- package/dist/enterprise/bundle/.agents/skills/omg/tracebank/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/tracebank/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/vision/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/vision/openai.yaml +11 -0
- package/dist/enterprise/bundle/.claude-plugin/marketplace.json +5 -5
- package/dist/enterprise/bundle/.claude-plugin/plugin.json +1 -1
- package/dist/enterprise/bundle/OMG_COMPAT_CONTRACT.md +1 -1
- package/dist/enterprise/bundle/plugins/advanced/commands/OMG:code-review.md +114 -0
- package/dist/enterprise/bundle/plugins/advanced/commands/OMG:deep-plan.md +221 -0
- package/dist/enterprise/bundle/plugins/advanced/commands/OMG:handoff.md +115 -0
- package/dist/enterprise/bundle/plugins/advanced/commands/OMG:learn.md +110 -0
- package/dist/enterprise/bundle/plugins/advanced/commands/OMG:maintainer.md +31 -0
- package/dist/enterprise/bundle/plugins/advanced/commands/OMG:ralph-start.md +43 -0
- package/dist/enterprise/bundle/plugins/advanced/commands/OMG:ralph-stop.md +23 -0
- package/dist/enterprise/bundle/plugins/advanced/commands/OMG:security-review.md +16 -0
- package/dist/enterprise/bundle/plugins/advanced/commands/OMG:sequential-thinking.md +20 -0
- package/dist/enterprise/bundle/plugins/advanced/commands/OMG:ship.md +46 -0
- package/dist/enterprise/bundle/plugins/advanced/plugin.json +87 -0
- package/dist/enterprise/bundle/registry/bundles/algorithms.yaml +45 -0
- package/dist/enterprise/bundle/registry/bundles/api-twin.yaml +48 -0
- package/dist/enterprise/bundle/registry/bundles/control-plane.yaml +151 -0
- package/dist/enterprise/bundle/registry/bundles/data-lineage.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/delta-classifier.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/eval-gate.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/health.yaml +45 -0
- package/dist/enterprise/bundle/registry/bundles/hook-governor.yaml +97 -0
- package/dist/enterprise/bundle/registry/bundles/incident-replay.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/lsp-pack.yaml +48 -0
- package/dist/enterprise/bundle/registry/bundles/mcp-fabric.yaml +53 -0
- package/dist/enterprise/bundle/registry/bundles/preflight.yaml +48 -0
- package/dist/enterprise/bundle/registry/bundles/remote-supervisor.yaml +49 -0
- package/dist/enterprise/bundle/registry/bundles/robotics.yaml +45 -0
- package/dist/enterprise/bundle/registry/bundles/secure-worktree-pipeline.yaml +54 -0
- package/dist/enterprise/bundle/registry/bundles/security-check.yaml +50 -0
- package/dist/enterprise/bundle/registry/bundles/tracebank.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/vision.yaml +45 -0
- package/dist/enterprise/bundle/registry/omg-capability.schema.json +296 -0
- package/dist/enterprise/bundle/settings.json +233 -5
- package/dist/enterprise/manifest.json +216 -12
- package/dist/public/bundle/.agents/skills/omg/AGENTS.fragment.md +50 -3
- package/dist/public/bundle/.agents/skills/omg/algorithms/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/algorithms/openai.yaml +11 -0
- package/dist/public/bundle/.agents/skills/omg/api-twin/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/api-twin/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/codex-rules.md +29 -0
- package/dist/public/bundle/.agents/skills/omg/data-lineage/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/data-lineage/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/eval-gate/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/eval-gate/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/health/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/health/openai.yaml +11 -0
- package/dist/public/bundle/.agents/skills/omg/incident-replay/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/incident-replay/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/preflight/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/preflight/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/robotics/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/robotics/openai.yaml +11 -0
- package/dist/public/bundle/.agents/skills/omg/security-check/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/security-check/openai.yaml +13 -0
- package/dist/public/bundle/.agents/skills/omg/tracebank/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/tracebank/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/vision/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/vision/openai.yaml +11 -0
- package/dist/public/bundle/.claude-plugin/marketplace.json +5 -5
- package/dist/public/bundle/.claude-plugin/plugin.json +1 -1
- package/dist/public/bundle/OMG_COMPAT_CONTRACT.md +1 -1
- package/dist/public/bundle/plugins/advanced/commands/OMG:code-review.md +114 -0
- package/dist/public/bundle/plugins/advanced/commands/OMG:deep-plan.md +221 -0
- package/dist/public/bundle/plugins/advanced/commands/OMG:handoff.md +115 -0
- package/dist/public/bundle/plugins/advanced/commands/OMG:learn.md +110 -0
- package/dist/public/bundle/plugins/advanced/commands/OMG:maintainer.md +31 -0
- package/dist/public/bundle/plugins/advanced/commands/OMG:ralph-start.md +43 -0
- package/dist/public/bundle/plugins/advanced/commands/OMG:ralph-stop.md +23 -0
- package/dist/public/bundle/plugins/advanced/commands/OMG:security-review.md +16 -0
- package/dist/public/bundle/plugins/advanced/commands/OMG:sequential-thinking.md +20 -0
- package/dist/public/bundle/plugins/advanced/commands/OMG:ship.md +46 -0
- package/dist/public/bundle/plugins/advanced/plugin.json +87 -0
- package/dist/public/bundle/registry/bundles/algorithms.yaml +45 -0
- package/dist/public/bundle/registry/bundles/api-twin.yaml +48 -0
- package/dist/public/bundle/registry/bundles/control-plane.yaml +151 -0
- package/dist/public/bundle/registry/bundles/data-lineage.yaml +47 -0
- package/dist/public/bundle/registry/bundles/delta-classifier.yaml +47 -0
- package/dist/public/bundle/registry/bundles/eval-gate.yaml +47 -0
- package/dist/public/bundle/registry/bundles/health.yaml +45 -0
- package/dist/public/bundle/registry/bundles/hook-governor.yaml +97 -0
- package/dist/public/bundle/registry/bundles/incident-replay.yaml +47 -0
- package/dist/public/bundle/registry/bundles/lsp-pack.yaml +48 -0
- package/dist/public/bundle/registry/bundles/mcp-fabric.yaml +53 -0
- package/dist/public/bundle/registry/bundles/preflight.yaml +48 -0
- package/dist/public/bundle/registry/bundles/remote-supervisor.yaml +49 -0
- package/dist/public/bundle/registry/bundles/robotics.yaml +45 -0
- package/dist/public/bundle/registry/bundles/secure-worktree-pipeline.yaml +54 -0
- package/dist/public/bundle/registry/bundles/security-check.yaml +50 -0
- package/dist/public/bundle/registry/bundles/tracebank.yaml +47 -0
- package/dist/public/bundle/registry/bundles/vision.yaml +45 -0
- package/dist/public/bundle/registry/omg-capability.schema.json +296 -0
- package/dist/public/bundle/settings.json +232 -4
- package/dist/public/manifest.json +216 -12
- package/docs/assets/omg-hud.svg +32 -0
- package/docs/install/claude-code.md +31 -0
- package/docs/install/codex.md +29 -0
- package/docs/migration/native-adoption.md +57 -0
- package/docs/proof.md +65 -0
- package/docs/release-checklist.md +40 -0
- package/docs/transcripts/crazy.md +17 -0
- package/docs/transcripts/setup.md +25 -0
- package/hooks/policy_engine.py +122 -17
- package/hooks/setup_wizard.py +52 -12
- package/hooks/shadow_manager.py +27 -0
- package/package.json +2 -2
- package/plugins/README.md +5 -1
- package/plugins/__init__.py +1 -0
- package/plugins/advanced/commands/OMG:deep-plan.md +50 -6
- package/plugins/advanced/commands/OMG:ship.md +1 -1
- package/plugins/advanced/plugin.json +1 -10
- package/plugins/core/plugin.json +7 -1
- package/pyproject.toml +39 -3
- package/registry/__init__.py +1 -0
- package/registry/bundles/algorithms.yaml +45 -0
- package/registry/bundles/api-twin.yaml +48 -0
- package/registry/bundles/claim-judge.yaml +49 -0
- package/registry/bundles/control-plane.yaml +151 -0
- package/registry/bundles/data-lineage.yaml +47 -0
- package/registry/bundles/delta-classifier.yaml +47 -0
- package/registry/bundles/eval-gate.yaml +47 -0
- package/registry/bundles/health.yaml +45 -0
- package/registry/bundles/hook-governor.yaml +97 -0
- package/registry/bundles/incident-replay.yaml +47 -0
- package/registry/bundles/lsp-pack.yaml +48 -0
- package/registry/bundles/mcp-fabric.yaml +53 -0
- package/registry/bundles/plan-council.yaml +51 -0
- package/registry/bundles/preflight.yaml +48 -0
- package/registry/bundles/proof-gate.yaml +49 -0
- package/registry/bundles/remote-supervisor.yaml +49 -0
- package/registry/bundles/robotics.yaml +45 -0
- package/registry/bundles/secure-worktree-pipeline.yaml +54 -0
- package/registry/bundles/security-check.yaml +50 -0
- package/registry/bundles/test-intent-lock.yaml +49 -0
- package/registry/bundles/tracebank.yaml +47 -0
- package/registry/bundles/vision.yaml +45 -0
- package/registry/omg-capability.schema.json +296 -0
- package/registry/verify_artifact.py +90 -0
- package/runtime/adapters/claude.py +3 -0
- package/runtime/adapters/gpt.py +3 -0
- package/runtime/adapters/local.py +3 -0
- package/runtime/adoption.py +1 -1
- package/runtime/api_twin.py +334 -14
- package/runtime/asset_loader.py +62 -0
- package/runtime/business_workflow.py +14 -0
- package/runtime/claim_judge.py +95 -0
- package/runtime/compat.py +142 -2
- package/runtime/contract_compiler.py +1270 -50
- package/runtime/data_lineage.py +73 -0
- package/runtime/delta_classifier.py +81 -0
- package/runtime/domain_packs.py +12 -0
- package/runtime/ecosystem.py +1 -1
- package/runtime/eval_gate.py +96 -0
- package/runtime/incident_replay.py +47 -0
- package/runtime/mcp_config_writers.py +12 -0
- package/runtime/mcp_lifecycle.py +31 -9
- package/runtime/mcp_memory_server.py +1 -1
- package/runtime/omg_compat_contract_snapshot.json +1 -1
- package/runtime/omg_contract_snapshot.json +1 -1
- package/runtime/omg_mcp_server.py +16 -9
- package/runtime/playwright_pack.py +169 -0
- package/runtime/preflight.py +66 -1
- package/runtime/proof_chain.py +228 -0
- package/runtime/proof_gate.py +163 -0
- package/runtime/remote_supervisor.py +64 -0
- package/runtime/security_check.py +626 -8
- package/runtime/team_router.py +6 -6
- package/runtime/test_intent_lock.py +91 -0
- package/runtime/tracebank.py +95 -0
- package/runtime/untrusted_content.py +172 -5
- package/scripts/check-omg-public-ready.py +77 -0
- package/scripts/omg.py +207 -3
- package/scripts/verify-standalone.sh +7 -0
- package/settings.json +233 -5
|
@@ -0,0 +1,965 @@
|
|
|
1
|
+
"""Canonical OMG security check engine."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import ast
|
|
5
|
+
from collections import Counter
|
|
6
|
+
from datetime import datetime, timezone
|
|
7
|
+
from hashlib import sha256
|
|
8
|
+
import json
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
import re
|
|
11
|
+
import subprocess
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
from hooks.security_validators import ensure_path_within_dir
|
|
15
|
+
from plugins.dephealth.cve_scanner import scan_for_cves
|
|
16
|
+
from plugins.dephealth.license_checker import check_license_compatibility
|
|
17
|
+
from plugins.dephealth.manifest_detector import detect_manifests
|
|
18
|
+
from plugins.dephealth.vuln_analyzer import analyze_reachability
|
|
19
|
+
from runtime.adoption import CANONICAL_VERSION
|
|
20
|
+
from runtime.delta_classifier import classify_project_changes
|
|
21
|
+
from runtime.tracebank import record_trace
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
SEVERITY_ORDER = {
|
|
25
|
+
"critical": 0,
|
|
26
|
+
"high": 1,
|
|
27
|
+
"medium": 2,
|
|
28
|
+
"low": 3,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_PYTHON_AST_RULES: tuple[tuple[str, str, str, str], ...] = (
|
|
32
|
+
("B602", "subprocess-shell-true", "high", "Avoid shell=True in subprocess calls."),
|
|
33
|
+
("B307", "eval-use", "high", "Replace eval with explicit parsing."),
|
|
34
|
+
("B102", "exec-use", "high", "Replace exec with explicit control flow."),
|
|
35
|
+
("B301", "pickle-load", "high", "Avoid unsafe deserialization of pickle payloads."),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
_SECRET_PATTERNS: tuple[tuple[str, re.Pattern[str], str, str], ...] = (
|
|
39
|
+
("SEC001", re.compile(r"AKIA[0-9A-Z]{16}"), "high", "AWS access key-like token detected."),
|
|
40
|
+
("SEC002", re.compile(r"-----BEGIN (?:RSA|EC|OPENSSH|DSA) PRIVATE KEY-----"), "critical", "Private key material detected."),
|
|
41
|
+
(
|
|
42
|
+
"SEC003",
|
|
43
|
+
re.compile(r"(?i)(?:secret|api[_-]?key|token|password)\s*[:=]\s*['\"][A-Za-z0-9_\-\+/=]{12,}['\"]"),
|
|
44
|
+
"high",
|
|
45
|
+
"Hard-coded secret-like credential detected.",
|
|
46
|
+
),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
_CONFIG_PATTERNS: tuple[tuple[str, re.Pattern[str], str, str], ...] = (
|
|
50
|
+
("CFG001", re.compile(r"0\.0\.0\.0/0"), "high", "Wildcard ingress rule detected."),
|
|
51
|
+
("CFG002", re.compile(r"(?i)verify\s*=\s*false"), "high", "TLS verification appears disabled."),
|
|
52
|
+
("CFG003", re.compile(r"(?i)(?:ssl_verify|verify_ssl)\s*[:=]\s*false"), "high", "TLS verification appears disabled."),
|
|
53
|
+
("CFG004", re.compile(r"(?i)allow_privilege_escalation\s*[:=]\s*true"), "high", "Privilege escalation enabled in runtime policy."),
|
|
54
|
+
("CFG005", re.compile(r"(?i)publicly_accessible\s*=\s*true"), "medium", "Publicly accessible infrastructure flag enabled."),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
_CONFIG_FILE_HINTS = (
|
|
58
|
+
".tf",
|
|
59
|
+
".tfvars",
|
|
60
|
+
".yaml",
|
|
61
|
+
".yml",
|
|
62
|
+
".json",
|
|
63
|
+
".env",
|
|
64
|
+
"dockerfile",
|
|
65
|
+
"kustomization",
|
|
66
|
+
"helm",
|
|
67
|
+
"policy",
|
|
68
|
+
"config",
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
_SBOM_ECOSYSTEM_PURL = {
|
|
72
|
+
"npm": "npm",
|
|
73
|
+
"PyPI": "pypi",
|
|
74
|
+
"crates.io": "cargo",
|
|
75
|
+
"Go": "golang",
|
|
76
|
+
"RubyGems": "gem",
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def run_security_check(
|
|
81
|
+
*,
|
|
82
|
+
project_dir: str,
|
|
83
|
+
scope: str = ".",
|
|
84
|
+
include_live_enrichment: bool = False,
|
|
85
|
+
external_inputs: list[dict[str, Any]] | None = None,
|
|
86
|
+
waivers: list[dict[str, Any] | str] | None = None,
|
|
87
|
+
) -> dict[str, Any]:
|
|
88
|
+
scope_path = _resolve_scope(project_dir, scope)
|
|
89
|
+
findings: list[dict[str, Any]] = []
|
|
90
|
+
manifests = detect_manifests(str(scope_path))
|
|
91
|
+
waiver_map = _normalize_waivers(waivers or [])
|
|
92
|
+
|
|
93
|
+
findings.extend(_scan_python_ast(scope_path))
|
|
94
|
+
findings.extend(_scan_secret_patterns(scope_path))
|
|
95
|
+
findings.extend(_scan_config_and_iac(scope_path))
|
|
96
|
+
findings.extend(_scan_dependency_health(scope_path, include_live_enrichment))
|
|
97
|
+
findings = _finalize_findings(findings, waiver_map)
|
|
98
|
+
findings.sort(key=lambda finding: (SEVERITY_ORDER.get(finding["severity"], 99), finding["id"]))
|
|
99
|
+
|
|
100
|
+
severity_counts = Counter(finding["severity"] for finding in findings)
|
|
101
|
+
source_counts = Counter(finding["source"] for finding in findings)
|
|
102
|
+
relative_scope = _display_scope(project_dir, scope_path)
|
|
103
|
+
delta = classify_project_changes(project_dir, touched_files=_delta_touched_files(project_dir, scope_path), goal="security check")
|
|
104
|
+
unresolved_high_risk = [
|
|
105
|
+
finding
|
|
106
|
+
for finding in findings
|
|
107
|
+
if finding.get("severity") in {"critical", "high"} and not finding.get("waived", False)
|
|
108
|
+
]
|
|
109
|
+
provenance = _build_provenance(
|
|
110
|
+
scope=relative_scope,
|
|
111
|
+
manifests=manifests.manifests,
|
|
112
|
+
findings=findings,
|
|
113
|
+
include_live_enrichment=include_live_enrichment,
|
|
114
|
+
external_inputs=external_inputs or [],
|
|
115
|
+
)
|
|
116
|
+
trust_scores = _build_trust_scores(findings)
|
|
117
|
+
generated_at = datetime.now(timezone.utc).isoformat()
|
|
118
|
+
license_artifact = _build_license_artifact(
|
|
119
|
+
project_dir=project_dir,
|
|
120
|
+
scope_path=scope_path,
|
|
121
|
+
manifests=manifests,
|
|
122
|
+
generated_at=generated_at,
|
|
123
|
+
)
|
|
124
|
+
unresolved_risks = [
|
|
125
|
+
{
|
|
126
|
+
"finding_id": finding.get("finding_id"),
|
|
127
|
+
"id": finding.get("id"),
|
|
128
|
+
"severity": finding.get("severity"),
|
|
129
|
+
"exploitability": finding.get("exploitability", "unknown"),
|
|
130
|
+
"reachability": finding.get("reachability", "unknown"),
|
|
131
|
+
"waived": bool(finding.get("waived")),
|
|
132
|
+
"waiver_justification": finding.get("waiver_justification", ""),
|
|
133
|
+
"message": finding.get("message", ""),
|
|
134
|
+
}
|
|
135
|
+
for finding in findings
|
|
136
|
+
if finding.get("severity") in {"critical", "high"}
|
|
137
|
+
]
|
|
138
|
+
trace = record_trace(
|
|
139
|
+
project_dir,
|
|
140
|
+
trace_type="security-check",
|
|
141
|
+
route="security-check",
|
|
142
|
+
status="error" if unresolved_high_risk else "ok",
|
|
143
|
+
plan={"scope": relative_scope, "delta_categories": delta["categories"]},
|
|
144
|
+
verify={"finding_count": len(findings), "unresolved_high_risk_count": len(unresolved_high_risk)},
|
|
145
|
+
failures=[finding["finding_id"] for finding in unresolved_high_risk],
|
|
146
|
+
rejections=[],
|
|
147
|
+
)
|
|
148
|
+
artifacts = _write_evidence_artifacts(
|
|
149
|
+
project_dir,
|
|
150
|
+
scope=relative_scope,
|
|
151
|
+
generated_at=generated_at,
|
|
152
|
+
findings=findings,
|
|
153
|
+
provenance=provenance,
|
|
154
|
+
trust_scores=trust_scores,
|
|
155
|
+
include_live_enrichment=include_live_enrichment,
|
|
156
|
+
waivers=waivers or [],
|
|
157
|
+
license_artifact=license_artifact,
|
|
158
|
+
manifests=manifests,
|
|
159
|
+
unresolved_risks=unresolved_risks,
|
|
160
|
+
)
|
|
161
|
+
return {
|
|
162
|
+
"schema": "SecurityCheckResult",
|
|
163
|
+
"status": "error" if unresolved_high_risk else "ok",
|
|
164
|
+
"scope": relative_scope,
|
|
165
|
+
"findings": findings,
|
|
166
|
+
"waivers": {
|
|
167
|
+
"requested": len(waivers or []),
|
|
168
|
+
"applied": len([finding for finding in findings if finding.get("waived")]),
|
|
169
|
+
},
|
|
170
|
+
"release_blocked": bool(unresolved_high_risk),
|
|
171
|
+
"unresolved_risks": unresolved_risks,
|
|
172
|
+
"security_scans": [
|
|
173
|
+
{
|
|
174
|
+
"tool": "security-check",
|
|
175
|
+
"path": artifacts["json_path"],
|
|
176
|
+
"sarif_path": artifacts["sarif_path"],
|
|
177
|
+
"sbom_path": artifacts["sbom_path"],
|
|
178
|
+
"license_path": artifacts["license_path"],
|
|
179
|
+
"findings": findings,
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
"summary": {
|
|
183
|
+
"finding_count": len(findings),
|
|
184
|
+
"unresolved_high_risk_count": len(unresolved_high_risk),
|
|
185
|
+
"by_severity": dict(sorted(severity_counts.items())),
|
|
186
|
+
"by_source": dict(sorted(source_counts.items())),
|
|
187
|
+
"live_enrichment": include_live_enrichment,
|
|
188
|
+
"scan_status": "completed",
|
|
189
|
+
"manifest_count": len(manifests.manifests),
|
|
190
|
+
"delta_categories": delta["categories"],
|
|
191
|
+
},
|
|
192
|
+
"provenance": provenance,
|
|
193
|
+
"trust_scores": trust_scores,
|
|
194
|
+
"license": license_artifact,
|
|
195
|
+
"sbom": _build_sbom_payload(generated_at=generated_at, manifests=manifests),
|
|
196
|
+
"evidence": {
|
|
197
|
+
"path": artifacts["json_path"],
|
|
198
|
+
"json_path": artifacts["json_path"],
|
|
199
|
+
"sarif_path": artifacts["sarif_path"],
|
|
200
|
+
"sbom_path": artifacts["sbom_path"],
|
|
201
|
+
"license_path": artifacts["license_path"],
|
|
202
|
+
},
|
|
203
|
+
"trace": {"trace_id": trace["trace_id"], "path": trace["path"]},
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def security_check(
|
|
208
|
+
*,
|
|
209
|
+
project_dir: str,
|
|
210
|
+
scope: str = ".",
|
|
211
|
+
include_live_enrichment: bool = False,
|
|
212
|
+
external_inputs: list[dict[str, Any]] | None = None,
|
|
213
|
+
waivers: list[dict[str, Any] | str] | None = None,
|
|
214
|
+
) -> dict[str, Any]:
|
|
215
|
+
return run_security_check(
|
|
216
|
+
project_dir=project_dir,
|
|
217
|
+
scope=scope,
|
|
218
|
+
include_live_enrichment=include_live_enrichment,
|
|
219
|
+
external_inputs=external_inputs,
|
|
220
|
+
waivers=waivers,
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def _resolve_scope(project_dir: str, scope: str) -> Path:
|
|
225
|
+
if not scope:
|
|
226
|
+
return Path(project_dir).resolve()
|
|
227
|
+
candidate = Path(scope)
|
|
228
|
+
if candidate.is_absolute():
|
|
229
|
+
return candidate.resolve()
|
|
230
|
+
base = Path(project_dir).resolve()
|
|
231
|
+
resolved = Path(ensure_path_within_dir(base, base / candidate))
|
|
232
|
+
return resolved
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def _display_scope(project_dir: str, scope_path: Path) -> str:
|
|
236
|
+
base = Path(project_dir).resolve()
|
|
237
|
+
try:
|
|
238
|
+
return scope_path.relative_to(base).as_posix() or "."
|
|
239
|
+
except ValueError:
|
|
240
|
+
return str(scope_path)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def _delta_touched_files(project_dir: str, scope_path: Path) -> list[str]:
|
|
244
|
+
base = Path(project_dir).resolve()
|
|
245
|
+
if scope_path.is_file():
|
|
246
|
+
return [_display_scope(project_dir, scope_path)]
|
|
247
|
+
touched: list[str] = []
|
|
248
|
+
for path in sorted(scope_path.rglob("*")):
|
|
249
|
+
if not path.is_file():
|
|
250
|
+
continue
|
|
251
|
+
try:
|
|
252
|
+
rel = path.resolve().relative_to(base).as_posix()
|
|
253
|
+
except ValueError:
|
|
254
|
+
rel = str(path.resolve())
|
|
255
|
+
touched.append(rel)
|
|
256
|
+
if len(touched) >= 64:
|
|
257
|
+
break
|
|
258
|
+
return touched or [_display_scope(project_dir, scope_path)]
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def _scan_python_ast(scope_path: Path) -> list[dict[str, Any]]:
|
|
262
|
+
findings: list[dict[str, Any]] = []
|
|
263
|
+
for py_file in _iter_python_files(scope_path):
|
|
264
|
+
try:
|
|
265
|
+
source = py_file.read_text(encoding="utf-8")
|
|
266
|
+
except OSError:
|
|
267
|
+
continue
|
|
268
|
+
findings.extend(_scan_python_file(py_file, source))
|
|
269
|
+
findings.extend(_run_bandit_if_available(scope_path))
|
|
270
|
+
return findings
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def _scan_secret_patterns(scope_path: Path) -> list[dict[str, Any]]:
|
|
274
|
+
findings: list[dict[str, Any]] = []
|
|
275
|
+
for candidate in _iter_text_candidates(scope_path):
|
|
276
|
+
try:
|
|
277
|
+
source = candidate.read_text(encoding="utf-8")
|
|
278
|
+
except (OSError, UnicodeDecodeError):
|
|
279
|
+
continue
|
|
280
|
+
for line_no, line in enumerate(source.splitlines(), start=1):
|
|
281
|
+
for rule_id, pattern, severity, message in _SECRET_PATTERNS:
|
|
282
|
+
if not pattern.search(line):
|
|
283
|
+
continue
|
|
284
|
+
findings.append(
|
|
285
|
+
_finding(
|
|
286
|
+
rule_id=rule_id,
|
|
287
|
+
source_name="secret-scan",
|
|
288
|
+
category="secret",
|
|
289
|
+
severity=severity,
|
|
290
|
+
path=candidate,
|
|
291
|
+
line=line_no,
|
|
292
|
+
message=message,
|
|
293
|
+
recommendation="Move secrets to an approved secret manager or environment injection.",
|
|
294
|
+
snippet=line.strip(),
|
|
295
|
+
)
|
|
296
|
+
)
|
|
297
|
+
return findings
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
def _scan_config_and_iac(scope_path: Path) -> list[dict[str, Any]]:
|
|
301
|
+
findings: list[dict[str, Any]] = []
|
|
302
|
+
for candidate in _iter_text_candidates(scope_path):
|
|
303
|
+
lowered = candidate.name.lower()
|
|
304
|
+
rel_lower = candidate.as_posix().lower()
|
|
305
|
+
if not any(hint in lowered or hint in rel_lower for hint in _CONFIG_FILE_HINTS):
|
|
306
|
+
continue
|
|
307
|
+
try:
|
|
308
|
+
source = candidate.read_text(encoding="utf-8")
|
|
309
|
+
except (OSError, UnicodeDecodeError):
|
|
310
|
+
continue
|
|
311
|
+
for line_no, line in enumerate(source.splitlines(), start=1):
|
|
312
|
+
for rule_id, pattern, severity, message in _CONFIG_PATTERNS:
|
|
313
|
+
if not pattern.search(line):
|
|
314
|
+
continue
|
|
315
|
+
findings.append(
|
|
316
|
+
_finding(
|
|
317
|
+
rule_id=rule_id,
|
|
318
|
+
source_name="config-scan",
|
|
319
|
+
category="config",
|
|
320
|
+
severity=severity,
|
|
321
|
+
path=candidate,
|
|
322
|
+
line=line_no,
|
|
323
|
+
message=message,
|
|
324
|
+
recommendation="Apply least-privilege defaults and tighten network/transport policy.",
|
|
325
|
+
snippet=line.strip(),
|
|
326
|
+
)
|
|
327
|
+
)
|
|
328
|
+
return findings
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
def _iter_text_candidates(scope_path: Path) -> list[Path]:
|
|
332
|
+
if scope_path.is_file():
|
|
333
|
+
return [scope_path]
|
|
334
|
+
if not scope_path.exists():
|
|
335
|
+
return []
|
|
336
|
+
candidates: list[Path] = []
|
|
337
|
+
for path in sorted(scope_path.rglob("*")):
|
|
338
|
+
if not path.is_file():
|
|
339
|
+
continue
|
|
340
|
+
try:
|
|
341
|
+
size = path.stat().st_size
|
|
342
|
+
except OSError:
|
|
343
|
+
continue
|
|
344
|
+
if size > 1_000_000:
|
|
345
|
+
continue
|
|
346
|
+
if ".git" in path.parts or ".omg" in path.parts or "build" in path.parts:
|
|
347
|
+
continue
|
|
348
|
+
candidates.append(path)
|
|
349
|
+
return candidates
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
def _iter_python_files(scope_path: Path) -> list[Path]:
|
|
353
|
+
if scope_path.is_file():
|
|
354
|
+
return [scope_path] if scope_path.suffix == ".py" else []
|
|
355
|
+
if not scope_path.exists():
|
|
356
|
+
return []
|
|
357
|
+
return sorted(path for path in scope_path.rglob("*.py") if path.is_file())
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
def _scan_python_file(path: Path, source: str) -> list[dict[str, Any]]:
|
|
361
|
+
try:
|
|
362
|
+
tree = ast.parse(source)
|
|
363
|
+
except SyntaxError:
|
|
364
|
+
return []
|
|
365
|
+
|
|
366
|
+
findings: list[dict[str, Any]] = []
|
|
367
|
+
for node in ast.walk(tree):
|
|
368
|
+
if isinstance(node, ast.Call):
|
|
369
|
+
findings.extend(_call_findings(path, node, source))
|
|
370
|
+
return findings
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
def _call_findings(path: Path, node: ast.Call, source: str) -> list[dict[str, Any]]:
|
|
374
|
+
findings: list[dict[str, Any]] = []
|
|
375
|
+
callee = _call_name(node.func)
|
|
376
|
+
if callee in {"subprocess.run", "subprocess.Popen", "os.system"}:
|
|
377
|
+
if any(keyword.arg == "shell" and isinstance(keyword.value, ast.Constant) and keyword.value.value is True for keyword in node.keywords):
|
|
378
|
+
findings.append(
|
|
379
|
+
_finding(
|
|
380
|
+
rule_id="B602",
|
|
381
|
+
source_name="bandit-lite",
|
|
382
|
+
category="python_ast",
|
|
383
|
+
severity="high",
|
|
384
|
+
path=path,
|
|
385
|
+
line=getattr(node, "lineno", 1),
|
|
386
|
+
message="subprocess call uses shell=True",
|
|
387
|
+
recommendation="Avoid shell=True in subprocess calls.",
|
|
388
|
+
snippet=_source_line(source, getattr(node, "lineno", 1)),
|
|
389
|
+
)
|
|
390
|
+
)
|
|
391
|
+
if callee == "eval":
|
|
392
|
+
findings.append(
|
|
393
|
+
_finding(
|
|
394
|
+
rule_id="B307",
|
|
395
|
+
source_name="bandit-lite",
|
|
396
|
+
category="python_ast",
|
|
397
|
+
severity="high",
|
|
398
|
+
path=path,
|
|
399
|
+
line=getattr(node, "lineno", 1),
|
|
400
|
+
message="eval() detected",
|
|
401
|
+
recommendation="Replace eval with explicit parsing.",
|
|
402
|
+
snippet=_source_line(source, getattr(node, "lineno", 1)),
|
|
403
|
+
)
|
|
404
|
+
)
|
|
405
|
+
if callee == "exec":
|
|
406
|
+
findings.append(
|
|
407
|
+
_finding(
|
|
408
|
+
rule_id="B102",
|
|
409
|
+
source_name="bandit-lite",
|
|
410
|
+
category="python_ast",
|
|
411
|
+
severity="high",
|
|
412
|
+
path=path,
|
|
413
|
+
line=getattr(node, "lineno", 1),
|
|
414
|
+
message="exec() detected",
|
|
415
|
+
recommendation="Replace exec with explicit control flow.",
|
|
416
|
+
snippet=_source_line(source, getattr(node, "lineno", 1)),
|
|
417
|
+
)
|
|
418
|
+
)
|
|
419
|
+
if callee in {"pickle.load", "pickle.loads"}:
|
|
420
|
+
findings.append(
|
|
421
|
+
_finding(
|
|
422
|
+
rule_id="B301",
|
|
423
|
+
source_name="bandit-lite",
|
|
424
|
+
category="python_ast",
|
|
425
|
+
severity="high",
|
|
426
|
+
path=path,
|
|
427
|
+
line=getattr(node, "lineno", 1),
|
|
428
|
+
message="pickle deserialization detected",
|
|
429
|
+
recommendation="Avoid unsafe deserialization of pickle payloads.",
|
|
430
|
+
snippet=_source_line(source, getattr(node, "lineno", 1)),
|
|
431
|
+
)
|
|
432
|
+
)
|
|
433
|
+
return findings
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
def _call_name(func: ast.AST) -> str:
|
|
437
|
+
if isinstance(func, ast.Name):
|
|
438
|
+
return func.id
|
|
439
|
+
if isinstance(func, ast.Attribute):
|
|
440
|
+
prefix = _call_name(func.value)
|
|
441
|
+
return f"{prefix}.{func.attr}" if prefix else func.attr
|
|
442
|
+
return ""
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
def _source_line(source: str, line: int) -> str:
|
|
446
|
+
lines = source.splitlines()
|
|
447
|
+
if 1 <= line <= len(lines):
|
|
448
|
+
return lines[line - 1].strip()
|
|
449
|
+
return ""
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
def _run_bandit_if_available(scope_path: Path) -> list[dict[str, Any]]:
|
|
453
|
+
if not _command_exists("bandit"):
|
|
454
|
+
return []
|
|
455
|
+
|
|
456
|
+
cmd = ["bandit", "-r", str(scope_path), "-f", "json"]
|
|
457
|
+
proc = subprocess.run(cmd, capture_output=True, text=True, check=False, timeout=30)
|
|
458
|
+
if proc.returncode not in {0, 1}:
|
|
459
|
+
return []
|
|
460
|
+
try:
|
|
461
|
+
import json
|
|
462
|
+
|
|
463
|
+
payload = json.loads(proc.stdout or "{}")
|
|
464
|
+
except Exception:
|
|
465
|
+
return []
|
|
466
|
+
|
|
467
|
+
findings: list[dict[str, Any]] = []
|
|
468
|
+
for item in payload.get("results", []):
|
|
469
|
+
issue_severity = str(item.get("issue_severity", "LOW")).lower()
|
|
470
|
+
findings.append(
|
|
471
|
+
{
|
|
472
|
+
"id": str(item.get("test_id", "bandit")),
|
|
473
|
+
"source": "bandit",
|
|
474
|
+
"category": "python_ast",
|
|
475
|
+
"severity": "medium" if issue_severity == "medium" else ("critical" if issue_severity == "critical" else issue_severity),
|
|
476
|
+
"exploitability": "unknown",
|
|
477
|
+
"reachability": "unknown",
|
|
478
|
+
"evidence": {
|
|
479
|
+
"path": str(item.get("filename", "")),
|
|
480
|
+
"line": int(item.get("line_number", 1)),
|
|
481
|
+
"snippet": str(item.get("code", "")).strip(),
|
|
482
|
+
},
|
|
483
|
+
"recommendation": str(item.get("more_info", "")) or "Review Bandit finding and remediate.",
|
|
484
|
+
"message": str(item.get("issue_text", "Bandit finding")),
|
|
485
|
+
}
|
|
486
|
+
)
|
|
487
|
+
return findings
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
def _command_exists(command: str) -> bool:
|
|
491
|
+
from shutil import which
|
|
492
|
+
|
|
493
|
+
return which(command) is not None
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
def _scan_dependency_health(scope_path: Path, include_live_enrichment: bool) -> list[dict[str, Any]]:
|
|
497
|
+
manifests = detect_manifests(str(scope_path))
|
|
498
|
+
dependencies = [
|
|
499
|
+
{
|
|
500
|
+
"name": package.name,
|
|
501
|
+
"version": _normalize_version(package.version),
|
|
502
|
+
"ecosystem": _ecosystem_from_manifest(package.source_manifest),
|
|
503
|
+
}
|
|
504
|
+
for package in manifests.packages
|
|
505
|
+
if package.name
|
|
506
|
+
]
|
|
507
|
+
if not dependencies or not include_live_enrichment:
|
|
508
|
+
return []
|
|
509
|
+
|
|
510
|
+
osv_result = scan_for_cves(dependencies, str(scope_path))
|
|
511
|
+
raw_results = osv_result.get("results", {})
|
|
512
|
+
findings: list[dict[str, Any]] = []
|
|
513
|
+
for dependency in dependencies:
|
|
514
|
+
package_name = dependency["name"]
|
|
515
|
+
for vuln in raw_results.get(package_name, []):
|
|
516
|
+
reachability = analyze_reachability(
|
|
517
|
+
{
|
|
518
|
+
"package": package_name,
|
|
519
|
+
"id": vuln.get("id", ""),
|
|
520
|
+
"summary": vuln.get("summary", ""),
|
|
521
|
+
"fixed_version": vuln.get("fixed_version", ""),
|
|
522
|
+
},
|
|
523
|
+
str(scope_path),
|
|
524
|
+
)
|
|
525
|
+
findings.append(
|
|
526
|
+
{
|
|
527
|
+
"id": str(vuln.get("id", "")),
|
|
528
|
+
"source": "osv",
|
|
529
|
+
"category": "dependency",
|
|
530
|
+
"severity": _normalize_severity(str(vuln.get("severity", "unknown"))),
|
|
531
|
+
"exploitability": _risk_to_exploitability(str(reachability.get("risk_level", ""))),
|
|
532
|
+
"reachability": _normalize_reachability(str(reachability.get("reachability", "unknown"))),
|
|
533
|
+
"evidence": {
|
|
534
|
+
"package": package_name,
|
|
535
|
+
"version": dependency["version"],
|
|
536
|
+
"fixed_version": str(vuln.get("fixed_version", "")),
|
|
537
|
+
"summary": str(vuln.get("summary", "")),
|
|
538
|
+
},
|
|
539
|
+
"recommendation": reachability.get("recommendation", "Upgrade the dependency to a fixed version."),
|
|
540
|
+
"message": str(vuln.get("summary", "")) or f"Known vulnerability in {package_name}",
|
|
541
|
+
}
|
|
542
|
+
)
|
|
543
|
+
return findings
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
def _risk_to_exploitability(risk_level: str) -> str:
|
|
547
|
+
lowered = risk_level.lower()
|
|
548
|
+
if lowered in {"critical", "high"}:
|
|
549
|
+
return "high"
|
|
550
|
+
if lowered == "medium":
|
|
551
|
+
return "medium"
|
|
552
|
+
if lowered == "low":
|
|
553
|
+
return "low"
|
|
554
|
+
return "unknown"
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
def _normalize_reachability(raw: str) -> str:
|
|
558
|
+
lowered = raw.lower()
|
|
559
|
+
if lowered in {"reachable", "potentially_reachable", "potentially-reachable"}:
|
|
560
|
+
return "reachable"
|
|
561
|
+
if lowered == "unreachable":
|
|
562
|
+
return "unreachable"
|
|
563
|
+
return "unknown"
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
def _normalize_version(version: str) -> str:
|
|
567
|
+
normalized = (version or "").strip()
|
|
568
|
+
for prefix in ("==", ">=", "<=", "~=", "^", ">"):
|
|
569
|
+
if normalized.startswith(prefix):
|
|
570
|
+
return normalized[len(prefix):].strip()
|
|
571
|
+
return normalized
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
def _ecosystem_from_manifest(manifest_path: str) -> str:
|
|
575
|
+
suffix = Path(manifest_path).name
|
|
576
|
+
return {
|
|
577
|
+
"package.json": "npm",
|
|
578
|
+
"requirements.txt": "PyPI",
|
|
579
|
+
"pyproject.toml": "PyPI",
|
|
580
|
+
"Cargo.toml": "crates.io",
|
|
581
|
+
"go.mod": "Go",
|
|
582
|
+
"Gemfile": "RubyGems",
|
|
583
|
+
}.get(suffix, "npm")
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
def _normalize_severity(raw: str) -> str:
|
|
587
|
+
lowered = raw.lower()
|
|
588
|
+
if "critical" in lowered:
|
|
589
|
+
return "critical"
|
|
590
|
+
if "high" in lowered:
|
|
591
|
+
return "high"
|
|
592
|
+
if "medium" in lowered or "moderate" in lowered:
|
|
593
|
+
return "medium"
|
|
594
|
+
if "low" in lowered:
|
|
595
|
+
return "low"
|
|
596
|
+
return "medium"
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
def _finding(
|
|
600
|
+
*,
|
|
601
|
+
rule_id: str,
|
|
602
|
+
source_name: str,
|
|
603
|
+
category: str,
|
|
604
|
+
severity: str,
|
|
605
|
+
path: Path,
|
|
606
|
+
line: int,
|
|
607
|
+
message: str,
|
|
608
|
+
recommendation: str,
|
|
609
|
+
snippet: str,
|
|
610
|
+
) -> dict[str, Any]:
|
|
611
|
+
exploitability = "high" if severity in {"critical", "high"} else ("medium" if severity == "medium" else "low")
|
|
612
|
+
return {
|
|
613
|
+
"id": rule_id,
|
|
614
|
+
"source": source_name,
|
|
615
|
+
"category": category,
|
|
616
|
+
"severity": severity,
|
|
617
|
+
"exploitability": exploitability,
|
|
618
|
+
"reachability": "reachable",
|
|
619
|
+
"evidence": {
|
|
620
|
+
"path": str(path),
|
|
621
|
+
"line": line,
|
|
622
|
+
"snippet": snippet,
|
|
623
|
+
},
|
|
624
|
+
"recommendation": recommendation,
|
|
625
|
+
"message": message,
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
def _normalize_waivers(waivers: list[dict[str, Any] | str]) -> dict[str, str]:
|
|
630
|
+
normalized: dict[str, str] = {}
|
|
631
|
+
for waiver in waivers:
|
|
632
|
+
if isinstance(waiver, str):
|
|
633
|
+
key = waiver.strip()
|
|
634
|
+
if key:
|
|
635
|
+
normalized[key] = "waived"
|
|
636
|
+
continue
|
|
637
|
+
if not isinstance(waiver, dict):
|
|
638
|
+
continue
|
|
639
|
+
target = str(waiver.get("finding_id") or waiver.get("id") or "").strip()
|
|
640
|
+
if not target:
|
|
641
|
+
continue
|
|
642
|
+
justification = str(waiver.get("justification") or waiver.get("reason") or "waived").strip()
|
|
643
|
+
normalized[target] = justification
|
|
644
|
+
return normalized
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
def _finding_instance_id(finding: dict[str, Any]) -> str:
|
|
648
|
+
evidence = finding.get("evidence", {})
|
|
649
|
+
base = "|".join(
|
|
650
|
+
[
|
|
651
|
+
str(finding.get("id", "")),
|
|
652
|
+
str(evidence.get("path", "")),
|
|
653
|
+
str(evidence.get("line", "")),
|
|
654
|
+
str(finding.get("message", "")),
|
|
655
|
+
]
|
|
656
|
+
)
|
|
657
|
+
digest = sha256(base.encode("utf-8")).hexdigest()
|
|
658
|
+
return f"{finding.get('id', 'SEC')}-{digest[:12]}"
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
def _finalize_findings(findings: list[dict[str, Any]], waiver_map: dict[str, str]) -> list[dict[str, Any]]:
|
|
662
|
+
finalized: list[dict[str, Any]] = []
|
|
663
|
+
for finding in findings:
|
|
664
|
+
item = dict(finding)
|
|
665
|
+
item["severity"] = _normalize_severity(str(item.get("severity", "medium")))
|
|
666
|
+
item.setdefault("exploitability", "unknown")
|
|
667
|
+
item.setdefault("reachability", "unknown")
|
|
668
|
+
item["exploitability"] = _normalize_exploitability(str(item.get("exploitability", "unknown")), item)
|
|
669
|
+
item["reachability"] = _normalize_reachability(str(item.get("reachability", "unknown")))
|
|
670
|
+
item["finding_id"] = _finding_instance_id(item)
|
|
671
|
+
justification = waiver_map.get(item["finding_id"]) or waiver_map.get(str(item.get("id", "")))
|
|
672
|
+
if justification:
|
|
673
|
+
item["waived"] = True
|
|
674
|
+
item["waiver_justification"] = justification
|
|
675
|
+
else:
|
|
676
|
+
item["waived"] = False
|
|
677
|
+
finalized.append(item)
|
|
678
|
+
return finalized
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
def _normalize_exploitability(raw: str, finding: dict[str, Any]) -> str:
|
|
682
|
+
lowered = raw.lower()
|
|
683
|
+
if lowered in {"high", "medium", "low"}:
|
|
684
|
+
return lowered
|
|
685
|
+
category = str(finding.get("category", "")).lower()
|
|
686
|
+
severity = str(finding.get("severity", "medium")).lower()
|
|
687
|
+
if category in {"secret", "python_ast"}:
|
|
688
|
+
return "high"
|
|
689
|
+
if severity in {"critical", "high"}:
|
|
690
|
+
return "high"
|
|
691
|
+
if severity == "medium":
|
|
692
|
+
return "medium"
|
|
693
|
+
if severity == "low":
|
|
694
|
+
return "low"
|
|
695
|
+
return "unknown"
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
def _build_provenance(
|
|
699
|
+
*,
|
|
700
|
+
scope: str,
|
|
701
|
+
manifests: list[Any],
|
|
702
|
+
findings: list[dict[str, Any]],
|
|
703
|
+
include_live_enrichment: bool,
|
|
704
|
+
external_inputs: list[dict[str, Any]],
|
|
705
|
+
) -> list[dict[str, Any]]:
|
|
706
|
+
provenance = [
|
|
707
|
+
{
|
|
708
|
+
"source": "bandit-lite",
|
|
709
|
+
"scope": scope,
|
|
710
|
+
"mode": "static",
|
|
711
|
+
"finding_count": len([finding for finding in findings if finding["source"] == "bandit-lite"]),
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
"source": "manifest-detector",
|
|
715
|
+
"scope": scope,
|
|
716
|
+
"manifest_count": len(manifests),
|
|
717
|
+
"mode": "live" if include_live_enrichment else "offline",
|
|
718
|
+
},
|
|
719
|
+
]
|
|
720
|
+
if include_live_enrichment:
|
|
721
|
+
provenance.append(
|
|
722
|
+
{
|
|
723
|
+
"source": "osv",
|
|
724
|
+
"scope": scope,
|
|
725
|
+
"mode": "live-enrichment",
|
|
726
|
+
}
|
|
727
|
+
)
|
|
728
|
+
if external_inputs:
|
|
729
|
+
provenance.append(
|
|
730
|
+
{
|
|
731
|
+
"source": "external-content",
|
|
732
|
+
"scope": scope,
|
|
733
|
+
"mode": "zero-trust",
|
|
734
|
+
"count": len(external_inputs),
|
|
735
|
+
}
|
|
736
|
+
)
|
|
737
|
+
return provenance
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
def _build_trust_scores(findings: list[dict[str, Any]]) -> dict[str, float]:
|
|
741
|
+
if not findings:
|
|
742
|
+
return {"overall": 1.0}
|
|
743
|
+
weighted = 0.0
|
|
744
|
+
for finding in findings:
|
|
745
|
+
severity = finding.get("severity", "medium")
|
|
746
|
+
weighted += {"critical": 0.4, "high": 0.25, "medium": 0.1, "low": 0.05}.get(str(severity), 0.1)
|
|
747
|
+
overall = max(0.0, round(1.0 - min(weighted, 0.95), 3))
|
|
748
|
+
return {"overall": overall}
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
def _timestamp_slug() -> str:
|
|
752
|
+
return datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
def _build_sarif_payload(findings: list[dict[str, Any]]) -> dict[str, Any]:
|
|
756
|
+
rules_by_id: dict[str, dict[str, Any]] = {}
|
|
757
|
+
results: list[dict[str, Any]] = []
|
|
758
|
+
for finding in findings:
|
|
759
|
+
rule_id = str(finding.get("id", "OMG000"))
|
|
760
|
+
if rule_id not in rules_by_id:
|
|
761
|
+
rules_by_id[rule_id] = {
|
|
762
|
+
"id": rule_id,
|
|
763
|
+
"name": str(finding.get("category", "security")),
|
|
764
|
+
"shortDescription": {"text": str(finding.get("message", "Security finding"))},
|
|
765
|
+
"help": {"text": str(finding.get("recommendation", "Review finding and remediate."))},
|
|
766
|
+
}
|
|
767
|
+
evidence = finding.get("evidence", {})
|
|
768
|
+
level = "warning"
|
|
769
|
+
if finding.get("severity") in {"critical", "high"}:
|
|
770
|
+
level = "error"
|
|
771
|
+
elif finding.get("severity") == "low":
|
|
772
|
+
level = "note"
|
|
773
|
+
location = {
|
|
774
|
+
"physicalLocation": {
|
|
775
|
+
"artifactLocation": {"uri": str(evidence.get("path", ""))},
|
|
776
|
+
"region": {"startLine": int(evidence.get("line", 1) or 1)},
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
result_payload: dict[str, Any] = {
|
|
780
|
+
"ruleId": rule_id,
|
|
781
|
+
"level": level,
|
|
782
|
+
"message": {"text": str(finding.get("message", "Security finding"))},
|
|
783
|
+
"partialFingerprints": {
|
|
784
|
+
"findingId": str(finding.get("finding_id", "")),
|
|
785
|
+
},
|
|
786
|
+
"properties": {
|
|
787
|
+
"severity": str(finding.get("severity", "medium")),
|
|
788
|
+
"exploitability": str(finding.get("exploitability", "unknown")),
|
|
789
|
+
"reachability": str(finding.get("reachability", "unknown")),
|
|
790
|
+
"waived": bool(finding.get("waived", False)),
|
|
791
|
+
},
|
|
792
|
+
"locations": [location],
|
|
793
|
+
}
|
|
794
|
+
if finding.get("waived"):
|
|
795
|
+
result_payload["suppressions"] = [
|
|
796
|
+
{
|
|
797
|
+
"kind": "inSource",
|
|
798
|
+
"justification": str(finding.get("waiver_justification", "waived")),
|
|
799
|
+
}
|
|
800
|
+
]
|
|
801
|
+
results.append(result_payload)
|
|
802
|
+
|
|
803
|
+
return {
|
|
804
|
+
"$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
|
|
805
|
+
"version": "2.1.0",
|
|
806
|
+
"runs": [
|
|
807
|
+
{
|
|
808
|
+
"tool": {
|
|
809
|
+
"driver": {
|
|
810
|
+
"name": "omg-security-check",
|
|
811
|
+
"version": CANONICAL_VERSION,
|
|
812
|
+
"rules": [rules_by_id[key] for key in sorted(rules_by_id.keys())],
|
|
813
|
+
}
|
|
814
|
+
},
|
|
815
|
+
"results": results,
|
|
816
|
+
}
|
|
817
|
+
],
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
def _build_sbom_payload(*, generated_at: str, manifests: Any) -> dict[str, Any]:
|
|
822
|
+
components: list[dict[str, Any]] = []
|
|
823
|
+
for package in manifests.packages:
|
|
824
|
+
version = _normalize_version(package.version)
|
|
825
|
+
ecosystem = _ecosystem_from_manifest(package.source_manifest)
|
|
826
|
+
purl_type = _SBOM_ECOSYSTEM_PURL.get(ecosystem, "generic")
|
|
827
|
+
purl = f"pkg:{purl_type}/{package.name}"
|
|
828
|
+
if version:
|
|
829
|
+
purl = f"{purl}@{version}"
|
|
830
|
+
component = {
|
|
831
|
+
"type": "library",
|
|
832
|
+
"name": package.name,
|
|
833
|
+
"version": version,
|
|
834
|
+
"purl": purl,
|
|
835
|
+
}
|
|
836
|
+
components.append(component)
|
|
837
|
+
return {
|
|
838
|
+
"bomFormat": "CycloneDX",
|
|
839
|
+
"specVersion": "1.4",
|
|
840
|
+
"version": 1,
|
|
841
|
+
"metadata": {
|
|
842
|
+
"timestamp": generated_at,
|
|
843
|
+
"tools": [{"vendor": "OMG", "name": "omg-security-check", "version": CANONICAL_VERSION}],
|
|
844
|
+
},
|
|
845
|
+
"components": components,
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
def _build_license_artifact(*, project_dir: str, scope_path: Path, manifests: Any, generated_at: str) -> dict[str, Any]:
|
|
850
|
+
project_license = _detect_project_license(project_dir=project_dir, scope_path=scope_path)
|
|
851
|
+
dependencies = [{"name": package.name, "license": "UNKNOWN"} for package in manifests.packages]
|
|
852
|
+
compatibility = check_license_compatibility(project_license, dependencies)
|
|
853
|
+
packages_by_license: dict[str, list[str]] = {}
|
|
854
|
+
for dependency in dependencies:
|
|
855
|
+
package_name = str(dependency.get("name", "")).strip()
|
|
856
|
+
if not package_name:
|
|
857
|
+
continue
|
|
858
|
+
spdx_id = str(dependency.get("license", "UNKNOWN") or "UNKNOWN").strip() or "UNKNOWN"
|
|
859
|
+
packages_by_license.setdefault(spdx_id, []).append(package_name)
|
|
860
|
+
|
|
861
|
+
licenses = [
|
|
862
|
+
{
|
|
863
|
+
"name": spdx_id,
|
|
864
|
+
"spdx_id": spdx_id,
|
|
865
|
+
"packages": sorted(packages),
|
|
866
|
+
}
|
|
867
|
+
for spdx_id, packages in sorted(packages_by_license.items())
|
|
868
|
+
]
|
|
869
|
+
|
|
870
|
+
if not licenses:
|
|
871
|
+
licenses = [{"name": project_license, "spdx_id": project_license, "packages": []}]
|
|
872
|
+
|
|
873
|
+
return {
|
|
874
|
+
"timestamp": generated_at,
|
|
875
|
+
"licenses": licenses,
|
|
876
|
+
"project_license": project_license,
|
|
877
|
+
"compatibility": compatibility,
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
def _detect_project_license(*, project_dir: str, scope_path: Path) -> str:
|
|
882
|
+
candidates = [scope_path / "package.json", Path(project_dir).resolve() / "package.json"]
|
|
883
|
+
for candidate in candidates:
|
|
884
|
+
if not candidate.exists():
|
|
885
|
+
continue
|
|
886
|
+
try:
|
|
887
|
+
payload = json.loads(candidate.read_text(encoding="utf-8"))
|
|
888
|
+
except (OSError, json.JSONDecodeError):
|
|
889
|
+
continue
|
|
890
|
+
if isinstance(payload, dict) and isinstance(payload.get("license"), str) and payload["license"].strip():
|
|
891
|
+
return str(payload["license"]).strip()
|
|
892
|
+
if (Path(project_dir).resolve() / "LICENSE").exists() or (Path(project_dir).resolve() / "LICENSE.md").exists():
|
|
893
|
+
return "MIT"
|
|
894
|
+
return "UNKNOWN"
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
def _write_json_file(path: Path, payload: dict[str, Any]) -> None:
|
|
898
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
899
|
+
path.write_text(json.dumps(payload, indent=2, ensure_ascii=True) + "\n", encoding="utf-8")
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
def _write_evidence_artifacts(
|
|
903
|
+
project_dir: str,
|
|
904
|
+
*,
|
|
905
|
+
scope: str,
|
|
906
|
+
generated_at: str,
|
|
907
|
+
findings: list[dict[str, Any]],
|
|
908
|
+
provenance: list[dict[str, Any]],
|
|
909
|
+
trust_scores: dict[str, float],
|
|
910
|
+
include_live_enrichment: bool,
|
|
911
|
+
waivers: list[dict[str, Any] | str],
|
|
912
|
+
license_artifact: dict[str, Any],
|
|
913
|
+
manifests: Any,
|
|
914
|
+
unresolved_risks: list[dict[str, Any]],
|
|
915
|
+
) -> dict[str, str]:
|
|
916
|
+
stamp = _timestamp_slug()
|
|
917
|
+
evidence_dir = Path(project_dir) / ".omg" / "evidence"
|
|
918
|
+
evidence_dir.mkdir(parents=True, exist_ok=True)
|
|
919
|
+
|
|
920
|
+
json_rel = Path(".omg") / "evidence" / f"security-{stamp}.json"
|
|
921
|
+
sarif_rel = Path(".omg") / "evidence" / f"security-{stamp}.sarif"
|
|
922
|
+
sbom_rel = Path(".omg") / "evidence" / f"sbom-{stamp}.cdx.json"
|
|
923
|
+
license_rel = Path(".omg") / "evidence" / f"license-{stamp}.json"
|
|
924
|
+
|
|
925
|
+
unresolved_high_risk = [
|
|
926
|
+
finding
|
|
927
|
+
for finding in findings
|
|
928
|
+
if finding.get("severity") in {"critical", "high"} and not finding.get("waived", False)
|
|
929
|
+
]
|
|
930
|
+
|
|
931
|
+
payload = {
|
|
932
|
+
"schema": "SecurityCheckEvidence",
|
|
933
|
+
"generated_at": generated_at,
|
|
934
|
+
"scope": scope,
|
|
935
|
+
"scan_status": "completed",
|
|
936
|
+
"live_enrichment": include_live_enrichment,
|
|
937
|
+
"findings": findings,
|
|
938
|
+
"waivers": waivers,
|
|
939
|
+
"unresolved_high_risk": [finding.get("finding_id") for finding in unresolved_high_risk],
|
|
940
|
+
"unresolved_risks": unresolved_risks,
|
|
941
|
+
"security_scans": [
|
|
942
|
+
{
|
|
943
|
+
"tool": "security-check",
|
|
944
|
+
"path": json_rel.as_posix(),
|
|
945
|
+
"findings": findings,
|
|
946
|
+
}
|
|
947
|
+
],
|
|
948
|
+
"provenance": provenance,
|
|
949
|
+
"trust_scores": trust_scores,
|
|
950
|
+
"artifacts": {
|
|
951
|
+
"sarif_path": sarif_rel.as_posix(),
|
|
952
|
+
"sbom_path": sbom_rel.as_posix(),
|
|
953
|
+
"license_path": license_rel.as_posix(),
|
|
954
|
+
},
|
|
955
|
+
}
|
|
956
|
+
_write_json_file(Path(project_dir) / json_rel, payload)
|
|
957
|
+
_write_json_file(Path(project_dir) / sarif_rel, _build_sarif_payload(findings))
|
|
958
|
+
_write_json_file(Path(project_dir) / sbom_rel, _build_sbom_payload(generated_at=generated_at, manifests=manifests))
|
|
959
|
+
_write_json_file(Path(project_dir) / license_rel, license_artifact)
|
|
960
|
+
return {
|
|
961
|
+
"json_path": json_rel.as_posix(),
|
|
962
|
+
"sarif_path": sarif_rel.as_posix(),
|
|
963
|
+
"sbom_path": sbom_rel.as_posix(),
|
|
964
|
+
"license_path": license_rel.as_posix(),
|
|
965
|
+
}
|