kirograph 0.19.0 → 0.20.1
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/README.md +10 -8
- package/dist/architecture/layers/dart.d.ts +10 -0
- package/dist/architecture/layers/dart.d.ts.map +1 -0
- package/dist/architecture/layers/elixir.d.ts +6 -0
- package/dist/architecture/layers/elixir.d.ts.map +1 -0
- package/dist/architecture/layers/index.d.ts.map +1 -1
- package/dist/architecture/layers/ocaml.d.ts +6 -0
- package/dist/architecture/layers/ocaml.d.ts.map +1 -0
- package/dist/architecture/layers/scala.d.ts +6 -0
- package/dist/architecture/layers/scala.d.ts.map +1 -0
- package/dist/architecture/layers/solidity.d.ts +6 -0
- package/dist/architecture/layers/solidity.d.ts.map +1 -0
- package/dist/architecture/layers/vue.d.ts +6 -0
- package/dist/architecture/layers/vue.d.ts.map +1 -0
- package/dist/architecture/manifest/elm.d.ts +3 -0
- package/dist/architecture/manifest/elm.d.ts.map +1 -0
- package/dist/architecture/manifest/index.d.ts.map +1 -1
- package/dist/architecture/manifest/ocaml.d.ts +3 -0
- package/dist/architecture/manifest/ocaml.d.ts.map +1 -0
- package/dist/architecture/manifest/scala.d.ts +3 -0
- package/dist/architecture/manifest/scala.d.ts.map +1 -0
- package/dist/bin/banner.d.ts.map +1 -1
- package/dist/bin/commands/affected.d.ts.map +1 -1
- package/dist/bin/commands/attack-surface.d.ts +3 -0
- package/dist/bin/commands/attack-surface.d.ts.map +1 -0
- package/dist/bin/commands/attack-surface.js +7 -0
- package/dist/bin/commands/attack-surface.js.map +2 -2
- package/dist/bin/commands/benchmark.d.ts +9 -0
- package/dist/bin/commands/benchmark.d.ts.map +1 -0
- package/dist/bin/commands/budget.d.ts +6 -0
- package/dist/bin/commands/budget.d.ts.map +1 -0
- package/dist/bin/commands/caveman.d.ts +7 -0
- package/dist/bin/commands/caveman.d.ts.map +1 -0
- package/dist/bin/commands/communities.d.ts +3 -0
- package/dist/bin/commands/communities.d.ts.map +1 -0
- package/dist/bin/commands/compression.d.ts +7 -0
- package/dist/bin/commands/compression.d.ts.map +1 -0
- package/dist/bin/commands/context.d.ts.map +1 -1
- package/dist/bin/commands/data.d.ts +3 -0
- package/dist/bin/commands/data.d.ts.map +1 -0
- package/dist/bin/commands/dead-code.d.ts +3 -0
- package/dist/bin/commands/dead-code.d.ts.map +1 -0
- package/dist/bin/commands/dep-confusion.d.ts +3 -0
- package/dist/bin/commands/dep-confusion.d.ts.map +1 -0
- package/dist/bin/commands/docs.d.ts +3 -0
- package/dist/bin/commands/docs.d.ts.map +1 -0
- package/dist/bin/commands/exec.d.ts +11 -0
- package/dist/bin/commands/exec.d.ts.map +1 -0
- package/dist/bin/commands/export.d.ts +3 -0
- package/dist/bin/commands/export.d.ts.map +1 -0
- package/dist/bin/commands/flows.d.ts +3 -0
- package/dist/bin/commands/flows.d.ts.map +1 -0
- package/dist/bin/commands/gain.d.ts +6 -0
- package/dist/bin/commands/gain.d.ts.map +1 -0
- package/dist/bin/commands/help.d.ts +7 -0
- package/dist/bin/commands/help.d.ts.map +1 -1
- package/dist/bin/commands/help.js +20 -3
- package/dist/bin/commands/help.js.map +2 -2
- package/dist/bin/commands/hotspots.d.ts +3 -0
- package/dist/bin/commands/hotspots.d.ts.map +1 -0
- package/dist/bin/commands/hotspots.js +94 -1
- package/dist/bin/commands/hotspots.js.map +3 -3
- package/dist/bin/commands/install.d.ts.map +1 -1
- package/dist/bin/commands/install.js +3 -3
- package/dist/bin/commands/install.js.map +2 -2
- package/dist/bin/commands/licenses.d.ts +3 -0
- package/dist/bin/commands/licenses.d.ts.map +1 -0
- package/dist/bin/commands/memory.d.ts +16 -0
- package/dist/bin/commands/memory.d.ts.map +1 -0
- package/dist/bin/commands/memory.js +151 -4
- package/dist/bin/commands/memory.js.map +2 -2
- package/dist/bin/commands/path.d.ts +3 -0
- package/dist/bin/commands/path.d.ts.map +1 -0
- package/dist/bin/commands/pattern.d.ts +3 -0
- package/dist/bin/commands/pattern.d.ts.map +1 -0
- package/dist/bin/commands/pattern.js +592 -0
- package/dist/bin/commands/pattern.js.map +7 -0
- package/dist/bin/commands/query.d.ts.map +1 -1
- package/dist/bin/commands/reachability.d.ts +3 -0
- package/dist/bin/commands/reachability.d.ts.map +1 -0
- package/dist/bin/commands/read.d.ts +6 -0
- package/dist/bin/commands/read.d.ts.map +1 -0
- package/dist/bin/commands/refactor.d.ts +3 -0
- package/dist/bin/commands/refactor.d.ts.map +1 -0
- package/dist/bin/commands/remediation.d.ts +3 -0
- package/dist/bin/commands/remediation.d.ts.map +1 -0
- package/dist/bin/commands/sbom.d.ts +3 -0
- package/dist/bin/commands/sbom.d.ts.map +1 -0
- package/dist/bin/commands/security-ci-report.d.ts +9 -0
- package/dist/bin/commands/security-ci-report.d.ts.map +1 -0
- package/dist/bin/commands/security-export.d.ts +2 -0
- package/dist/bin/commands/security-export.d.ts.map +1 -0
- package/dist/bin/commands/security-flows.d.ts +3 -0
- package/dist/bin/commands/security-flows.d.ts.map +1 -0
- package/dist/bin/commands/security-secrets.d.ts +3 -0
- package/dist/bin/commands/security-secrets.d.ts.map +1 -0
- package/dist/bin/commands/security.d.ts +3 -0
- package/dist/bin/commands/security.d.ts.map +1 -0
- package/dist/bin/commands/security.js +15 -0
- package/dist/bin/commands/security.js.map +2 -2
- package/dist/bin/commands/snapshot.d.ts +3 -0
- package/dist/bin/commands/snapshot.d.ts.map +1 -0
- package/dist/bin/commands/staleness.d.ts +3 -0
- package/dist/bin/commands/staleness.d.ts.map +1 -0
- package/dist/bin/commands/status.d.ts.map +1 -1
- package/dist/bin/commands/status.js +27 -0
- package/dist/bin/commands/status.js.map +2 -2
- package/dist/bin/commands/supply-chain.d.ts +3 -0
- package/dist/bin/commands/supply-chain.d.ts.map +1 -0
- package/dist/bin/commands/surprising.d.ts +3 -0
- package/dist/bin/commands/surprising.d.ts.map +1 -0
- package/dist/bin/commands/sync.d.ts.map +1 -1
- package/dist/bin/commands/uninit.d.ts.map +1 -1
- package/dist/bin/commands/utils.d.ts +5 -0
- package/dist/bin/commands/utils.d.ts.map +1 -1
- package/dist/bin/commands/vex.d.ts +3 -0
- package/dist/bin/commands/vex.d.ts.map +1 -0
- package/dist/bin/commands/vuln-suppress.d.ts +3 -0
- package/dist/bin/commands/vuln-suppress.d.ts.map +1 -0
- package/dist/bin/commands/vulns.d.ts +3 -0
- package/dist/bin/commands/vulns.d.ts.map +1 -0
- package/dist/bin/installer/archive.d.ts +47 -0
- package/dist/bin/installer/archive.d.ts.map +1 -0
- package/dist/bin/installer/auto-detect.d.ts +16 -0
- package/dist/bin/installer/auto-detect.d.ts.map +1 -0
- package/dist/bin/installer/caveman.d.ts +12 -0
- package/dist/bin/installer/caveman.d.ts.map +1 -0
- package/dist/bin/installer/cli-agent.d.ts +7 -2
- package/dist/bin/installer/cli-agent.d.ts.map +1 -1
- package/dist/bin/installer/cli-agent.js +6 -2
- package/dist/bin/installer/cli-agent.js.map +2 -2
- package/dist/bin/installer/common.d.ts +36 -0
- package/dist/bin/installer/common.d.ts.map +1 -0
- package/dist/bin/installer/common.js +2 -1
- package/dist/bin/installer/common.js.map +2 -2
- package/dist/bin/installer/config-prompt.d.ts +1 -1
- package/dist/bin/installer/config-prompt.d.ts.map +1 -1
- package/dist/bin/installer/config-prompt.js +74 -2
- package/dist/bin/installer/config-prompt.js.map +2 -2
- package/dist/bin/installer/dashboard.d.ts.map +1 -1
- package/dist/bin/installer/detect.d.ts +30 -0
- package/dist/bin/installer/detect.d.ts.map +1 -0
- package/dist/bin/installer/hooks.d.ts +4 -1
- package/dist/bin/installer/hooks.d.ts.map +1 -1
- package/dist/bin/installer/hooks.js +34 -0
- package/dist/bin/installer/hooks.js.map +2 -2
- package/dist/bin/installer/index.d.ts +5 -4
- package/dist/bin/installer/index.d.ts.map +1 -1
- package/dist/bin/installer/index.js +67 -8
- package/dist/bin/installer/index.js.map +2 -2
- package/dist/bin/installer/instructions.d.ts +14 -0
- package/dist/bin/installer/instructions.d.ts.map +1 -0
- package/dist/bin/installer/instructions.js +15 -1
- package/dist/bin/installer/instructions.js.map +2 -2
- package/dist/bin/installer/mcp.d.ts.map +1 -1
- package/dist/bin/installer/prompts.d.ts +17 -0
- package/dist/bin/installer/prompts.d.ts.map +1 -1
- package/dist/bin/installer/qdrant-dashboard.d.ts.map +1 -1
- package/dist/bin/installer/steering.d.ts +14 -2
- package/dist/bin/installer/steering.d.ts.map +1 -1
- package/dist/bin/installer/steering.js +81 -0
- package/dist/bin/installer/steering.js.map +2 -2
- package/dist/bin/installer/targets/aider.d.ts +6 -0
- package/dist/bin/installer/targets/aider.d.ts.map +1 -0
- package/dist/bin/installer/targets/aider.js +3 -3
- package/dist/bin/installer/targets/aider.js.map +2 -2
- package/dist/bin/installer/targets/amp.d.ts +6 -0
- package/dist/bin/installer/targets/amp.d.ts.map +1 -0
- package/dist/bin/installer/targets/amp.js +3 -3
- package/dist/bin/installer/targets/amp.js.map +2 -2
- package/dist/bin/installer/targets/antigravity.d.ts +13 -0
- package/dist/bin/installer/targets/antigravity.d.ts.map +1 -0
- package/dist/bin/installer/targets/antigravity.js +2 -2
- package/dist/bin/installer/targets/antigravity.js.map +2 -2
- package/dist/bin/installer/targets/augment.d.ts +6 -0
- package/dist/bin/installer/targets/augment.d.ts.map +1 -0
- package/dist/bin/installer/targets/augment.js +3 -3
- package/dist/bin/installer/targets/augment.js.map +2 -2
- package/dist/bin/installer/targets/claude.d.ts +6 -0
- package/dist/bin/installer/targets/claude.d.ts.map +1 -0
- package/dist/bin/installer/targets/claude.js +2 -2
- package/dist/bin/installer/targets/claude.js.map +2 -2
- package/dist/bin/installer/targets/cline.d.ts +13 -0
- package/dist/bin/installer/targets/cline.d.ts.map +1 -0
- package/dist/bin/installer/targets/cline.js +2 -2
- package/dist/bin/installer/targets/cline.js.map +2 -2
- package/dist/bin/installer/targets/codex.d.ts +6 -0
- package/dist/bin/installer/targets/codex.d.ts.map +1 -0
- package/dist/bin/installer/targets/codex.js +2 -2
- package/dist/bin/installer/targets/codex.js.map +2 -2
- package/dist/bin/installer/targets/continue.d.ts +12 -0
- package/dist/bin/installer/targets/continue.d.ts.map +1 -0
- package/dist/bin/installer/targets/continue.js +2 -2
- package/dist/bin/installer/targets/continue.js.map +2 -2
- package/dist/bin/installer/targets/copilot-cli.d.ts +12 -0
- package/dist/bin/installer/targets/copilot-cli.d.ts.map +1 -0
- package/dist/bin/installer/targets/copilot-cli.js +2 -2
- package/dist/bin/installer/targets/copilot-cli.js.map +2 -2
- package/dist/bin/installer/targets/copilot.d.ts +6 -0
- package/dist/bin/installer/targets/copilot.d.ts.map +1 -0
- package/dist/bin/installer/targets/copilot.js +2 -2
- package/dist/bin/installer/targets/copilot.js.map +2 -2
- package/dist/bin/installer/targets/cursor.d.ts +6 -0
- package/dist/bin/installer/targets/cursor.d.ts.map +1 -0
- package/dist/bin/installer/targets/cursor.js +2 -2
- package/dist/bin/installer/targets/cursor.js.map +2 -2
- package/dist/bin/installer/targets/devin.d.ts +13 -0
- package/dist/bin/installer/targets/devin.d.ts.map +1 -0
- package/dist/bin/installer/targets/devin.js +2 -2
- package/dist/bin/installer/targets/devin.js.map +2 -2
- package/dist/bin/installer/targets/gemini-cli.d.ts +16 -0
- package/dist/bin/installer/targets/gemini-cli.d.ts.map +1 -0
- package/dist/bin/installer/targets/gemini-cli.js +2 -2
- package/dist/bin/installer/targets/gemini-cli.js.map +2 -2
- package/dist/bin/installer/targets/generic.d.ts +59 -0
- package/dist/bin/installer/targets/generic.d.ts.map +1 -0
- package/dist/bin/installer/targets/generic.js +2 -2
- package/dist/bin/installer/targets/generic.js.map +2 -2
- package/dist/bin/installer/targets/goose.d.ts +6 -0
- package/dist/bin/installer/targets/goose.d.ts.map +1 -0
- package/dist/bin/installer/targets/goose.js +3 -3
- package/dist/bin/installer/targets/goose.js.map +2 -2
- package/dist/bin/installer/targets/index.d.ts +11 -0
- package/dist/bin/installer/targets/index.d.ts.map +1 -0
- package/dist/bin/installer/targets/index.js.map +1 -1
- package/dist/bin/installer/targets/junie.d.ts +13 -0
- package/dist/bin/installer/targets/junie.d.ts.map +1 -0
- package/dist/bin/installer/targets/junie.js +2 -2
- package/dist/bin/installer/targets/junie.js.map +2 -2
- package/dist/bin/installer/targets/kilo.d.ts +12 -0
- package/dist/bin/installer/targets/kilo.d.ts.map +1 -0
- package/dist/bin/installer/targets/kilo.js +2 -2
- package/dist/bin/installer/targets/kilo.js.map +2 -2
- package/dist/bin/installer/targets/kiro.d.ts +5 -0
- package/dist/bin/installer/targets/kiro.d.ts.map +1 -0
- package/dist/bin/installer/targets/kiro.js +4 -4
- package/dist/bin/installer/targets/kiro.js.map +2 -2
- package/dist/bin/installer/targets/opencode.d.ts +13 -0
- package/dist/bin/installer/targets/opencode.d.ts.map +1 -0
- package/dist/bin/installer/targets/opencode.js +2 -2
- package/dist/bin/installer/targets/opencode.js.map +2 -2
- package/dist/bin/installer/targets/openhands.d.ts +6 -0
- package/dist/bin/installer/targets/openhands.d.ts.map +1 -0
- package/dist/bin/installer/targets/openhands.js +3 -3
- package/dist/bin/installer/targets/openhands.js.map +2 -2
- package/dist/bin/installer/targets/qoder.d.ts +12 -0
- package/dist/bin/installer/targets/qoder.d.ts.map +1 -0
- package/dist/bin/installer/targets/qoder.js +2 -2
- package/dist/bin/installer/targets/qoder.js.map +2 -2
- package/dist/bin/installer/targets/qwen.d.ts +12 -0
- package/dist/bin/installer/targets/qwen.d.ts.map +1 -0
- package/dist/bin/installer/targets/qwen.js +2 -2
- package/dist/bin/installer/targets/qwen.js.map +2 -2
- package/dist/bin/installer/targets/replit.d.ts +6 -0
- package/dist/bin/installer/targets/replit.d.ts.map +1 -0
- package/dist/bin/installer/targets/replit.js +3 -3
- package/dist/bin/installer/targets/replit.js.map +2 -2
- package/dist/bin/installer/targets/roo.d.ts +13 -0
- package/dist/bin/installer/targets/roo.d.ts.map +1 -0
- package/dist/bin/installer/targets/roo.js +2 -2
- package/dist/bin/installer/targets/roo.js.map +2 -2
- package/dist/bin/installer/targets/tabnine.d.ts +6 -0
- package/dist/bin/installer/targets/tabnine.d.ts.map +1 -0
- package/dist/bin/installer/targets/tabnine.js +3 -3
- package/dist/bin/installer/targets/tabnine.js.map +2 -2
- package/dist/bin/installer/targets/trae.d.ts +6 -0
- package/dist/bin/installer/targets/trae.d.ts.map +1 -0
- package/dist/bin/installer/targets/trae.js +3 -3
- package/dist/bin/installer/targets/trae.js.map +2 -2
- package/dist/bin/installer/targets/warp.d.ts +12 -0
- package/dist/bin/installer/targets/warp.d.ts.map +1 -0
- package/dist/bin/installer/targets/warp.js +2 -2
- package/dist/bin/installer/targets/warp.js.map +2 -2
- package/dist/bin/installer/targets/windsurf.d.ts +13 -0
- package/dist/bin/installer/targets/windsurf.d.ts.map +1 -0
- package/dist/bin/installer/targets/windsurf.js +2 -2
- package/dist/bin/installer/targets/windsurf.js.map +2 -2
- package/dist/bin/kirograph.js +3 -1
- package/dist/bin/kirograph.js.map +3 -3
- package/dist/bin/progress.d.ts +16 -1
- package/dist/bin/progress.d.ts.map +1 -1
- package/dist/compression/filters/aws.d.ts +9 -0
- package/dist/compression/filters/aws.d.ts.map +1 -0
- package/dist/compression/filters/docker.d.ts +6 -0
- package/dist/compression/filters/docker.d.ts.map +1 -0
- package/dist/compression/filters/files.d.ts +6 -0
- package/dist/compression/filters/files.d.ts.map +1 -0
- package/dist/compression/filters/generic.d.ts +7 -0
- package/dist/compression/filters/generic.d.ts.map +1 -0
- package/dist/compression/filters/git.d.ts +6 -0
- package/dist/compression/filters/git.d.ts.map +1 -0
- package/dist/compression/filters/github.d.ts +6 -0
- package/dist/compression/filters/github.d.ts.map +1 -0
- package/dist/compression/filters/lint.d.ts +6 -0
- package/dist/compression/filters/lint.d.ts.map +1 -0
- package/dist/compression/filters/misc.d.ts +6 -0
- package/dist/compression/filters/misc.d.ts.map +1 -0
- package/dist/compression/filters/package.d.ts +6 -0
- package/dist/compression/filters/package.d.ts.map +1 -0
- package/dist/compression/filters/test.d.ts +6 -0
- package/dist/compression/filters/test.d.ts.map +1 -0
- package/dist/compression/index.d.ts +29 -0
- package/dist/compression/index.d.ts.map +1 -0
- package/dist/compression/naive-cost.d.ts +26 -0
- package/dist/compression/naive-cost.d.ts.map +1 -0
- package/dist/compression/tracker.d.ts +155 -0
- package/dist/compression/tracker.d.ts.map +1 -0
- package/dist/compression/types.d.ts +49 -0
- package/dist/compression/types.d.ts.map +1 -0
- package/dist/config.d.ts +90 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +55 -1
- package/dist/config.js.map +2 -2
- package/dist/core/lock-manager.d.ts +2 -0
- package/dist/core/lock-manager.d.ts.map +1 -1
- package/dist/core/pipeline.d.ts +4 -1
- package/dist/core/pipeline.d.ts.map +1 -1
- package/dist/core/pipeline.js +42 -0
- package/dist/core/pipeline.js.map +2 -2
- package/dist/core/snapshot.d.ts +58 -0
- package/dist/core/snapshot.d.ts.map +1 -0
- package/dist/data/filters.d.ts +23 -0
- package/dist/data/filters.d.ts.map +1 -0
- package/dist/data/indexer.d.ts +25 -0
- package/dist/data/indexer.d.ts.map +1 -0
- package/dist/data/linker.d.ts +37 -0
- package/dist/data/linker.d.ts.map +1 -0
- package/dist/data/lint.d.ts +27 -0
- package/dist/data/lint.d.ts.map +1 -0
- package/dist/data/parsers/csv.d.ts +11 -0
- package/dist/data/parsers/csv.d.ts.map +1 -0
- package/dist/data/parsers/excel.d.ts +10 -0
- package/dist/data/parsers/excel.d.ts.map +1 -0
- package/dist/data/parsers/index.d.ts +28 -0
- package/dist/data/parsers/index.d.ts.map +1 -0
- package/dist/data/parsers/json-array.d.ts +9 -0
- package/dist/data/parsers/json-array.d.ts.map +1 -0
- package/dist/data/parsers/jsonl.d.ts +9 -0
- package/dist/data/parsers/jsonl.d.ts.map +1 -0
- package/dist/data/parsers/parquet.d.ts +10 -0
- package/dist/data/parsers/parquet.d.ts.map +1 -0
- package/dist/data/profiler.d.ts +29 -0
- package/dist/data/profiler.d.ts.map +1 -0
- package/dist/data/queries.d.ts +95 -0
- package/dist/data/queries.d.ts.map +1 -0
- package/dist/data/types.d.ts +103 -0
- package/dist/data/types.d.ts.map +1 -0
- package/dist/db/database.d.ts +57 -0
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/database.js +19 -0
- package/dist/db/database.js.map +2 -2
- package/dist/db/patterns-schema.sql +23 -0
- package/dist/docs/formats/asciidoc.d.ts +9 -0
- package/dist/docs/formats/asciidoc.d.ts.map +1 -0
- package/dist/docs/formats/html.d.ts +10 -0
- package/dist/docs/formats/html.d.ts.map +1 -0
- package/dist/docs/formats/index.d.ts +31 -0
- package/dist/docs/formats/index.d.ts.map +1 -0
- package/dist/docs/formats/markdown.d.ts +11 -0
- package/dist/docs/formats/markdown.d.ts.map +1 -0
- package/dist/docs/formats/openapi.d.ts +17 -0
- package/dist/docs/formats/openapi.d.ts.map +1 -0
- package/dist/docs/formats/org.d.ts +9 -0
- package/dist/docs/formats/org.d.ts.map +1 -0
- package/dist/docs/formats/plaintext.d.ts +11 -0
- package/dist/docs/formats/plaintext.d.ts.map +1 -0
- package/dist/docs/formats/rdoc.d.ts +10 -0
- package/dist/docs/formats/rdoc.d.ts.map +1 -0
- package/dist/docs/formats/rst.d.ts +11 -0
- package/dist/docs/formats/rst.d.ts.map +1 -0
- package/dist/docs/indexer.d.ts +49 -0
- package/dist/docs/indexer.d.ts.map +1 -0
- package/dist/docs/linker.d.ts +30 -0
- package/dist/docs/linker.d.ts.map +1 -0
- package/dist/docs/lint.d.ts +27 -0
- package/dist/docs/lint.d.ts.map +1 -0
- package/dist/docs/queries.d.ts +78 -0
- package/dist/docs/queries.d.ts.map +1 -0
- package/dist/docs/section-id.d.ts +48 -0
- package/dist/docs/section-id.d.ts.map +1 -0
- package/dist/docs/summarizer.d.ts +13 -0
- package/dist/docs/summarizer.d.ts.map +1 -0
- package/dist/docs/types.d.ts +71 -0
- package/dist/docs/types.d.ts.map +1 -0
- package/dist/docs/vectors.d.ts +54 -0
- package/dist/docs/vectors.d.ts.map +1 -0
- package/dist/extraction/extractor.d.ts +1 -1
- package/dist/extraction/extractor.d.ts.map +1 -1
- package/dist/extraction/extractor.js +26 -3
- package/dist/extraction/extractor.js.map +2 -2
- package/dist/extraction/grammars.d.ts +6 -0
- package/dist/extraction/grammars.d.ts.map +1 -1
- package/dist/extraction/grammars.js +1 -0
- package/dist/extraction/grammars.js.map +2 -2
- package/dist/extraction/languages.d.ts.map +1 -1
- package/dist/extraction/languages.js +5 -1
- package/dist/extraction/languages.js.map +2 -2
- package/dist/extraction/notebook.d.ts +14 -0
- package/dist/extraction/notebook.d.ts.map +1 -0
- package/dist/frameworks/amplify.d.ts +9 -0
- package/dist/frameworks/amplify.d.ts.map +1 -0
- package/dist/frameworks/angular.d.ts +9 -0
- package/dist/frameworks/angular.d.ts.map +1 -0
- package/dist/frameworks/ansible.d.ts +8 -0
- package/dist/frameworks/ansible.d.ts.map +1 -0
- package/dist/frameworks/cloudformation.d.ts +9 -0
- package/dist/frameworks/cloudformation.d.ts.map +1 -0
- package/dist/frameworks/docker.d.ts +9 -0
- package/dist/frameworks/docker.d.ts.map +1 -0
- package/dist/frameworks/elixir.d.ts +6 -0
- package/dist/frameworks/elixir.d.ts.map +1 -0
- package/dist/frameworks/flutter.d.ts +12 -0
- package/dist/frameworks/flutter.d.ts.map +1 -0
- package/dist/frameworks/iac.d.ts +10 -0
- package/dist/frameworks/iac.d.ts.map +1 -0
- package/dist/frameworks/index.d.ts +14 -0
- package/dist/frameworks/index.d.ts.map +1 -1
- package/dist/frameworks/kubernetes.d.ts +9 -0
- package/dist/frameworks/kubernetes.d.ts.map +1 -0
- package/dist/frameworks/pulumi.d.ts +9 -0
- package/dist/frameworks/pulumi.d.ts.map +1 -0
- package/dist/frameworks/scala.d.ts +6 -0
- package/dist/frameworks/scala.d.ts.map +1 -0
- package/dist/frameworks/solidity.d.ts +6 -0
- package/dist/frameworks/solidity.d.ts.map +1 -0
- package/dist/frameworks/terraform.d.ts +14 -0
- package/dist/frameworks/terraform.d.ts.map +1 -0
- package/dist/frameworks/vue.d.ts +7 -0
- package/dist/frameworks/vue.d.ts.map +1 -0
- package/dist/graph/communities.d.ts +43 -0
- package/dist/graph/communities.d.ts.map +1 -0
- package/dist/graph/flows.d.ts +55 -0
- package/dist/graph/flows.d.ts.map +1 -0
- package/dist/graph/refactor.d.ts +43 -0
- package/dist/graph/refactor.d.ts.map +1 -0
- package/dist/index.d.ts +36 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/mcp/cache.d.ts +69 -0
- package/dist/mcp/cache.d.ts.map +1 -0
- package/dist/mcp/read-modes.d.ts +31 -0
- package/dist/mcp/read-modes.d.ts.map +1 -0
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +15 -2
- package/dist/mcp/server.js.map +2 -2
- package/dist/mcp/tool-names.d.ts +2 -0
- package/dist/mcp/tool-names.d.ts.map +1 -0
- package/dist/mcp/tool-names.js +4 -1
- package/dist/mcp/tool-names.js.map +2 -2
- package/dist/mcp/tools.d.ts +12 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +397 -0
- package/dist/mcp/tools.js.map +2 -2
- package/dist/memory/compress.d.ts +19 -0
- package/dist/memory/compress.d.ts.map +1 -0
- package/dist/memory/database.d.ts +92 -0
- package/dist/memory/database.d.ts.map +1 -0
- package/dist/memory/database.js +38 -0
- package/dist/memory/database.js.map +2 -2
- package/dist/memory/index.d.ts +71 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +12 -2
- package/dist/memory/index.js.map +2 -2
- package/dist/memory/symbols.d.ts +21 -0
- package/dist/memory/symbols.d.ts.map +1 -0
- package/dist/memory/types.d.ts +78 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js.map +1 -1
- package/dist/memory/vectors.d.ts +43 -0
- package/dist/memory/vectors.d.ts.map +1 -0
- package/dist/patterns/graph.d.ts +16 -0
- package/dist/patterns/graph.d.ts.map +1 -0
- package/dist/patterns/graph.js +45 -0
- package/dist/patterns/graph.js.map +7 -0
- package/dist/patterns/index.d.ts +4 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +39 -0
- package/dist/patterns/index.js.map +7 -0
- package/dist/patterns/indexer.d.ts +15 -0
- package/dist/patterns/indexer.d.ts.map +1 -0
- package/dist/patterns/indexer.js +97 -0
- package/dist/patterns/indexer.js.map +7 -0
- package/dist/patterns/library/code-eval-elixir.yaml +11 -0
- package/dist/patterns/library/command-injection-c.yaml +11 -0
- package/dist/patterns/library/command-injection-go.yaml +29 -0
- package/dist/patterns/library/command-injection-kotlin.yaml +10 -0
- package/dist/patterns/library/command-injection-php.yaml +11 -0
- package/dist/patterns/library/command-injection-ruby.yaml +11 -0
- package/dist/patterns/library/command-injection-rust.yaml +11 -0
- package/dist/patterns/library/dangerous-eval-bash.yaml +11 -0
- package/dist/patterns/library/dangerous-eval-js.yaml +14 -0
- package/dist/patterns/library/dangerous-eval-php.yaml +11 -0
- package/dist/patterns/library/dangerous-eval-ruby.yaml +11 -0
- package/dist/patterns/library/dangerous-exec-py.yaml +13 -0
- package/dist/patterns/library/dangerous-reflection-java.yaml +8 -0
- package/dist/patterns/library/dynamic-load-lua.yaml +10 -0
- package/dist/patterns/library/os-cmd-elixir.yaml +16 -0
- package/dist/patterns/library/os-execute-lua.yaml +10 -0
- package/dist/patterns/library/path-traversal-go.yaml +11 -0
- package/dist/patterns/library/path-traversal-py.yaml +12 -0
- package/dist/patterns/library/path-traversal-readfile-js.yaml +14 -0
- package/dist/patterns/library/process-launch-swift.yaml +11 -0
- package/dist/patterns/library/process-run-dart.yaml +15 -0
- package/dist/patterns/library/prototype-pollution-js.yaml +12 -0
- package/dist/patterns/library/source-injection-bash.yaml +11 -0
- package/dist/patterns/library/sql-injection-concat-js.yaml +12 -0
- package/dist/patterns/library/sql-injection-dart.yaml +9 -0
- package/dist/patterns/library/sql-injection-java.yaml +13 -0
- package/dist/patterns/library/sql-injection-kotlin.yaml +11 -0
- package/dist/patterns/library/sql-injection-php.yaml +9 -0
- package/dist/patterns/library/sql-injection-py.yaml +12 -0
- package/dist/patterns/library/sql-injection-swift.yaml +11 -0
- package/dist/patterns/library/sql-injection-template-js.yaml +13 -0
- package/dist/patterns/library/subshell-injection-ruby.yaml +8 -0
- package/dist/patterns/library/unsafe-block-rust.yaml +8 -0
- package/dist/patterns/library/unsafe-string-c.yaml +11 -0
- package/dist/patterns/library/weak-crypto-md5-js.yaml +13 -0
- package/dist/patterns/library/weak-crypto-py.yaml +13 -0
- package/dist/patterns/loader.d.ts +18 -0
- package/dist/patterns/loader.d.ts.map +1 -0
- package/dist/patterns/loader.js +277 -0
- package/dist/patterns/loader.js.map +7 -0
- package/dist/patterns/runner.d.ts +42 -0
- package/dist/patterns/runner.d.ts.map +1 -0
- package/dist/patterns/runner.js +295 -0
- package/dist/patterns/runner.js.map +7 -0
- package/dist/patterns/types.d.ts +27 -0
- package/dist/patterns/types.d.ts.map +1 -0
- package/dist/patterns/types.js +34 -0
- package/dist/patterns/types.js.map +7 -0
- package/dist/resolution/bridges/android-rn.d.ts +13 -0
- package/dist/resolution/bridges/android-rn.d.ts.map +1 -0
- package/dist/resolution/bridges/expo-modules.d.ts +10 -0
- package/dist/resolution/bridges/expo-modules.d.ts.map +1 -0
- package/dist/resolution/bridges/flutter-channel.d.ts +14 -0
- package/dist/resolution/bridges/flutter-channel.d.ts.map +1 -0
- package/dist/resolution/bridges/index.d.ts +40 -0
- package/dist/resolution/bridges/index.d.ts.map +1 -0
- package/dist/resolution/bridges/native-events.d.ts +10 -0
- package/dist/resolution/bridges/native-events.d.ts.map +1 -0
- package/dist/resolution/bridges/native-views.d.ts +13 -0
- package/dist/resolution/bridges/native-views.d.ts.map +1 -0
- package/dist/resolution/bridges/react-native.d.ts +9 -0
- package/dist/resolution/bridges/react-native.d.ts.map +1 -0
- package/dist/resolution/bridges/swift-objc.d.ts +14 -0
- package/dist/resolution/bridges/swift-objc.d.ts.map +1 -0
- package/dist/resolution/bridges/turbomodules.d.ts +10 -0
- package/dist/resolution/bridges/turbomodules.d.ts.map +1 -0
- package/dist/resolution/index.d.ts +28 -3
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/security/attack-surface.d.ts +46 -0
- package/dist/security/attack-surface.d.ts.map +1 -0
- package/dist/security/attack-surface.js +43 -1
- package/dist/security/attack-surface.js.map +2 -2
- package/dist/security/context-warnings.d.ts +40 -0
- package/dist/security/context-warnings.d.ts.map +1 -0
- package/dist/security/data-flows.d.ts +33 -0
- package/dist/security/data-flows.d.ts.map +1 -0
- package/dist/security/data-flows.js +65 -7
- package/dist/security/data-flows.js.map +2 -2
- package/dist/security/dep-confusion.d.ts +23 -0
- package/dist/security/dep-confusion.d.ts.map +1 -0
- package/dist/security/errors.d.ts +16 -0
- package/dist/security/errors.d.ts.map +1 -0
- package/dist/security/export/fix-suggestions.d.ts +21 -0
- package/dist/security/export/fix-suggestions.d.ts.map +1 -0
- package/dist/security/export/sbom.d.ts +33 -0
- package/dist/security/export/sbom.d.ts.map +1 -0
- package/dist/security/export/serialization.d.ts +62 -0
- package/dist/security/export/serialization.d.ts.map +1 -0
- package/dist/security/export/vex.d.ts +58 -0
- package/dist/security/export/vex.d.ts.map +1 -0
- package/dist/security/index.d.ts +21 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/integrator.d.ts +63 -0
- package/dist/security/integrator.d.ts.map +1 -0
- package/dist/security/integrator.js +8 -8
- package/dist/security/integrator.js.map +2 -2
- package/dist/security/license.d.ts +33 -0
- package/dist/security/license.d.ts.map +1 -0
- package/dist/security/manifest/adapter.d.ts +92 -0
- package/dist/security/manifest/adapter.d.ts.map +1 -0
- package/dist/security/manifest/parser.d.ts +73 -0
- package/dist/security/manifest/parser.d.ts.map +1 -0
- package/dist/security/manifest/plugins/cargo.d.ts +11 -0
- package/dist/security/manifest/plugins/cargo.d.ts.map +1 -0
- package/dist/security/manifest/plugins/composer.d.ts +11 -0
- package/dist/security/manifest/plugins/composer.d.ts.map +1 -0
- package/dist/security/manifest/plugins/go.d.ts +12 -0
- package/dist/security/manifest/plugins/go.d.ts.map +1 -0
- package/dist/security/manifest/plugins/gradle.d.ts +12 -0
- package/dist/security/manifest/plugins/gradle.d.ts.map +1 -0
- package/dist/security/manifest/plugins/hex.d.ts +11 -0
- package/dist/security/manifest/plugins/hex.d.ts.map +1 -0
- package/dist/security/manifest/plugins/maven.d.ts +11 -0
- package/dist/security/manifest/plugins/maven.d.ts.map +1 -0
- package/dist/security/manifest/plugins/npm.d.ts +11 -0
- package/dist/security/manifest/plugins/npm.d.ts.map +1 -0
- package/dist/security/manifest/plugins/nuget.d.ts +12 -0
- package/dist/security/manifest/plugins/nuget.d.ts.map +1 -0
- package/dist/security/manifest/plugins/pip.d.ts +11 -0
- package/dist/security/manifest/plugins/pip.d.ts.map +1 -0
- package/dist/security/manifest/plugins/pubspec.d.ts +11 -0
- package/dist/security/manifest/plugins/pubspec.d.ts.map +1 -0
- package/dist/security/manifest/plugins/pyproject.d.ts +3 -0
- package/dist/security/manifest/plugins/pyproject.d.ts.map +1 -0
- package/dist/security/manifest/plugins/rubygems.d.ts +11 -0
- package/dist/security/manifest/plugins/rubygems.d.ts.map +1 -0
- package/dist/security/manifest/plugins/swift.d.ts +11 -0
- package/dist/security/manifest/plugins/swift.d.ts.map +1 -0
- package/dist/security/owasp.d.ts +16 -0
- package/dist/security/owasp.d.ts.map +1 -0
- package/dist/security/pipeline.d.ts +37 -0
- package/dist/security/pipeline.d.ts.map +1 -0
- package/dist/security/reachability.d.ts +67 -0
- package/dist/security/reachability.d.ts.map +1 -0
- package/dist/security/remediation.d.ts +51 -0
- package/dist/security/remediation.d.ts.map +1 -0
- package/dist/security/secrets.d.ts +38 -0
- package/dist/security/secrets.d.ts.map +1 -0
- package/dist/security/staleness.d.ts +43 -0
- package/dist/security/staleness.d.ts.map +1 -0
- package/dist/security/supply-chain.d.ts +34 -0
- package/dist/security/supply-chain.d.ts.map +1 -0
- package/dist/security/suppressions.d.ts +18 -0
- package/dist/security/suppressions.d.ts.map +1 -0
- package/dist/security/types.d.ts +144 -0
- package/dist/security/types.d.ts.map +1 -0
- package/dist/security/vuln/client.d.ts +90 -0
- package/dist/security/vuln/client.d.ts.map +1 -0
- package/dist/security/vuln/client.js.map +2 -2
- package/dist/security/vuln/epss-client.d.ts +26 -0
- package/dist/security/vuln/epss-client.d.ts.map +1 -0
- package/dist/security/vuln/index.d.ts +6 -0
- package/dist/security/vuln/index.d.ts.map +1 -0
- package/dist/security/vuln/osv-adapter.d.ts +58 -0
- package/dist/security/vuln/osv-adapter.d.ts.map +1 -0
- package/dist/security/vuln/types.d.ts +29 -0
- package/dist/security/vuln/types.d.ts.map +1 -0
- package/dist/sync/index.d.ts +4 -2
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/types.d.ts +10 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +2 -2
- package/dist/vectors/index.d.ts +11 -3
- package/dist/vectors/index.d.ts.map +1 -1
- package/dist/vectors/qdrant-index.d.ts +10 -3
- package/dist/vectors/qdrant-index.d.ts.map +1 -1
- package/dist/vectors/turboquant-index.js +261 -0
- package/dist/vectors/turboquant-index.js.map +7 -0
- package/dist/vectors/typesense-index.d.ts.map +1 -1
- package/dist/watchmen/index.js +83 -0
- package/dist/watchmen/index.js.map +7 -0
- package/dist/watchmen/synthesize.js +475 -0
- package/dist/watchmen/synthesize.js.map +7 -0
- package/package.json +24 -2
- package/dist/security/context-warnings.test.js +0 -300
- package/dist/security/context-warnings.test.js.map +0 -7
- package/dist/security/export/fix-suggestions.test.js +0 -74
- package/dist/security/export/fix-suggestions.test.js.map +0 -7
- package/dist/security/export/sbom.test.js +0 -288
- package/dist/security/export/sbom.test.js.map +0 -7
- package/dist/security/export/serialization.test.js +0 -310
- package/dist/security/export/serialization.test.js.map +0 -7
- package/dist/security/export/vex.test.js +0 -278
- package/dist/security/export/vex.test.js.map +0 -7
- package/dist/security/integrator-transitives.test.js +0 -359
- package/dist/security/integrator-transitives.test.js.map +0 -7
- package/dist/security/integrator.test.js +0 -237
- package/dist/security/integrator.test.js.map +0 -7
- package/dist/security/manifest/adapter.test.js +0 -272
- package/dist/security/manifest/adapter.test.js.map +0 -7
- package/dist/security/manifest/parser.test.js +0 -110
- package/dist/security/manifest/parser.test.js.map +0 -7
- package/dist/security/manifest/plugins/cargo.test.js +0 -304
- package/dist/security/manifest/plugins/cargo.test.js.map +0 -7
- package/dist/security/manifest/plugins/go.test.js +0 -341
- package/dist/security/manifest/plugins/go.test.js.map +0 -7
- package/dist/security/manifest/plugins/maven.test.js +0 -389
- package/dist/security/manifest/plugins/maven.test.js.map +0 -7
- package/dist/security/manifest/plugins/npm.test.js +0 -298
- package/dist/security/manifest/plugins/npm.test.js.map +0 -7
- package/dist/security/manifest/plugins/pip.test.js +0 -208
- package/dist/security/manifest/plugins/pip.test.js.map +0 -7
- package/dist/security/reachability.test.js +0 -394
- package/dist/security/reachability.test.js.map +0 -7
- package/dist/security/vuln/client.test.js +0 -288
- package/dist/security/vuln/client.test.js.map +0 -7
- package/dist/security/vuln/osv-adapter.test.js +0 -391
- package/dist/security/vuln/osv-adapter.test.js.map +0 -7
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
id: process-run-dart
|
|
2
|
+
language: dart
|
|
3
|
+
severity: critical
|
|
4
|
+
owaspCategory: A03
|
|
5
|
+
description: Process.run() or Process.start() — command injection vector if arguments are user-controlled
|
|
6
|
+
fixHint: Pass a fixed executable and a validated list of arguments. Never build arguments from unsanitised user input.
|
|
7
|
+
rule:
|
|
8
|
+
kind: expression_statement
|
|
9
|
+
all:
|
|
10
|
+
- has:
|
|
11
|
+
kind: identifier
|
|
12
|
+
regex: '^Process$'
|
|
13
|
+
- has:
|
|
14
|
+
kind: selector
|
|
15
|
+
regex: '^\.run|^\.start'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
id: prototype-pollution-js
|
|
2
|
+
language: [javascript, typescript]
|
|
3
|
+
severity: high
|
|
4
|
+
owaspCategory: A08
|
|
5
|
+
description: Assignment to __proto__ enables prototype pollution
|
|
6
|
+
fixHint: Validate object keys before merge. Use Object.create(null) for dictionaries. Avoid merging untrusted objects.
|
|
7
|
+
fix: "/* REMOVE: prototype pollution — use Object.assign({}, ...) instead */"
|
|
8
|
+
rule:
|
|
9
|
+
any:
|
|
10
|
+
- pattern: $OBJ["__proto__"] = $VAL
|
|
11
|
+
- pattern: $OBJ.__proto__ = $VAL
|
|
12
|
+
- pattern: $OBJ["constructor"]["prototype"] = $VAL
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
id: source-injection-bash
|
|
2
|
+
language: bash
|
|
3
|
+
severity: high
|
|
4
|
+
owaspCategory: A03
|
|
5
|
+
description: source/. with a variable path — arbitrary script execution
|
|
6
|
+
fixHint: Hardcode the script path or validate it against an allowlist before sourcing.
|
|
7
|
+
rule:
|
|
8
|
+
kind: command
|
|
9
|
+
has:
|
|
10
|
+
kind: command_name
|
|
11
|
+
regex: '^(source|\.)$'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
id: sql-injection-concat-js
|
|
2
|
+
language: [javascript, typescript]
|
|
3
|
+
severity: critical
|
|
4
|
+
owaspCategory: A03
|
|
5
|
+
description: SQL query built by string concatenation — classic injection vector
|
|
6
|
+
fixHint: Use parameterized queries. Never concatenate user-controlled values into SQL strings.
|
|
7
|
+
fix: "/* TODO: use parameterized query */ $DB.query('?', [$B])"
|
|
8
|
+
rule:
|
|
9
|
+
any:
|
|
10
|
+
- pattern: $DB.query($A + $B)
|
|
11
|
+
- pattern: $DB.execute($A + $B)
|
|
12
|
+
- pattern: $DB.run($A + $B)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
id: sql-injection-dart
|
|
2
|
+
language: dart
|
|
3
|
+
severity: critical
|
|
4
|
+
owaspCategory: A03
|
|
5
|
+
description: SQL query built by string concatenation — SQL injection vector
|
|
6
|
+
fixHint: Use parameterized queries with ? placeholder lists. Never concatenate user input into SQL strings.
|
|
7
|
+
rule:
|
|
8
|
+
kind: additive_expression
|
|
9
|
+
regex: '(SELECT|INSERT|UPDATE|DELETE|UNION)'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
id: sql-injection-java
|
|
2
|
+
language: java
|
|
3
|
+
severity: critical
|
|
4
|
+
owaspCategory: A03
|
|
5
|
+
description: JDBC query built by string concatenation — SQL injection vector
|
|
6
|
+
fixHint: Use PreparedStatement with ? placeholders. Never concatenate user input into SQL.
|
|
7
|
+
fix: "stmt.executeQuery(\"SELECT ... WHERE id = ?\")"
|
|
8
|
+
rule:
|
|
9
|
+
any:
|
|
10
|
+
- pattern: $CONN.createStatement().executeQuery($A + $B)
|
|
11
|
+
- pattern: $STMT.executeQuery($A + $B)
|
|
12
|
+
- pattern: $STMT.execute($A + $B)
|
|
13
|
+
- pattern: $STMT.executeUpdate($A + $B)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
id: sql-injection-kotlin
|
|
2
|
+
language: kotlin
|
|
3
|
+
severity: critical
|
|
4
|
+
owaspCategory: A03
|
|
5
|
+
description: JDBC query built by string concatenation — SQL injection vector
|
|
6
|
+
fixHint: Use PreparedStatement with ? placeholders. Never concatenate user input into SQL strings.
|
|
7
|
+
rule:
|
|
8
|
+
any:
|
|
9
|
+
- pattern: µSTMT.executeQuery(µA + µB)
|
|
10
|
+
- pattern: µSTMT.execute(µA + µB)
|
|
11
|
+
- pattern: µSTMT.executeUpdate(µA + µB)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
id: sql-injection-php
|
|
2
|
+
language: php
|
|
3
|
+
severity: critical
|
|
4
|
+
owaspCategory: A03
|
|
5
|
+
description: SQL query built by string concatenation (.) — SQL injection vector
|
|
6
|
+
fixHint: Use PDO prepared statements with ? placeholders and bound parameters. Never concatenate user input into SQL.
|
|
7
|
+
rule:
|
|
8
|
+
kind: binary_expression
|
|
9
|
+
regex: '(SELECT|INSERT|UPDATE|DELETE|UNION)'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
id: sql-injection-py
|
|
2
|
+
language: python
|
|
3
|
+
severity: critical
|
|
4
|
+
owaspCategory: A03
|
|
5
|
+
description: SQL query built with Python string formatting — injection vector
|
|
6
|
+
fixHint: Use parameterized queries with %s placeholders and pass values as a tuple. Never use % or .format() with SQL.
|
|
7
|
+
fix: "cursor.execute('SELECT ... WHERE col = %s', ($ARGS,))"
|
|
8
|
+
rule:
|
|
9
|
+
any:
|
|
10
|
+
- pattern: cursor.execute($Q % $ARGS)
|
|
11
|
+
- pattern: cursor.execute($Q.format($$$ARGS))
|
|
12
|
+
- pattern: cursor.execute(f"$$$SQL")
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
id: sql-injection-swift
|
|
2
|
+
language: swift
|
|
3
|
+
severity: critical
|
|
4
|
+
owaspCategory: A03
|
|
5
|
+
description: SQL query built by string concatenation — SQL injection vector
|
|
6
|
+
fixHint: Use parameterized queries with ? placeholders. Never concatenate user input into SQL strings.
|
|
7
|
+
rule:
|
|
8
|
+
any:
|
|
9
|
+
- pattern: µDB.execute(µA + µB)
|
|
10
|
+
- pattern: µDB.query(µA + µB)
|
|
11
|
+
- pattern: µDB.run(µA + µB)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
id: sql-injection-template-js
|
|
2
|
+
language: [javascript, typescript]
|
|
3
|
+
severity: critical
|
|
4
|
+
owaspCategory: A03
|
|
5
|
+
description: SQL query built with template literal containing substitution — injection vector
|
|
6
|
+
fixHint: Use parameterized queries with ? placeholders. Template literals with user data are injectable.
|
|
7
|
+
fix: "/* TODO: replace with parameterized query */"
|
|
8
|
+
rule:
|
|
9
|
+
any:
|
|
10
|
+
- pattern: $DB.query(`$$$`)
|
|
11
|
+
- pattern: $DB.execute(`$$$`)
|
|
12
|
+
- pattern: $DB.run(`$$$`)
|
|
13
|
+
- pattern: $DB.exec(`$$$`)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
id: subshell-injection-ruby
|
|
2
|
+
language: ruby
|
|
3
|
+
severity: critical
|
|
4
|
+
owaspCategory: A03
|
|
5
|
+
description: Backtick or %x{} subshell execution — command injection vector
|
|
6
|
+
fixHint: Replace subshell calls with Open3.capture2e using an argument array. Never interpolate user input into shell strings.
|
|
7
|
+
rule:
|
|
8
|
+
kind: subshell
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
id: unsafe-block-rust
|
|
2
|
+
language: rust
|
|
3
|
+
severity: high
|
|
4
|
+
owaspCategory: A04
|
|
5
|
+
description: unsafe block — bypasses Rust memory-safety guarantees
|
|
6
|
+
fixHint: Minimise unsafe surface; wrap raw pointer operations in a safe abstraction and document invariants.
|
|
7
|
+
rule:
|
|
8
|
+
kind: unsafe_block
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
id: unsafe-string-c
|
|
2
|
+
language: [c, cpp]
|
|
3
|
+
severity: high
|
|
4
|
+
owaspCategory: A04
|
|
5
|
+
description: Unsafe C string function (strcpy/strcat/gets/sprintf) — buffer overflow vector
|
|
6
|
+
fixHint: Use strncpy/strncat/fgets/snprintf with explicit size limits. Prefer bounded alternatives everywhere.
|
|
7
|
+
rule:
|
|
8
|
+
kind: call_expression
|
|
9
|
+
has:
|
|
10
|
+
kind: identifier
|
|
11
|
+
regex: '^(strcpy|strcat|gets|sprintf|vsprintf)$'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
id: weak-crypto-md5-js
|
|
2
|
+
language: [javascript, typescript]
|
|
3
|
+
severity: medium
|
|
4
|
+
owaspCategory: A02
|
|
5
|
+
description: MD5 or SHA-1 are cryptographically broken — do not use for security purposes
|
|
6
|
+
fixHint: Use SHA-256 or SHA-3 for hashing. Use bcrypt/argon2 for passwords. Use AES-GCM for encryption.
|
|
7
|
+
fix: "createHash('sha256')"
|
|
8
|
+
rule:
|
|
9
|
+
any:
|
|
10
|
+
- pattern: createHash('md5')
|
|
11
|
+
- pattern: createHash('sha1')
|
|
12
|
+
- pattern: createHash("md5")
|
|
13
|
+
- pattern: createHash("sha1")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
id: weak-crypto-py
|
|
2
|
+
language: python
|
|
3
|
+
severity: medium
|
|
4
|
+
owaspCategory: A02
|
|
5
|
+
description: MD5 or SHA-1 are cryptographically broken
|
|
6
|
+
fixHint: Use hashlib.sha256() or hashlib.sha3_256() for hashing. Use bcrypt for passwords.
|
|
7
|
+
fix: "hashlib.sha256($$$)"
|
|
8
|
+
rule:
|
|
9
|
+
any:
|
|
10
|
+
- pattern: hashlib.md5($$$)
|
|
11
|
+
- pattern: hashlib.sha1($$$)
|
|
12
|
+
- pattern: hashlib.new('md5', $$$)
|
|
13
|
+
- pattern: hashlib.new('sha1', $$$)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KiroGraph PatternLibraryLoader — loads and merges YAML pattern rule files.
|
|
3
|
+
*
|
|
4
|
+
* js-yaml is not a declared dependency, so this uses a lightweight inline parser
|
|
5
|
+
* that handles the flat key:value + nested rule: block format used by KiroGraph
|
|
6
|
+
* pattern rule files.
|
|
7
|
+
*/
|
|
8
|
+
import { PatternRule } from './types';
|
|
9
|
+
export declare class PatternLibraryLoader {
|
|
10
|
+
/**
|
|
11
|
+
* Load, validate, and merge rules from the builtin path and optional custom path.
|
|
12
|
+
* User-supplied rules override bundled rules on id collision.
|
|
13
|
+
*/
|
|
14
|
+
load(builtinPath: string, customPath?: string): PatternRule[];
|
|
15
|
+
private _loadDirectory;
|
|
16
|
+
private _validate;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/patterns/loader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAyMtC,qBAAa,oBAAoB;IAC/B;;;OAGG;IACH,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,WAAW,EAAE;IAmB7D,OAAO,CAAC,cAAc;IAsCtB,OAAO,CAAC,SAAS;CA2ClB"}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var loader_exports = {};
|
|
30
|
+
__export(loader_exports, {
|
|
31
|
+
PatternLibraryLoader: () => PatternLibraryLoader
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(loader_exports);
|
|
34
|
+
var fs = __toESM(require("fs"));
|
|
35
|
+
var path = __toESM(require("path"));
|
|
36
|
+
var import_errors = require("../errors");
|
|
37
|
+
function _parseYaml(text) {
|
|
38
|
+
const lines = text.split("\n");
|
|
39
|
+
return _parseBlock(lines, 0, 0).result;
|
|
40
|
+
}
|
|
41
|
+
function _parseBlock(lines, startIndex, baseIndent) {
|
|
42
|
+
const result = {};
|
|
43
|
+
let i = startIndex;
|
|
44
|
+
while (i < lines.length) {
|
|
45
|
+
const rawLine = lines[i];
|
|
46
|
+
const commentIdx = rawLine.indexOf(" #");
|
|
47
|
+
const line = commentIdx >= 0 ? rawLine.slice(0, commentIdx) : rawLine;
|
|
48
|
+
if (line.trim() === "" || line.trim().startsWith("#")) {
|
|
49
|
+
i++;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
const indent = _countIndent(rawLine);
|
|
53
|
+
if (indent < baseIndent) break;
|
|
54
|
+
if (indent > baseIndent && Object.keys(result).length === 0) {
|
|
55
|
+
i++;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (indent > baseIndent) {
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
const trimmed = line.trim();
|
|
62
|
+
const colonIdx = trimmed.indexOf(":");
|
|
63
|
+
if (colonIdx <= 0) {
|
|
64
|
+
i++;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const key = trimmed.slice(0, colonIdx).trim();
|
|
68
|
+
const rest = trimmed.slice(colonIdx + 1).trimStart();
|
|
69
|
+
if (rest === "" || rest === "|" || rest === ">") {
|
|
70
|
+
const nextContentLine = _findNextContent(lines, i + 1);
|
|
71
|
+
if (nextContentLine === -1) {
|
|
72
|
+
result[key] = null;
|
|
73
|
+
i++;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const nextIndent = _countIndent(lines[nextContentLine]);
|
|
77
|
+
if (nextIndent > indent) {
|
|
78
|
+
if (lines[nextContentLine].trim().startsWith("- ")) {
|
|
79
|
+
const { items, nextIndex } = _parseSequence(lines, nextContentLine, nextIndent);
|
|
80
|
+
result[key] = items;
|
|
81
|
+
i = nextIndex;
|
|
82
|
+
} else {
|
|
83
|
+
const { result: subResult, nextIndex } = _parseBlock(lines, nextContentLine, nextIndent);
|
|
84
|
+
result[key] = subResult;
|
|
85
|
+
i = nextIndex;
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
result[key] = null;
|
|
89
|
+
i++;
|
|
90
|
+
}
|
|
91
|
+
} else if (rest.startsWith("[")) {
|
|
92
|
+
result[key] = _parseInlineArray(rest);
|
|
93
|
+
i++;
|
|
94
|
+
} else {
|
|
95
|
+
result[key] = _parseScalar(rest);
|
|
96
|
+
i++;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return { result, nextIndex: i };
|
|
100
|
+
}
|
|
101
|
+
function _parseSequence(lines, startIndex, baseIndent) {
|
|
102
|
+
const items = [];
|
|
103
|
+
let i = startIndex;
|
|
104
|
+
while (i < lines.length) {
|
|
105
|
+
const rawLine = lines[i];
|
|
106
|
+
if (rawLine.trim() === "" || rawLine.trim().startsWith("#")) {
|
|
107
|
+
i++;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const indent = _countIndent(rawLine);
|
|
111
|
+
if (indent < baseIndent) break;
|
|
112
|
+
const trimmed = rawLine.trim();
|
|
113
|
+
if (!trimmed.startsWith("- ") && trimmed !== "-") {
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
const itemValue = trimmed.startsWith("- ") ? trimmed.slice(2).trim() : "";
|
|
117
|
+
if (itemValue === "" || itemValue === "|" || itemValue === ">") {
|
|
118
|
+
const nextContentLine = _findNextContent(lines, i + 1);
|
|
119
|
+
if (nextContentLine !== -1 && _countIndent(lines[nextContentLine]) > indent) {
|
|
120
|
+
const { result: subResult, nextIndex } = _parseBlock(lines, nextContentLine, _countIndent(lines[nextContentLine]));
|
|
121
|
+
items.push(subResult);
|
|
122
|
+
i = nextIndex;
|
|
123
|
+
} else {
|
|
124
|
+
items.push(null);
|
|
125
|
+
i++;
|
|
126
|
+
}
|
|
127
|
+
} else if (itemValue.includes(":")) {
|
|
128
|
+
const itemIndent = indent + 2;
|
|
129
|
+
const continuationLines = [];
|
|
130
|
+
let j = i + 1;
|
|
131
|
+
while (j < lines.length) {
|
|
132
|
+
const nextRaw = lines[j];
|
|
133
|
+
if (nextRaw.trim() === "" || nextRaw.trim().startsWith("#")) {
|
|
134
|
+
j++;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (_countIndent(nextRaw) >= itemIndent) {
|
|
138
|
+
continuationLines.push(nextRaw);
|
|
139
|
+
j++;
|
|
140
|
+
} else {
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const blockLines = [" ".repeat(itemIndent) + itemValue, ...continuationLines];
|
|
145
|
+
const { result: subResult } = _parseBlock(blockLines, 0, itemIndent);
|
|
146
|
+
items.push(subResult);
|
|
147
|
+
i = j;
|
|
148
|
+
} else {
|
|
149
|
+
items.push(_parseScalar(itemValue));
|
|
150
|
+
i++;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return { items, nextIndex: i };
|
|
154
|
+
}
|
|
155
|
+
function _parseInlineArray(text) {
|
|
156
|
+
const inner = text.replace(/^\[/, "").replace(/\].*$/, "");
|
|
157
|
+
return inner.split(",").map((s) => _parseScalar(s.trim())).filter((s) => s !== null && s !== void 0);
|
|
158
|
+
}
|
|
159
|
+
function _parseScalar(text) {
|
|
160
|
+
if (text === "true") return true;
|
|
161
|
+
if (text === "false") return false;
|
|
162
|
+
if (text === "null" || text === "~") return null;
|
|
163
|
+
if (/^-?\d+$/.test(text)) return parseInt(text, 10);
|
|
164
|
+
if (/^-?\d+\.\d+$/.test(text)) return parseFloat(text);
|
|
165
|
+
if (text.startsWith('"') && text.endsWith('"') || text.startsWith("'") && text.endsWith("'")) {
|
|
166
|
+
return text.slice(1, -1);
|
|
167
|
+
}
|
|
168
|
+
return text;
|
|
169
|
+
}
|
|
170
|
+
function _countIndent(line) {
|
|
171
|
+
let i = 0;
|
|
172
|
+
while (i < line.length && line[i] === " ") i++;
|
|
173
|
+
return i;
|
|
174
|
+
}
|
|
175
|
+
function _findNextContent(lines, startIndex) {
|
|
176
|
+
for (let i = startIndex; i < lines.length; i++) {
|
|
177
|
+
const t = lines[i].trim();
|
|
178
|
+
if (t !== "" && !t.startsWith("#")) return i;
|
|
179
|
+
}
|
|
180
|
+
return -1;
|
|
181
|
+
}
|
|
182
|
+
class PatternLibraryLoader {
|
|
183
|
+
/**
|
|
184
|
+
* Load, validate, and merge rules from the builtin path and optional custom path.
|
|
185
|
+
* User-supplied rules override bundled rules on id collision.
|
|
186
|
+
*/
|
|
187
|
+
load(builtinPath, customPath) {
|
|
188
|
+
const builtin = this._loadDirectory(builtinPath, "builtin");
|
|
189
|
+
const builtinMap = /* @__PURE__ */ new Map();
|
|
190
|
+
for (const rule of builtin) builtinMap.set(rule.id, rule);
|
|
191
|
+
if (!customPath) return builtin;
|
|
192
|
+
const custom = this._loadDirectory(customPath, "custom");
|
|
193
|
+
const merged = new Map(builtinMap);
|
|
194
|
+
for (const rule of custom) {
|
|
195
|
+
if (merged.has(rule.id)) {
|
|
196
|
+
(0, import_errors.logWarn)(`PatternLibraryLoader: custom rule "${rule.id}" overrides bundled rule`);
|
|
197
|
+
}
|
|
198
|
+
merged.set(rule.id, rule);
|
|
199
|
+
}
|
|
200
|
+
return [...merged.values()];
|
|
201
|
+
}
|
|
202
|
+
_loadDirectory(dirPath, source) {
|
|
203
|
+
if (!fs.existsSync(dirPath)) {
|
|
204
|
+
(0, import_errors.logWarn)(`PatternLibraryLoader: ${source} library path does not exist: ${dirPath}`);
|
|
205
|
+
return [];
|
|
206
|
+
}
|
|
207
|
+
const rules = [];
|
|
208
|
+
const seenIds = /* @__PURE__ */ new Map();
|
|
209
|
+
let files;
|
|
210
|
+
try {
|
|
211
|
+
files = fs.readdirSync(dirPath).filter((f) => f.endsWith(".yaml") || f.endsWith(".yml"));
|
|
212
|
+
} catch (err) {
|
|
213
|
+
(0, import_errors.logWarn)(`PatternLibraryLoader: failed to read ${source} directory "${dirPath}": ${err instanceof Error ? err.message : String(err)}`);
|
|
214
|
+
return [];
|
|
215
|
+
}
|
|
216
|
+
for (const file of files) {
|
|
217
|
+
const filePath = path.join(dirPath, file);
|
|
218
|
+
try {
|
|
219
|
+
const text = fs.readFileSync(filePath, "utf8");
|
|
220
|
+
const parsed = _parseYaml(text);
|
|
221
|
+
const rule = this._validate(parsed, filePath);
|
|
222
|
+
if (!rule) continue;
|
|
223
|
+
if (seenIds.has(rule.id)) {
|
|
224
|
+
(0, import_errors.logWarn)(`PatternLibraryLoader: duplicate rule id "${rule.id}" in ${source} library \u2014 found in "${seenIds.get(rule.id)}" and "${filePath}", using last loaded`);
|
|
225
|
+
}
|
|
226
|
+
seenIds.set(rule.id, filePath);
|
|
227
|
+
rules.push(rule);
|
|
228
|
+
} catch (err) {
|
|
229
|
+
(0, import_errors.logWarn)(`PatternLibraryLoader: failed to load rule file "${filePath}": ${err instanceof Error ? err.message : String(err)}`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return rules;
|
|
233
|
+
}
|
|
234
|
+
_validate(parsed, filePath) {
|
|
235
|
+
const required = ["id", "language", "severity", "owaspCategory", "description", "fixHint", "rule"];
|
|
236
|
+
for (const field of required) {
|
|
237
|
+
if (parsed[field] === void 0 || parsed[field] === null) {
|
|
238
|
+
(0, import_errors.logWarn)(`PatternLibraryLoader: rule file "${filePath}" is missing required field "${field}", skipping`);
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const id = String(parsed["id"]);
|
|
243
|
+
const language = parsed["language"];
|
|
244
|
+
const severity = String(parsed["severity"]);
|
|
245
|
+
const owaspCategory = String(parsed["owaspCategory"]);
|
|
246
|
+
const description = String(parsed["description"]);
|
|
247
|
+
const fixHint = String(parsed["fixHint"]);
|
|
248
|
+
const rule = parsed["rule"];
|
|
249
|
+
const validSeverities = /* @__PURE__ */ new Set(["critical", "high", "medium", "low"]);
|
|
250
|
+
if (!validSeverities.has(severity)) {
|
|
251
|
+
(0, import_errors.logWarn)(`PatternLibraryLoader: rule file "${filePath}" has invalid severity "${severity}", skipping`);
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
if (typeof language !== "string" && !Array.isArray(language)) {
|
|
255
|
+
(0, import_errors.logWarn)(`PatternLibraryLoader: rule file "${filePath}" has invalid language field, skipping`);
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
if (typeof rule !== "object" || Array.isArray(rule) || rule === null) {
|
|
259
|
+
(0, import_errors.logWarn)(`PatternLibraryLoader: rule file "${filePath}" has invalid rule field (must be an object), skipping`);
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
id,
|
|
264
|
+
language: Array.isArray(language) ? language : String(language),
|
|
265
|
+
severity,
|
|
266
|
+
owaspCategory,
|
|
267
|
+
description,
|
|
268
|
+
fixHint,
|
|
269
|
+
rule
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
274
|
+
0 && (module.exports = {
|
|
275
|
+
PatternLibraryLoader
|
|
276
|
+
});
|
|
277
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/patterns/loader.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph PatternLibraryLoader \u2014 loads and merges YAML pattern rule files.\n *\n * js-yaml is not a declared dependency, so this uses a lightweight inline parser\n * that handles the flat key:value + nested rule: block format used by KiroGraph\n * pattern rule files.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { PatternRule } from './types';\nimport { logWarn } from '../errors';\n\n// \u2500\u2500 Minimal YAML parser \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n//\n// Supports the subset of YAML used by KiroGraph pattern files:\n// - Flat key: value (string, boolean, number)\n// - key: [item1, item2] (inline array)\n// - key:\\n - item (block sequence for simple values)\n// - rule:\\n (nested block as raw sub-object \u2014 parsed recursively)\n// - Quoted strings: \"...\" and '...'\n// - Comments: # ...\n\nfunction _parseYaml(text: string): Record<string, unknown> {\n const lines = text.split('\\n');\n return _parseBlock(lines, 0, 0).result;\n}\n\ninterface BlockResult {\n result: Record<string, unknown>;\n nextIndex: number;\n}\n\nfunction _parseBlock(lines: string[], startIndex: number, baseIndent: number): BlockResult {\n const result: Record<string, unknown> = {};\n let i = startIndex;\n\n while (i < lines.length) {\n const rawLine = lines[i];\n // Strip trailing comments (but not inside strings \u2014 simplified approach)\n const commentIdx = rawLine.indexOf(' #');\n const line = commentIdx >= 0 ? rawLine.slice(0, commentIdx) : rawLine;\n\n // Skip blank lines\n if (line.trim() === '' || line.trim().startsWith('#')) {\n i++;\n continue;\n }\n\n const indent = _countIndent(rawLine);\n\n // If we've de-indented past our base, stop\n if (indent < baseIndent) break;\n\n // Skip lines that are at an indent level below our block's base\n if (indent > baseIndent && Object.keys(result).length === 0) {\n // Haven't started the block yet \u2014 shouldn't happen but skip\n i++;\n continue;\n }\n\n if (indent > baseIndent) {\n // This belongs to a child block already being processed \u2014 stop\n break;\n }\n\n const trimmed = line.trim();\n\n // Detect key: ... pattern\n const colonIdx = trimmed.indexOf(':');\n if (colonIdx <= 0) {\n i++;\n continue;\n }\n\n const key = trimmed.slice(0, colonIdx).trim();\n const rest = trimmed.slice(colonIdx + 1).trimStart();\n\n if (rest === '' || rest === '|' || rest === '>') {\n // Value is on the following lines \u2014 could be a nested block or block scalar\n // Peek ahead: if next non-empty line is indented more, recurse\n const nextContentLine = _findNextContent(lines, i + 1);\n if (nextContentLine === -1) {\n result[key] = null;\n i++;\n continue;\n }\n const nextIndent = _countIndent(lines[nextContentLine]);\n if (nextIndent > indent) {\n // Check if next line is a sequence item (- ...)\n if (lines[nextContentLine].trim().startsWith('- ')) {\n const { items, nextIndex } = _parseSequence(lines, nextContentLine, nextIndent);\n result[key] = items;\n i = nextIndex;\n } else {\n const { result: subResult, nextIndex } = _parseBlock(lines, nextContentLine, nextIndent);\n result[key] = subResult;\n i = nextIndex;\n }\n } else {\n result[key] = null;\n i++;\n }\n } else if (rest.startsWith('[')) {\n // Inline array: [a, b, c]\n result[key] = _parseInlineArray(rest);\n i++;\n } else {\n // Scalar value\n result[key] = _parseScalar(rest);\n i++;\n }\n }\n\n return { result, nextIndex: i };\n}\n\nfunction _parseSequence(lines: string[], startIndex: number, baseIndent: number): { items: unknown[]; nextIndex: number } {\n const items: unknown[] = [];\n let i = startIndex;\n\n while (i < lines.length) {\n const rawLine = lines[i];\n if (rawLine.trim() === '' || rawLine.trim().startsWith('#')) {\n i++;\n continue;\n }\n const indent = _countIndent(rawLine);\n if (indent < baseIndent) break;\n\n const trimmed = rawLine.trim();\n if (!trimmed.startsWith('- ') && trimmed !== '-') {\n break;\n }\n\n const itemValue = trimmed.startsWith('- ') ? trimmed.slice(2).trim() : '';\n\n if (itemValue === '' || itemValue === '|' || itemValue === '>') {\n // Multi-line sequence item\n const nextContentLine = _findNextContent(lines, i + 1);\n if (nextContentLine !== -1 && _countIndent(lines[nextContentLine]) > indent) {\n const { result: subResult, nextIndex } = _parseBlock(lines, nextContentLine, _countIndent(lines[nextContentLine]));\n items.push(subResult);\n i = nextIndex;\n } else {\n items.push(null);\n i++;\n }\n } else if (itemValue.includes(':')) {\n // Inline key:value item \u2014 parse as sub-object, collecting any indented continuation lines\n // Find continuation lines indented deeper than this item\n const itemIndent = indent + 2;\n const continuationLines: string[] = [];\n let j = i + 1;\n while (j < lines.length) {\n const nextRaw = lines[j];\n if (nextRaw.trim() === '' || nextRaw.trim().startsWith('#')) { j++; continue; }\n if (_countIndent(nextRaw) >= itemIndent) {\n continuationLines.push(nextRaw);\n j++;\n } else {\n break;\n }\n }\n const blockLines = [' '.repeat(itemIndent) + itemValue, ...continuationLines];\n const { result: subResult } = _parseBlock(blockLines, 0, itemIndent);\n items.push(subResult);\n i = j;\n } else {\n items.push(_parseScalar(itemValue));\n i++;\n }\n }\n\n return { items, nextIndex: i };\n}\n\nfunction _parseInlineArray(text: string): string[] {\n const inner = text.replace(/^\\[/, '').replace(/\\].*$/, '');\n return inner.split(',').map(s => _parseScalar(s.trim()) as string).filter(s => s !== null && s !== undefined) as string[];\n}\n\nfunction _parseScalar(text: string): unknown {\n if (text === 'true') return true;\n if (text === 'false') return false;\n if (text === 'null' || text === '~') return null;\n if (/^-?\\d+$/.test(text)) return parseInt(text, 10);\n if (/^-?\\d+\\.\\d+$/.test(text)) return parseFloat(text);\n // Quoted string\n if ((text.startsWith('\"') && text.endsWith('\"')) || (text.startsWith(\"'\") && text.endsWith(\"'\"))) {\n return text.slice(1, -1);\n }\n return text;\n}\n\nfunction _countIndent(line: string): number {\n let i = 0;\n while (i < line.length && line[i] === ' ') i++;\n return i;\n}\n\nfunction _findNextContent(lines: string[], startIndex: number): number {\n for (let i = startIndex; i < lines.length; i++) {\n const t = lines[i].trim();\n if (t !== '' && !t.startsWith('#')) return i;\n }\n return -1;\n}\n\n// \u2500\u2500 PatternLibraryLoader \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport class PatternLibraryLoader {\n /**\n * Load, validate, and merge rules from the builtin path and optional custom path.\n * User-supplied rules override bundled rules on id collision.\n */\n load(builtinPath: string, customPath?: string): PatternRule[] {\n const builtin = this._loadDirectory(builtinPath, 'builtin');\n const builtinMap = new Map<string, PatternRule>();\n for (const rule of builtin) builtinMap.set(rule.id, rule);\n\n if (!customPath) return builtin;\n\n const custom = this._loadDirectory(customPath, 'custom');\n const merged = new Map<string, PatternRule>(builtinMap);\n for (const rule of custom) {\n if (merged.has(rule.id)) {\n logWarn(`PatternLibraryLoader: custom rule \"${rule.id}\" overrides bundled rule`);\n }\n merged.set(rule.id, rule);\n }\n\n return [...merged.values()];\n }\n\n private _loadDirectory(dirPath: string, source: string): PatternRule[] {\n if (!fs.existsSync(dirPath)) {\n logWarn(`PatternLibraryLoader: ${source} library path does not exist: ${dirPath}`);\n return [];\n }\n\n const rules: PatternRule[] = [];\n const seenIds = new Map<string, string>();\n\n let files: string[];\n try {\n files = fs.readdirSync(dirPath).filter(f => f.endsWith('.yaml') || f.endsWith('.yml'));\n } catch (err) {\n logWarn(`PatternLibraryLoader: failed to read ${source} directory \"${dirPath}\": ${err instanceof Error ? err.message : String(err)}`);\n return [];\n }\n\n for (const file of files) {\n const filePath = path.join(dirPath, file);\n try {\n const text = fs.readFileSync(filePath, 'utf8');\n const parsed = _parseYaml(text);\n const rule = this._validate(parsed, filePath);\n if (!rule) continue;\n\n if (seenIds.has(rule.id)) {\n logWarn(`PatternLibraryLoader: duplicate rule id \"${rule.id}\" in ${source} library \u2014 found in \"${seenIds.get(rule.id)}\" and \"${filePath}\", using last loaded`);\n }\n seenIds.set(rule.id, filePath);\n rules.push(rule);\n } catch (err) {\n logWarn(`PatternLibraryLoader: failed to load rule file \"${filePath}\": ${err instanceof Error ? err.message : String(err)}`);\n }\n }\n\n return rules;\n }\n\n private _validate(parsed: Record<string, unknown>, filePath: string): PatternRule | null {\n const required = ['id', 'language', 'severity', 'owaspCategory', 'description', 'fixHint', 'rule'];\n for (const field of required) {\n if (parsed[field] === undefined || parsed[field] === null) {\n logWarn(`PatternLibraryLoader: rule file \"${filePath}\" is missing required field \"${field}\", skipping`);\n return null;\n }\n }\n\n const id = String(parsed['id']);\n const language = parsed['language'];\n const severity = String(parsed['severity']) as PatternRule['severity'];\n const owaspCategory = String(parsed['owaspCategory']);\n const description = String(parsed['description']);\n const fixHint = String(parsed['fixHint']);\n const rule = parsed['rule'];\n\n const validSeverities = new Set(['critical', 'high', 'medium', 'low']);\n if (!validSeverities.has(severity)) {\n logWarn(`PatternLibraryLoader: rule file \"${filePath}\" has invalid severity \"${severity}\", skipping`);\n return null;\n }\n\n if (typeof language !== 'string' && !Array.isArray(language)) {\n logWarn(`PatternLibraryLoader: rule file \"${filePath}\" has invalid language field, skipping`);\n return null;\n }\n\n if (typeof rule !== 'object' || Array.isArray(rule) || rule === null) {\n logWarn(`PatternLibraryLoader: rule file \"${filePath}\" has invalid rule field (must be an object), skipping`);\n return null;\n }\n\n return {\n id,\n language: Array.isArray(language) ? (language as string[]) : String(language),\n severity,\n owaspCategory,\n description,\n fixHint,\n rule: rule as Record<string, unknown>,\n };\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,SAAoB;AACpB,WAAsB;AAEtB,oBAAwB;AAYxB,SAAS,WAAW,MAAuC;AACzD,QAAM,QAAQ,KAAK,MAAM,IAAI;AAC7B,SAAO,YAAY,OAAO,GAAG,CAAC,EAAE;AAClC;AAOA,SAAS,YAAY,OAAiB,YAAoB,YAAiC;AACzF,QAAM,SAAkC,CAAC;AACzC,MAAI,IAAI;AAER,SAAO,IAAI,MAAM,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YAAY,QAAQ,UAAU,KAAK,CAAC;AACrE,QAAI,CAAC,gBAAgB,IAAI,QAAQ,GAAG;AAClC,iCAAQ,oCAAoC,QAAQ,2BAA2B,QAAQ,aAAa;AACpG,aAAO;AAAA,IACT;AAEA,QAAI,OAAO,aAAa,YAAY,CAAC,MAAM,QAAQ,QAAQ,GAAG;AAC5D,iCAAQ,oCAAoC,QAAQ,wCAAwC;AAC5F,aAAO;AAAA,IACT;AAEA,QAAI,OAAO,SAAS,YAAY,MAAM,QAAQ,IAAI,KAAK,SAAS,MAAM;AACpE,iCAAQ,oCAAoC,QAAQ,wDAAwD;AAC5G,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,MACL;AAAA,MACA,UAAU,MAAM,QAAQ,QAAQ,IAAK,WAAwB,OAAO,QAAQ;AAAA,MAC5E;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KiroGraph PatternRunner — lazy-loads @ast-grep/napi and executes pattern rules.
|
|
3
|
+
*/
|
|
4
|
+
import { PatternRule, PatternMatch } from './types';
|
|
5
|
+
export declare class PatternRunner {
|
|
6
|
+
/**
|
|
7
|
+
* Synchronously check whether @ast-grep/napi is available.
|
|
8
|
+
*/
|
|
9
|
+
isAvailable(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Returns true if the language is supported by @ast-grep/napi.
|
|
12
|
+
* Unsupported languages must be skipped — calling parse() on them throws a
|
|
13
|
+
* native C++ exception that bypasses JS try/catch and corrupts internal mutexes.
|
|
14
|
+
*/
|
|
15
|
+
isSupportedLanguage(language: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Lazy async loader — returns the napi module or null if missing.
|
|
18
|
+
*/
|
|
19
|
+
getNapi(): Promise<any | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Run a single library rule against a file's content.
|
|
22
|
+
* Returns an empty array and logs a warning on per-file errors.
|
|
23
|
+
*/
|
|
24
|
+
runRule(rule: PatternRule, fileContent: string, language: string): Promise<PatternMatch[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Run an inline pattern expression (not from library) against file content.
|
|
27
|
+
* Returns an empty array and logs a warning on per-file errors.
|
|
28
|
+
*/
|
|
29
|
+
runInline(pattern: string, language: string, fileContent: string): Promise<PatternMatch[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Run all rules against a file's content, filtered by severity threshold.
|
|
32
|
+
*/
|
|
33
|
+
runAllRules(rules: PatternRule[], fileContent: string, language: string, threshold: PatternRule['severity']): Promise<PatternMatch[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Apply the rule's fix template to all matches in the file content.
|
|
36
|
+
* Returns the transformed source string, or null if no fix was applied.
|
|
37
|
+
* Uses a range-based text substitution approach since commitEdits may not
|
|
38
|
+
* be available in all versions of @ast-grep/napi.
|
|
39
|
+
*/
|
|
40
|
+
applyFix(filePath: string, fileContent: string, language: string, rule: PatternRule): Promise<string | null>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/patterns/runner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,SAAS,CAAC;AAkDpE,qBAAa,aAAa;IACxB;;OAEG;IACH,WAAW,IAAI,OAAO;IAStB;;;;OAIG;IACH,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI9C;;OAEG;IAEG,OAAO,IAAI,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC;IAIpC;;;OAGG;IACG,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAuChG;;;OAGG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAqChG;;OAEG;IACG,WAAW,CACf,KAAK,EAAE,WAAW,EAAE,EACpB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,WAAW,CAAC,UAAU,CAAC,GACjC,OAAO,CAAC,YAAY,EAAE,CAAC;IAkB1B;;;;;OAKG;IACG,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAiEnH"}
|