@complior/engine 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.well-known/ai-compliance.json +16 -0
- package/COMPLIANCE.md +64 -0
- package/data/data-integrity.test.ts +75 -0
- package/data/eval/eval-mappings.json +33 -0
- package/data/llm/model-pricing.json +15 -0
- package/data/llm/model-routing.json +36 -0
- package/data/onboarding/risk-profile.json +17 -0
- package/data/regulations/eu-ai-act/README.md +245 -0
- package/data/regulations/eu-ai-act/applicability-tree.json +160 -0
- package/data/regulations/eu-ai-act/cross-mapping.json +175 -0
- package/data/regulations/eu-ai-act/localization.json +186 -0
- package/data/regulations/eu-ai-act/obligations.json +3981 -0
- package/data/regulations/eu-ai-act/regulation-meta.json +482 -0
- package/data/regulations/eu-ai-act/scoring.json +342 -0
- package/data/regulations/eu-ai-act/technical-requirements.json +2590 -0
- package/data/regulations/eu-ai-act/timeline.json +160 -0
- package/data/regulations/jurisdictions/at.json +15 -0
- package/data/regulations/jurisdictions/be.json +15 -0
- package/data/regulations/jurisdictions/bg.json +15 -0
- package/data/regulations/jurisdictions/cy.json +15 -0
- package/data/regulations/jurisdictions/cz.json +15 -0
- package/data/regulations/jurisdictions/de.json +15 -0
- package/data/regulations/jurisdictions/dk.json +15 -0
- package/data/regulations/jurisdictions/ee.json +15 -0
- package/data/regulations/jurisdictions/es.json +15 -0
- package/data/regulations/jurisdictions/fi.json +15 -0
- package/data/regulations/jurisdictions/fr.json +15 -0
- package/data/regulations/jurisdictions/gr.json +15 -0
- package/data/regulations/jurisdictions/hr.json +15 -0
- package/data/regulations/jurisdictions/hu.json +15 -0
- package/data/regulations/jurisdictions/ie.json +15 -0
- package/data/regulations/jurisdictions/is.json +15 -0
- package/data/regulations/jurisdictions/it.json +15 -0
- package/data/regulations/jurisdictions/li.json +15 -0
- package/data/regulations/jurisdictions/lt.json +15 -0
- package/data/regulations/jurisdictions/lu.json +15 -0
- package/data/regulations/jurisdictions/lv.json +15 -0
- package/data/regulations/jurisdictions/mt.json +15 -0
- package/data/regulations/jurisdictions/nl.json +15 -0
- package/data/regulations/jurisdictions/no.json +15 -0
- package/data/regulations/jurisdictions/pl.json +15 -0
- package/data/regulations/jurisdictions/pt.json +15 -0
- package/data/regulations/jurisdictions/ro.json +15 -0
- package/data/regulations/jurisdictions/se.json +15 -0
- package/data/regulations/jurisdictions/si.json +15 -0
- package/data/regulations/jurisdictions/sk.json +15 -0
- package/data/scanner/check-id-categories.json +81 -0
- package/data/scanner/confidence-params.json +16 -0
- package/data/scanner/limits.json +4 -0
- package/data/schemas/http-contract-sample.json +79 -0
- package/data/schemas/http-contract.json +144 -0
- package/data/semgrep-rules/bare-call.yaml +37 -0
- package/data/semgrep-rules/injection.yaml +73 -0
- package/data/semgrep-rules/missing-error-handling.yaml +58 -0
- package/data/semgrep-rules/unsafe-deser.yaml +65 -0
- package/data/templates/eu-ai-act/ai-literacy.md +184 -0
- package/data/templates/eu-ai-act/art5-screening.md +131 -0
- package/data/templates/eu-ai-act/data-governance.md +145 -0
- package/data/templates/eu-ai-act/declaration-of-conformity.md +161 -0
- package/data/templates/eu-ai-act/fria.md +127 -0
- package/data/templates/eu-ai-act/gpai-systemic-risk.md +150 -0
- package/data/templates/eu-ai-act/gpai-transparency.md +166 -0
- package/data/templates/eu-ai-act/incident-report.md +188 -0
- package/data/templates/eu-ai-act/instructions-for-use.md +202 -0
- package/data/templates/eu-ai-act/monitoring-policy.md +110 -0
- package/data/templates/eu-ai-act/qms.md +180 -0
- package/data/templates/eu-ai-act/risk-management-system.md +123 -0
- package/data/templates/eu-ai-act/technical-documentation.md +287 -0
- package/data/templates/eu-ai-act/worker-notification.md +143 -0
- package/data/templates/policies/biometrics-ai-policy.md +214 -0
- package/data/templates/policies/critical-infra-ai-policy.md +228 -0
- package/data/templates/policies/education-ai-policy.md +184 -0
- package/data/templates/policies/finance-ai-policy.md +191 -0
- package/data/templates/policies/healthcare-ai-policy.md +197 -0
- package/data/templates/policies/hr-ai-policy.md +178 -0
- package/data/templates/policies/legal-ai-policy.md +189 -0
- package/data/templates/policies/migration-ai-policy.md +239 -0
- package/engine.log +7 -0
- package/package.json +74 -0
- package/src/composition-root.ts +791 -0
- package/src/data/eval/conformity-tests.test.ts +122 -0
- package/src/data/eval/ct-1-transparency.ts +106 -0
- package/src/data/eval/ct-10-gpai.ts +25 -0
- package/src/data/eval/ct-11-industry.ts +42 -0
- package/src/data/eval/ct-2-oversight.ts +41 -0
- package/src/data/eval/ct-3-explanation.ts +14 -0
- package/src/data/eval/ct-4-bias.ts +83 -0
- package/src/data/eval/ct-5-accuracy.ts +41 -0
- package/src/data/eval/ct-6-robustness.ts +81 -0
- package/src/data/eval/ct-7-prohibited.ts +52 -0
- package/src/data/eval/ct-8-logging.ts +68 -0
- package/src/data/eval/ct-9-risk-awareness.ts +33 -0
- package/src/data/eval/deterministic-evaluator.ts +120 -0
- package/src/data/eval/index.ts +55 -0
- package/src/data/eval/judge-prompts.ts +146 -0
- package/src/data/eval/llm-judged-tests.ts +279 -0
- package/src/data/eval/llm-tests.test.ts +83 -0
- package/src/data/eval/remediation/ct-1-transparency.ts +91 -0
- package/src/data/eval/remediation/ct-10-gpai.ts +94 -0
- package/src/data/eval/remediation/ct-11-industry.ts +94 -0
- package/src/data/eval/remediation/ct-2-oversight.ts +71 -0
- package/src/data/eval/remediation/ct-3-explanation.ts +70 -0
- package/src/data/eval/remediation/ct-4-bias.ts +70 -0
- package/src/data/eval/remediation/ct-5-accuracy.ts +70 -0
- package/src/data/eval/remediation/ct-6-robustness.ts +70 -0
- package/src/data/eval/remediation/ct-7-prohibited.ts +94 -0
- package/src/data/eval/remediation/ct-8-logging.ts +94 -0
- package/src/data/eval/remediation/ct-9-risk-awareness.ts +94 -0
- package/src/data/eval/remediation/index.ts +89 -0
- package/src/data/eval/remediation/owasp-art5.ts +15 -0
- package/src/data/eval/remediation/owasp-llm01.ts +72 -0
- package/src/data/eval/remediation/owasp-llm02.ts +72 -0
- package/src/data/eval/remediation/owasp-llm03.ts +15 -0
- package/src/data/eval/remediation/owasp-llm04.ts +15 -0
- package/src/data/eval/remediation/owasp-llm05.ts +15 -0
- package/src/data/eval/remediation/owasp-llm06.ts +15 -0
- package/src/data/eval/remediation/owasp-llm07.ts +15 -0
- package/src/data/eval/remediation/owasp-llm08.ts +15 -0
- package/src/data/eval/remediation/owasp-llm09.ts +15 -0
- package/src/data/eval/remediation/owasp-llm10.ts +15 -0
- package/src/data/eval/remediation/remediation.test.ts +229 -0
- package/src/data/eval/remediation/test-mapping.ts +290 -0
- package/src/data/eval/security-rubrics.ts +381 -0
- package/src/data/finding-explanations.json +453 -0
- package/src/data/industry-patterns.ts +161 -0
- package/src/data/registry-cards.ts +368 -0
- package/src/data/regulation/index.ts +5 -0
- package/src/data/regulation/jurisdiction-data.test.ts +73 -0
- package/src/data/regulation/jurisdiction-data.ts +65 -0
- package/src/data/regulation/regulation-data.ts +19 -0
- package/src/data/regulation/regulation-loader.test.ts +107 -0
- package/src/data/regulation/regulation-loader.ts +56 -0
- package/src/data/scanner-constants.ts +46 -0
- package/src/data/schemas/schemas-core.ts +140 -0
- package/src/data/schemas/schemas-supplementary.ts +211 -0
- package/src/data/schemas/schemas.ts +28 -0
- package/src/data/security/attack-probes.test.ts +62 -0
- package/src/data/security/attack-probes.ts +496 -0
- package/src/data/security/eu-ai-act-security.ts +40 -0
- package/src/data/security/index.ts +19 -0
- package/src/data/security/mitre-atlas.test.ts +43 -0
- package/src/data/security/mitre-atlas.ts +93 -0
- package/src/data/security/nist-ai-rmf.ts +43 -0
- package/src/data/security/owasp-llm-top10.test.ts +60 -0
- package/src/data/security/owasp-llm-top10.ts +138 -0
- package/src/data/template-registry.ts +53 -0
- package/src/data/tool-versions.json +22 -0
- package/src/domain/audit/audit-package.test.ts +152 -0
- package/src/domain/audit/audit-package.ts +166 -0
- package/src/domain/audit/audit-trail.test.ts +121 -0
- package/src/domain/audit/audit-trail.ts +174 -0
- package/src/domain/audit/index.ts +8 -0
- package/src/domain/audit/permissions-matrix.test.ts +136 -0
- package/src/domain/audit/permissions-matrix.ts +121 -0
- package/src/domain/certification/adversarial/bias-tests.ts +95 -0
- package/src/domain/certification/adversarial/evaluators.ts +304 -0
- package/src/domain/certification/adversarial/index.ts +11 -0
- package/src/domain/certification/adversarial/prompt-injection.ts +103 -0
- package/src/domain/certification/adversarial/safety-boundary.ts +132 -0
- package/src/domain/certification/aiuc1-readiness.test.ts +236 -0
- package/src/domain/certification/aiuc1-readiness.ts +298 -0
- package/src/domain/certification/aiuc1-requirements.ts +235 -0
- package/src/domain/certification/index.ts +10 -0
- package/src/domain/certification/redteam-runner.test.ts +97 -0
- package/src/domain/certification/redteam-runner.ts +205 -0
- package/src/domain/certification/test-runner.test.ts +232 -0
- package/src/domain/certification/test-runner.ts +289 -0
- package/src/domain/cost/cost-estimator.test.ts +187 -0
- package/src/domain/cost/cost-estimator.ts +133 -0
- package/src/domain/disclaimer.test.ts +52 -0
- package/src/domain/disclaimer.ts +39 -0
- package/src/domain/documents/ai-enricher.test.ts +120 -0
- package/src/domain/documents/ai-enricher.ts +159 -0
- package/src/domain/documents/document-generator.test.ts +318 -0
- package/src/domain/documents/document-generator.ts +239 -0
- package/src/domain/documents/index.ts +9 -0
- package/src/domain/documents/passport-helpers.ts +25 -0
- package/src/domain/documents/policy-generator.test.ts +252 -0
- package/src/domain/documents/policy-generator.ts +94 -0
- package/src/domain/documents/worker-notification-generator.test.ts +162 -0
- package/src/domain/documents/worker-notification-generator.ts +141 -0
- package/src/domain/eval/adapters/adapter-port.ts +94 -0
- package/src/domain/eval/adapters/adapters.test.ts +303 -0
- package/src/domain/eval/adapters/anthropic-adapter.ts +57 -0
- package/src/domain/eval/adapters/auto-detect.ts +104 -0
- package/src/domain/eval/adapters/create-chat-adapter.ts +106 -0
- package/src/domain/eval/adapters/custom-adapter.ts +74 -0
- package/src/domain/eval/adapters/http-adapter.ts +66 -0
- package/src/domain/eval/adapters/index.ts +7 -0
- package/src/domain/eval/adapters/ollama-adapter.ts +48 -0
- package/src/domain/eval/adapters/openai-adapter.ts +58 -0
- package/src/domain/eval/adapters/with-timeout.ts +25 -0
- package/src/domain/eval/conformity-score.test.ts +161 -0
- package/src/domain/eval/conformity-score.ts +135 -0
- package/src/domain/eval/eval-constants.ts +55 -0
- package/src/domain/eval/eval-evidence.test.ts +85 -0
- package/src/domain/eval/eval-evidence.ts +103 -0
- package/src/domain/eval/eval-fix-generator.test.ts +421 -0
- package/src/domain/eval/eval-fix-generator.ts +205 -0
- package/src/domain/eval/eval-passport.test.ts +82 -0
- package/src/domain/eval/eval-passport.ts +89 -0
- package/src/domain/eval/eval-remediation-report.test.ts +682 -0
- package/src/domain/eval/eval-remediation-report.ts +170 -0
- package/src/domain/eval/eval-report.ts +108 -0
- package/src/domain/eval/eval-runner.test.ts +609 -0
- package/src/domain/eval/eval-runner.ts +593 -0
- package/src/domain/eval/eval-to-findings.test.ts +293 -0
- package/src/domain/eval/eval-to-findings.ts +83 -0
- package/src/domain/eval/index.ts +31 -0
- package/src/domain/eval/llm-judge.test.ts +139 -0
- package/src/domain/eval/llm-judge.ts +168 -0
- package/src/domain/eval/remediation-types.ts +90 -0
- package/src/domain/eval/security-integration.test.ts +196 -0
- package/src/domain/eval/security-integration.ts +136 -0
- package/src/domain/eval/types.test.ts +173 -0
- package/src/domain/eval/types.ts +244 -0
- package/src/domain/eval/verdict-utils.ts +45 -0
- package/src/domain/fixer/create-fixer.ts +101 -0
- package/src/domain/fixer/diff.ts +70 -0
- package/src/domain/fixer/fix-history.ts +23 -0
- package/src/domain/fixer/fixer.test.ts +306 -0
- package/src/domain/fixer/index.ts +9 -0
- package/src/domain/fixer/strategies/bandit-fix.ts +61 -0
- package/src/domain/fixer/strategies/bias-testing.ts +49 -0
- package/src/domain/fixer/strategies/ci-compliance.ts +57 -0
- package/src/domain/fixer/strategies/content-marking.ts +45 -0
- package/src/domain/fixer/strategies/cve-upgrade.ts +66 -0
- package/src/domain/fixer/strategies/data-governance.ts +65 -0
- package/src/domain/fixer/strategies/disclosure.ts +69 -0
- package/src/domain/fixer/strategies/doc-code-sync.ts +53 -0
- package/src/domain/fixer/strategies/documentation.ts +59 -0
- package/src/domain/fixer/strategies/error-handler.ts +63 -0
- package/src/domain/fixer/strategies/hitl-gate.ts +67 -0
- package/src/domain/fixer/strategies/index.ts +61 -0
- package/src/domain/fixer/strategies/kill-switch-test.ts +85 -0
- package/src/domain/fixer/strategies/kill-switch.ts +53 -0
- package/src/domain/fixer/strategies/license-fix.ts +57 -0
- package/src/domain/fixer/strategies/log-retention.ts +40 -0
- package/src/domain/fixer/strategies/logging.ts +59 -0
- package/src/domain/fixer/strategies/metadata.ts +45 -0
- package/src/domain/fixer/strategies/permission-guard.ts +84 -0
- package/src/domain/fixer/strategies/record-keeping.ts +69 -0
- package/src/domain/fixer/strategies/secret-rotation.ts +52 -0
- package/src/domain/fixer/strategies.test.ts +341 -0
- package/src/domain/fixer/template-engine.test.ts +64 -0
- package/src/domain/fixer/template-engine.ts +38 -0
- package/src/domain/fixer/types.ts +88 -0
- package/src/domain/frameworks/aiuc1-framework.test.ts +159 -0
- package/src/domain/frameworks/aiuc1-framework.ts +126 -0
- package/src/domain/frameworks/collect-foundation-metrics.test.ts +96 -0
- package/src/domain/frameworks/collect-foundation-metrics.ts +34 -0
- package/src/domain/frameworks/eu-ai-act-framework.test.ts +117 -0
- package/src/domain/frameworks/eu-ai-act-framework.ts +100 -0
- package/src/domain/frameworks/framework-registry.test.ts +91 -0
- package/src/domain/frameworks/framework-registry.ts +38 -0
- package/src/domain/frameworks/index.ts +8 -0
- package/src/domain/frameworks/mitre-atlas-framework.test.ts +53 -0
- package/src/domain/frameworks/mitre-atlas-framework.ts +53 -0
- package/src/domain/frameworks/owasp-llm-framework.test.ts +77 -0
- package/src/domain/frameworks/owasp-llm-framework.ts +54 -0
- package/src/domain/frameworks/score-plugin-framework.ts +117 -0
- package/src/domain/fria/fria-generator.test.ts +273 -0
- package/src/domain/fria/fria-generator.ts +366 -0
- package/src/domain/import/promptfoo-importer.test.ts +103 -0
- package/src/domain/import/promptfoo-importer.ts +151 -0
- package/src/domain/onboarding/guided-onboarding.test.ts +144 -0
- package/src/domain/onboarding/guided-onboarding.ts +135 -0
- package/src/domain/passport/builder/domain-mapper.ts +9 -0
- package/src/domain/passport/builder/manifest-builder.test.ts +546 -0
- package/src/domain/passport/builder/manifest-builder.ts +535 -0
- package/src/domain/passport/builder/manifest-diff.test.ts +105 -0
- package/src/domain/passport/builder/manifest-diff.ts +89 -0
- package/src/domain/passport/builder/manifest-files.ts +17 -0
- package/src/domain/passport/crypto-signer.test.ts +93 -0
- package/src/domain/passport/crypto-signer.ts +157 -0
- package/src/domain/passport/discovery/agent-discovery.test.ts +296 -0
- package/src/domain/passport/discovery/agent-discovery.ts +325 -0
- package/src/domain/passport/discovery/autonomy-analyzer.test.ts +141 -0
- package/src/domain/passport/discovery/autonomy-analyzer.ts +113 -0
- package/src/domain/passport/discovery/permission-scanner.test.ts +191 -0
- package/src/domain/passport/discovery/permission-scanner.ts +414 -0
- package/src/domain/passport/export/a2a-mapper.ts +75 -0
- package/src/domain/passport/export/aiuc1-mapper.ts +126 -0
- package/src/domain/passport/export/export.test.ts +207 -0
- package/src/domain/passport/export/index.ts +41 -0
- package/src/domain/passport/export/nist-mapper.ts +227 -0
- package/src/domain/passport/import/a2a-importer.test.ts +133 -0
- package/src/domain/passport/import/a2a-importer.ts +156 -0
- package/src/domain/passport/import/index.ts +2 -0
- package/src/domain/passport/index.ts +32 -0
- package/src/domain/passport/obligation-field-map.test.ts +113 -0
- package/src/domain/passport/obligation-field-map.ts +117 -0
- package/src/domain/passport/passport-validator.test.ts +156 -0
- package/src/domain/passport/passport-validator.ts +126 -0
- package/src/domain/passport/scan-to-compliance.test.ts +336 -0
- package/src/domain/passport/scan-to-compliance.ts +166 -0
- package/src/domain/passport/test-generator.test.ts +93 -0
- package/src/domain/passport/test-generator.ts +136 -0
- package/src/domain/proxy/index.ts +11 -0
- package/src/domain/proxy/json-rpc.test.ts +72 -0
- package/src/domain/proxy/json-rpc.ts +53 -0
- package/src/domain/proxy/policy-engine.test.ts +259 -0
- package/src/domain/proxy/policy-engine.ts +137 -0
- package/src/domain/proxy/proxy-bridge.ts +125 -0
- package/src/domain/proxy/proxy-interceptor.test.ts +184 -0
- package/src/domain/proxy/proxy-interceptor.ts +120 -0
- package/src/domain/proxy/proxy-types.ts +35 -0
- package/src/domain/registry/compute-agent-score.test.ts +279 -0
- package/src/domain/registry/compute-agent-score.ts +162 -0
- package/src/domain/reporter/audit-report.test.ts +87 -0
- package/src/domain/reporter/audit-report.ts +116 -0
- package/src/domain/reporter/badge-generator.test.ts +54 -0
- package/src/domain/reporter/badge-generator.ts +40 -0
- package/src/domain/reporter/compliance-md.ts +45 -0
- package/src/domain/reporter/index.ts +7 -0
- package/src/domain/reporter/pdf-renderer.ts +282 -0
- package/src/domain/reporter/share.test.ts +92 -0
- package/src/domain/reporter/share.ts +80 -0
- package/src/domain/scanner/ast/swc-analyzer.test.ts +49 -0
- package/src/domain/scanner/ast/swc-analyzer.ts +124 -0
- package/src/domain/scanner/attestations.ts +97 -0
- package/src/domain/scanner/checks/ai-disclosure.test.ts +90 -0
- package/src/domain/scanner/checks/ai-disclosure.ts +54 -0
- package/src/domain/scanner/checks/ai-literacy.ts +163 -0
- package/src/domain/scanner/checks/behavioral-constraints.test.ts +167 -0
- package/src/domain/scanner/checks/behavioral-constraints.ts +86 -0
- package/src/domain/scanner/checks/compliance-metadata.ts +63 -0
- package/src/domain/scanner/checks/content-marking.ts +74 -0
- package/src/domain/scanner/checks/dep-deep-scan.test.ts +318 -0
- package/src/domain/scanner/checks/dep-deep-scan.ts +137 -0
- package/src/domain/scanner/checks/documentation.test.ts +88 -0
- package/src/domain/scanner/checks/documentation.ts +79 -0
- package/src/domain/scanner/checks/git-history.test.ts +120 -0
- package/src/domain/scanner/checks/git-history.ts +163 -0
- package/src/domain/scanner/checks/gpai-systemic-risk.test.ts +84 -0
- package/src/domain/scanner/checks/gpai-systemic-risk.ts +98 -0
- package/src/domain/scanner/checks/gpai-transparency.ts +94 -0
- package/src/domain/scanner/checks/index.ts +28 -0
- package/src/domain/scanner/checks/industry/index.ts +40 -0
- package/src/domain/scanner/checks/industry/industry.test.ts +287 -0
- package/src/domain/scanner/checks/interaction-logging.test.ts +113 -0
- package/src/domain/scanner/checks/interaction-logging.ts +142 -0
- package/src/domain/scanner/checks/nhi-scanner.test.ts +158 -0
- package/src/domain/scanner/checks/nhi-scanner.ts +78 -0
- package/src/domain/scanner/checks/passport-completeness.test.ts +127 -0
- package/src/domain/scanner/checks/passport-completeness.ts +82 -0
- package/src/domain/scanner/checks/passport-presence.test.ts +56 -0
- package/src/domain/scanner/checks/passport-presence.ts +78 -0
- package/src/domain/scanner/checks/pattern-check-factory.ts +70 -0
- package/src/domain/scanner/checks/permission-scanner.test.ts +279 -0
- package/src/domain/scanner/checks/permission-scanner.ts +90 -0
- package/src/domain/scanner/checks/presence-check-factory.test.ts +124 -0
- package/src/domain/scanner/checks/presence-check-factory.ts +275 -0
- package/src/domain/scanner/compliance-diff.test.ts +165 -0
- package/src/domain/scanner/compliance-diff.ts +138 -0
- package/src/domain/scanner/confidence.test.ts +235 -0
- package/src/domain/scanner/confidence.ts +156 -0
- package/src/domain/scanner/constants.ts +13 -0
- package/src/domain/scanner/create-scanner.ts +573 -0
- package/src/domain/scanner/cross-layer.test.ts +372 -0
- package/src/domain/scanner/cross-layer.ts +232 -0
- package/src/domain/scanner/data/ai-packages.ts +82 -0
- package/src/domain/scanner/debt-calculator.test.ts +89 -0
- package/src/domain/scanner/debt-calculator.ts +111 -0
- package/src/domain/scanner/drift.test.ts +191 -0
- package/src/domain/scanner/drift.ts +73 -0
- package/src/domain/scanner/evidence-store.test.ts +207 -0
- package/src/domain/scanner/evidence-store.ts +195 -0
- package/src/domain/scanner/evidence.test.ts +104 -0
- package/src/domain/scanner/evidence.ts +71 -0
- package/src/domain/scanner/external/bandit-runner.test.ts +45 -0
- package/src/domain/scanner/external/bandit-runner.ts +90 -0
- package/src/domain/scanner/external/checks.ts +321 -0
- package/src/domain/scanner/external/dedup.test.ts +79 -0
- package/src/domain/scanner/external/dedup.ts +94 -0
- package/src/domain/scanner/external/detect-secrets-runner.test.ts +58 -0
- package/src/domain/scanner/external/detect-secrets-runner.ts +81 -0
- package/src/domain/scanner/external/external-scanner.test.ts +221 -0
- package/src/domain/scanner/external/external-scanner.ts +36 -0
- package/src/domain/scanner/external/finding-mapper.test.ts +95 -0
- package/src/domain/scanner/external/finding-mapper.ts +138 -0
- package/src/domain/scanner/external/index.ts +15 -0
- package/src/domain/scanner/external/mappings.ts +93 -0
- package/src/domain/scanner/external/modelscan-runner.test.ts +35 -0
- package/src/domain/scanner/external/modelscan-runner.ts +101 -0
- package/src/domain/scanner/external/path-utils.ts +8 -0
- package/src/domain/scanner/external/runner-port.ts +45 -0
- package/src/domain/scanner/external/semgrep-runner.test.ts +52 -0
- package/src/domain/scanner/external/semgrep-runner.ts +94 -0
- package/src/domain/scanner/external/types.ts +32 -0
- package/src/domain/scanner/finding-attribution.test.ts +444 -0
- package/src/domain/scanner/finding-attribution.ts +195 -0
- package/src/domain/scanner/finding-explainer.test.ts +157 -0
- package/src/domain/scanner/finding-explainer.ts +73 -0
- package/src/domain/scanner/fix-diff-builder.test.ts +272 -0
- package/src/domain/scanner/fix-diff-builder.ts +477 -0
- package/src/domain/scanner/import-graph.test.ts +162 -0
- package/src/domain/scanner/import-graph.ts +198 -0
- package/src/domain/scanner/languages/adapter.test.ts +105 -0
- package/src/domain/scanner/languages/adapter.ts +239 -0
- package/src/domain/scanner/layers/index.ts +24 -0
- package/src/domain/scanner/layers/layer1-files.ts +54 -0
- package/src/domain/scanner/layers/layer2-docs.test.ts +1207 -0
- package/src/domain/scanner/layers/layer2-docs.ts +297 -0
- package/src/domain/scanner/layers/layer2-parsing.ts +217 -0
- package/src/domain/scanner/layers/layer3-config.test.ts +187 -0
- package/src/domain/scanner/layers/layer3-config.ts +279 -0
- package/src/domain/scanner/layers/layer3-parsers.ts +73 -0
- package/src/domain/scanner/layers/layer4-patterns.test.ts +397 -0
- package/src/domain/scanner/layers/layer4-patterns.ts +216 -0
- package/src/domain/scanner/layers/layer5-docs.test.ts +99 -0
- package/src/domain/scanner/layers/layer5-docs.ts +250 -0
- package/src/domain/scanner/layers/layer5-llm.test.ts +146 -0
- package/src/domain/scanner/layers/layer5-llm.ts +262 -0
- package/src/domain/scanner/layers/layer5-targeted.test.ts +93 -0
- package/src/domain/scanner/layers/layer5-targeted.ts +233 -0
- package/src/domain/scanner/layers/lockfile-parsers.test.ts +320 -0
- package/src/domain/scanner/layers/lockfile-parsers.ts +184 -0
- package/src/domain/scanner/regulation-version.test.ts +54 -0
- package/src/domain/scanner/regulation-version.ts +23 -0
- package/src/domain/scanner/role-filter.test.ts +116 -0
- package/src/domain/scanner/role-filter.ts +51 -0
- package/src/domain/scanner/rules/banned-packages-data.ts +553 -0
- package/src/domain/scanner/rules/banned-packages-sdk.ts +65 -0
- package/src/domain/scanner/rules/banned-packages.test.ts +249 -0
- package/src/domain/scanner/rules/banned-packages.ts +55 -0
- package/src/domain/scanner/rules/comment-filter.test.ts +115 -0
- package/src/domain/scanner/rules/comment-filter.ts +297 -0
- package/src/domain/scanner/rules/index.ts +9 -0
- package/src/domain/scanner/rules/nhi-patterns.test.ts +128 -0
- package/src/domain/scanner/rules/nhi-patterns.ts +60 -0
- package/src/domain/scanner/rules/pattern-rules.ts +1152 -0
- package/src/domain/scanner/sbom.test.ts +136 -0
- package/src/domain/scanner/sbom.ts +103 -0
- package/src/domain/scanner/scan-cache.test.ts +136 -0
- package/src/domain/scanner/scan-cache.ts +115 -0
- package/src/domain/scanner/scanner.test.ts +125 -0
- package/src/domain/scanner/score-calculator.test.ts +363 -0
- package/src/domain/scanner/score-calculator.ts +189 -0
- package/src/domain/scanner/security-score.test.ts +107 -0
- package/src/domain/scanner/security-score.ts +116 -0
- package/src/domain/scanner/source-filter.ts +24 -0
- package/src/domain/scanner/validators.ts +223 -0
- package/src/domain/shared/compliance-constants.ts +48 -0
- package/src/domain/shared/disclosure-patterns.ts +16 -0
- package/src/domain/shared/index.ts +6 -0
- package/src/domain/shared/parse-dependencies.ts +21 -0
- package/src/domain/supply-chain/dependency-analyzer.ts +138 -0
- package/src/domain/supply-chain/index.ts +3 -0
- package/src/domain/supply-chain/supply-chain.test.ts +211 -0
- package/src/domain/supply-chain/types.ts +32 -0
- package/src/domain/whatif/config-fixer.ts +187 -0
- package/src/domain/whatif/index.ts +6 -0
- package/src/domain/whatif/scenario-engine.ts +121 -0
- package/src/domain/whatif/simulate-actions.test.ts +161 -0
- package/src/domain/whatif/simulate-actions.ts +114 -0
- package/src/domain/whatif/whatif.test.ts +135 -0
- package/src/e2e/gaps-e2e.test.ts +259 -0
- package/src/e2e/smoke.test.ts +101 -0
- package/src/hooks/hooks-export.test.ts +81 -0
- package/src/hooks/installer.ts +113 -0
- package/src/http/cors.test.ts +38 -0
- package/src/http/create-router.ts +259 -0
- package/src/http/routes/agent.route.ts +380 -0
- package/src/http/routes/audit.route.ts +66 -0
- package/src/http/routes/badge.route.ts +23 -0
- package/src/http/routes/cert.route.ts +66 -0
- package/src/http/routes/chat.route.ts +228 -0
- package/src/http/routes/cost.route.ts +33 -0
- package/src/http/routes/debt.route.ts +29 -0
- package/src/http/routes/disclaimer.route.ts +64 -0
- package/src/http/routes/eval.route.ts +161 -0
- package/src/http/routes/events.route.test.ts +108 -0
- package/src/http/routes/events.route.ts +71 -0
- package/src/http/routes/external-scan.route.ts +24 -0
- package/src/http/routes/file.route.ts +54 -0
- package/src/http/routes/fix.route.ts +219 -0
- package/src/http/routes/frameworks.route.test.ts +66 -0
- package/src/http/routes/frameworks.route.ts +36 -0
- package/src/http/routes/git.route.ts +27 -0
- package/src/http/routes/guided-onboarding.route.ts +65 -0
- package/src/http/routes/import.route.ts +64 -0
- package/src/http/routes/jurisdiction.route.ts +22 -0
- package/src/http/routes/obligations.route.test.ts +122 -0
- package/src/http/routes/obligations.route.ts +110 -0
- package/src/http/routes/onboarding.route.ts +53 -0
- package/src/http/routes/provider.route.ts +42 -0
- package/src/http/routes/proxy.route.ts +40 -0
- package/src/http/routes/redteam.route.ts +84 -0
- package/src/http/routes/report.route.ts +29 -0
- package/src/http/routes/scan.route.ts +104 -0
- package/src/http/routes/share.route.ts +44 -0
- package/src/http/routes/shell.route.ts +27 -0
- package/src/http/routes/status.route.ts +66 -0
- package/src/http/routes/supply-chain.route.ts +121 -0
- package/src/http/routes/sync.route.ts +328 -0
- package/src/http/routes/tools.route.ts +29 -0
- package/src/http/routes/whatif.route.ts +96 -0
- package/src/http/utils/validation.ts +31 -0
- package/src/index.ts +1 -0
- package/src/infra/bundle-fetcher.ts +77 -0
- package/src/infra/cache-storage.ts +34 -0
- package/src/infra/event-bus.ts +31 -0
- package/src/infra/file-collector.ts +61 -0
- package/src/infra/file-ops-adapter.ts +95 -0
- package/src/infra/file-watcher.test.ts +90 -0
- package/src/infra/file-watcher.ts +106 -0
- package/src/infra/git-adapter.ts +93 -0
- package/src/infra/git-history-adapter.ts +41 -0
- package/src/infra/headless-browser.ts +178 -0
- package/src/infra/llm-adapter.test.ts +83 -0
- package/src/infra/llm-adapter.ts +86 -0
- package/src/infra/logger.ts +27 -0
- package/src/infra/project-config.test.ts +74 -0
- package/src/infra/project-config.ts +35 -0
- package/src/infra/rate-limiter.test.ts +36 -0
- package/src/infra/rate-limiter.ts +34 -0
- package/src/infra/retry.ts +46 -0
- package/src/infra/saas-client.ts +123 -0
- package/src/infra/search-adapter.ts +113 -0
- package/src/infra/shell-adapter.ts +68 -0
- package/src/infra/tool-manager.test.ts +99 -0
- package/src/infra/tool-manager.ts +197 -0
- package/src/llm/agents/agent-modes.test.ts +44 -0
- package/src/llm/agents/modes.ts +68 -0
- package/src/llm/routing/cost-routing.test.ts +37 -0
- package/src/llm/routing/cost-tracker.ts +74 -0
- package/src/llm/routing/model-routing.test.ts +79 -0
- package/src/llm/routing/model-routing.ts +38 -0
- package/src/llm/routing/pricing.ts +19 -0
- package/src/llm/sse-protocol.ts +77 -0
- package/src/llm/tool-definitions.ts +83 -0
- package/src/llm/tool-executors.ts +80 -0
- package/src/llm/tools/types.ts +13 -0
- package/src/mcp/create-mcp-stack.ts +82 -0
- package/src/mcp/handlers.ts +245 -0
- package/src/mcp/index.ts +28 -0
- package/src/mcp/mcp-server.test.ts +80 -0
- package/src/mcp/server.ts +79 -0
- package/src/mcp/tools.ts +48 -0
- package/src/onboarding/auto-detect.ts +164 -0
- package/src/onboarding/onboarding.test.ts +89 -0
- package/src/onboarding/profile.ts +169 -0
- package/src/onboarding/questions.ts +112 -0
- package/src/onboarding/wizard.ts +66 -0
- package/src/output/github-issue.ts +32 -0
- package/src/output/json-output.ts +67 -0
- package/src/ports/browser.port.ts +23 -0
- package/src/ports/events.port.ts +28 -0
- package/src/ports/llm.port.ts +23 -0
- package/src/ports/logger.port.ts +6 -0
- package/src/ports/process.port.ts +6 -0
- package/src/ports/scanner.port.ts +15 -0
- package/src/server.ts +134 -0
- package/src/services/badge-service.ts +67 -0
- package/src/services/chat-service.test.ts +162 -0
- package/src/services/chat-service.ts +152 -0
- package/src/services/cost-service.ts +52 -0
- package/src/services/debt-service.ts +65 -0
- package/src/services/eval-integration.test.ts +132 -0
- package/src/services/eval-service.test.ts +373 -0
- package/src/services/eval-service.ts +463 -0
- package/src/services/external-scan-service.ts +60 -0
- package/src/services/file-service.ts +37 -0
- package/src/services/fix-service.test.ts +470 -0
- package/src/services/fix-service.ts +648 -0
- package/src/services/framework-service.test.ts +159 -0
- package/src/services/framework-service.ts +67 -0
- package/src/services/onboarding-service.ts +165 -0
- package/src/services/passport-audit.ts +244 -0
- package/src/services/passport-documents.ts +258 -0
- package/src/services/passport-service-utils.ts +72 -0
- package/src/services/passport-service.test.ts +251 -0
- package/src/services/passport-service.ts +339 -0
- package/src/services/proxy-service.ts +81 -0
- package/src/services/report-service.ts +72 -0
- package/src/services/scan-service.test.ts +470 -0
- package/src/services/scan-service.ts +335 -0
- package/src/services/share-service.ts +108 -0
- package/src/services/shared/backup.ts +23 -0
- package/src/services/status-service.ts +38 -0
- package/src/services/undo-service.test.ts +190 -0
- package/src/services/undo-service.ts +144 -0
- package/src/test-helpers/factories.ts +116 -0
- package/src/types/common.schemas.ts +147 -0
- package/src/types/common.types.ts +292 -0
- package/src/types/contract.test.ts +217 -0
- package/src/types/errors.ts +52 -0
- package/src/types/framework.types.ts +87 -0
- package/src/types/passport-schemas.ts +241 -0
- package/src/types/passport.types.ts +296 -0
- package/src/version.ts +1 -0
- package/tsconfig.json +20 -0
- package/vitest.config.ts +9 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"country_code": "SI",
|
|
3
|
+
"country_name": "Slovenia",
|
|
4
|
+
"msa_name": "Agency for Communication Networks and Services (AKOS)",
|
|
5
|
+
"msa_url": "https://www.akos-rs.si",
|
|
6
|
+
"msa_contact": "info.box@akos-rs.si",
|
|
7
|
+
"local_requirements": [
|
|
8
|
+
"Slovenian-language documentation mandatory for consumer AI systems",
|
|
9
|
+
"National DPA (IP RS) notification for AI processing personal data",
|
|
10
|
+
"Alignment with Slovenian National Programme for AI"
|
|
11
|
+
],
|
|
12
|
+
"enforcement_date": "2026-08-02",
|
|
13
|
+
"language": "Slovenian",
|
|
14
|
+
"notes": "AKOS oversees communications networks and digital services including AI"
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"country_code": "SK",
|
|
3
|
+
"country_name": "Slovakia",
|
|
4
|
+
"msa_name": "Regulatory Office for Network Industries (URSO)",
|
|
5
|
+
"msa_url": "https://www.urso.gov.sk",
|
|
6
|
+
"msa_contact": "urso@urso.gov.sk",
|
|
7
|
+
"local_requirements": [
|
|
8
|
+
"Slovak-language documentation required for consumer-facing AI",
|
|
9
|
+
"National DPA (UOOU SR) notification for high-risk AI",
|
|
10
|
+
"Alignment with Slovak Action Plan for AI Development"
|
|
11
|
+
],
|
|
12
|
+
"enforcement_date": "2026-08-02",
|
|
13
|
+
"language": "Slovak",
|
|
14
|
+
"notes": "URSO handles network and digital market regulation including AI oversight"
|
|
15
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mapping": {
|
|
3
|
+
"art5-screening": "prohibited_practices",
|
|
4
|
+
"risk-management": "risk_management",
|
|
5
|
+
"data-governance": "risk_management",
|
|
6
|
+
"qms": "risk_management",
|
|
7
|
+
"technical-documentation": "documentation",
|
|
8
|
+
"declaration-of-conformity": "documentation",
|
|
9
|
+
"compliance-metadata": "documentation",
|
|
10
|
+
"documentation": "documentation",
|
|
11
|
+
"passport-presence": "documentation",
|
|
12
|
+
"passport-completeness": "documentation",
|
|
13
|
+
"instructions-for-use": "transparency",
|
|
14
|
+
"ai-literacy": "organizational",
|
|
15
|
+
"monitoring-policy": "deployer_specific",
|
|
16
|
+
"fria": "deployer_specific",
|
|
17
|
+
"worker-notification": "monitoring_and_reporting",
|
|
18
|
+
"incident-report": "monitoring_and_reporting",
|
|
19
|
+
|
|
20
|
+
"l2-tech-documentation": "documentation",
|
|
21
|
+
"l2-art5-screening": "prohibited_practices",
|
|
22
|
+
"l2-risk-management": "risk_management",
|
|
23
|
+
"l2-data-governance": "risk_management",
|
|
24
|
+
"l2-qms": "risk_management",
|
|
25
|
+
"l2-instructions-for-use": "transparency",
|
|
26
|
+
"l2-ai-literacy": "organizational",
|
|
27
|
+
"l2-monitoring-policy": "deployer_specific",
|
|
28
|
+
"l2-fria": "deployer_specific",
|
|
29
|
+
"l2-declaration-conformity": "documentation",
|
|
30
|
+
"l2-worker-notification": "monitoring_and_reporting",
|
|
31
|
+
"l2-incident-report": "monitoring_and_reporting",
|
|
32
|
+
"l2-critical-infra-ai-policy": "risk_management",
|
|
33
|
+
|
|
34
|
+
"l3-ai-sdk-detected": "technical_safeguards",
|
|
35
|
+
"l3-dep-scan": "technical_safeguards",
|
|
36
|
+
"l3-missing-bias-testing": "risk_management",
|
|
37
|
+
|
|
38
|
+
"ai-disclosure": "transparency",
|
|
39
|
+
"content-marking": "transparency",
|
|
40
|
+
"interaction-logging": "technical_safeguards",
|
|
41
|
+
"gpai-transparency": "documentation",
|
|
42
|
+
"gpai-systemic-risk": "documentation",
|
|
43
|
+
"l4-disclosure": "transparency",
|
|
44
|
+
"l4-content-marking": "transparency",
|
|
45
|
+
"l4-human-oversight": "organizational",
|
|
46
|
+
"l4-kill-switch": "organizational",
|
|
47
|
+
"l4-logging": "technical_safeguards",
|
|
48
|
+
"l4-cybersecurity": "technical_safeguards",
|
|
49
|
+
"l4-accuracy-robustness": "technical_safeguards",
|
|
50
|
+
"l4-nhi-clean": "technical_safeguards",
|
|
51
|
+
"l4-data-governance": "risk_management",
|
|
52
|
+
"l4-gpai-transparency": "documentation",
|
|
53
|
+
"l4-conformity-assessment": "documentation",
|
|
54
|
+
"l4-deployer-monitoring": "deployer_specific",
|
|
55
|
+
"l4-record-keeping": "deployer_specific",
|
|
56
|
+
"l4-ast-wrapped-call": "transparency",
|
|
57
|
+
|
|
58
|
+
"git-freshness-risk-management": "risk_management",
|
|
59
|
+
"git-freshness-data-governance": "risk_management",
|
|
60
|
+
"git-freshness-qms": "risk_management",
|
|
61
|
+
"git-freshness-technical-documentation": "documentation",
|
|
62
|
+
"git-freshness-declaration-of-conformity": "documentation",
|
|
63
|
+
"git-freshness-instructions-for-use": "transparency",
|
|
64
|
+
"git-freshness-monitoring-policy": "deployer_specific",
|
|
65
|
+
"git-freshness-fria": "deployer_specific",
|
|
66
|
+
"git-freshness-worker-notification": "monitoring_and_reporting",
|
|
67
|
+
"git-freshness-incident-report": "monitoring_and_reporting",
|
|
68
|
+
"git-author-diversity-fria": "deployer_specific",
|
|
69
|
+
"git-author-diversity-risk-management": "risk_management",
|
|
70
|
+
"git-bulk-compliance": "organizational",
|
|
71
|
+
|
|
72
|
+
"ext-semgrep-complior-injection-js": "technical_safeguards",
|
|
73
|
+
"ext-semgrep-complior-injection-py": "technical_safeguards",
|
|
74
|
+
"ext-detect-secrets-Secret-Keyword": "technical_safeguards",
|
|
75
|
+
"ext-detect-secrets-Base64-High-Entropy": "technical_safeguards",
|
|
76
|
+
"ext-detect-secrets-Hex-High-Entropy": "technical_safeguards",
|
|
77
|
+
"ext-bandit-hardcoded-password": "technical_safeguards",
|
|
78
|
+
"ext-bandit-sql-injection": "technical_safeguards",
|
|
79
|
+
"ext-modelscan-malicious-model": "risk_management"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"score": {
|
|
3
|
+
"totalScore": 72.5,
|
|
4
|
+
"zone": "yellow",
|
|
5
|
+
"categoryScores": [
|
|
6
|
+
{
|
|
7
|
+
"category": "documentation",
|
|
8
|
+
"weight": 0.25,
|
|
9
|
+
"score": 80.0,
|
|
10
|
+
"obligationCount": 5,
|
|
11
|
+
"passedCount": 4
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"category": "technical",
|
|
15
|
+
"weight": 0.35,
|
|
16
|
+
"score": 65.0,
|
|
17
|
+
"obligationCount": 8,
|
|
18
|
+
"passedCount": 5
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"criticalCapApplied": false,
|
|
22
|
+
"confidenceSummary": { "average": 0.82, "low_confidence_count": 2 },
|
|
23
|
+
"totalChecks": 20,
|
|
24
|
+
"passedChecks": 14,
|
|
25
|
+
"failedChecks": 4,
|
|
26
|
+
"skippedChecks": 2
|
|
27
|
+
},
|
|
28
|
+
"findings": [
|
|
29
|
+
{
|
|
30
|
+
"checkId": "l4-bare-api-call",
|
|
31
|
+
"type": "info",
|
|
32
|
+
"message": "Bare OpenAI API call detected in src/ai/chat.ts:42. Consider @complior/sdk for runtime compliance.",
|
|
33
|
+
"severity": "info",
|
|
34
|
+
"file": "src/ai/chat.ts",
|
|
35
|
+
"line": 42,
|
|
36
|
+
"obligationId": "OBL-015",
|
|
37
|
+
"articleReference": "Art. 14(4)",
|
|
38
|
+
"fix": "Optional: wrap with @complior/sdk for runtime Art. 50/12/14 enforcement",
|
|
39
|
+
"codeContext": {
|
|
40
|
+
"lines": [
|
|
41
|
+
{ "num": 40, "content": "async function chat(prompt: string) {" },
|
|
42
|
+
{ "num": 41, "content": " const client = new OpenAI();" },
|
|
43
|
+
{ "num": 42, "content": " return client.chat.completions.create({" },
|
|
44
|
+
{ "num": 43, "content": " model: 'gpt-4'," },
|
|
45
|
+
{ "num": 44, "content": " messages: [{ role: 'user', content: prompt }]" }
|
|
46
|
+
],
|
|
47
|
+
"startLine": 40,
|
|
48
|
+
"highlightLine": 42
|
|
49
|
+
},
|
|
50
|
+
"priority": 3,
|
|
51
|
+
"confidence": 0.95,
|
|
52
|
+
"confidenceLevel": "high",
|
|
53
|
+
"evidence": [{ "source": "ast", "pattern": "new OpenAI()" }]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"checkId": "l1-missing-fria",
|
|
57
|
+
"type": "fail",
|
|
58
|
+
"message": "Missing Fundamental Rights Impact Assessment document",
|
|
59
|
+
"severity": "medium",
|
|
60
|
+
"obligationId": "OBL-028",
|
|
61
|
+
"articleReference": "Art. 27"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"checkId": "l3-no-logging",
|
|
65
|
+
"type": "fail",
|
|
66
|
+
"message": "No structured logging configuration found",
|
|
67
|
+
"severity": "medium",
|
|
68
|
+
"file": "package.json",
|
|
69
|
+
"line": 1
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"projectPath": "/home/user/my-ai-project",
|
|
73
|
+
"scannedAt": "2026-03-01T14:30:00Z",
|
|
74
|
+
"duration": 1250,
|
|
75
|
+
"filesScanned": 47,
|
|
76
|
+
"deepAnalysis": false,
|
|
77
|
+
"l5Cost": 0.0,
|
|
78
|
+
"regulationVersion": { "version": "1.0.0", "framework": "eu-ai-act" }
|
|
79
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://complior.ai/schemas/http-contract.json",
|
|
4
|
+
"title": "Complior HTTP Contract",
|
|
5
|
+
"description": "Shared types between TS engine (producer) and Rust TUI (consumer). Field names are camelCase in JSON. Rust uses #[serde(rename_all = \"camelCase\")] for automatic mapping.",
|
|
6
|
+
"$defs": {
|
|
7
|
+
"Severity": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"enum": ["critical", "high", "medium", "low", "info"]
|
|
10
|
+
},
|
|
11
|
+
"Zone": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"enum": ["red", "yellow", "green"]
|
|
14
|
+
},
|
|
15
|
+
"CheckResultType": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"enum": ["pass", "fail", "skip", "info"]
|
|
18
|
+
},
|
|
19
|
+
"CodeContextLine": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"required": ["num", "content"],
|
|
22
|
+
"properties": {
|
|
23
|
+
"num": { "type": "integer" },
|
|
24
|
+
"content": { "type": "string" }
|
|
25
|
+
},
|
|
26
|
+
"additionalProperties": false
|
|
27
|
+
},
|
|
28
|
+
"CodeContext": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"required": ["lines", "startLine"],
|
|
31
|
+
"properties": {
|
|
32
|
+
"lines": {
|
|
33
|
+
"type": "array",
|
|
34
|
+
"items": { "$ref": "#/$defs/CodeContextLine" }
|
|
35
|
+
},
|
|
36
|
+
"startLine": { "type": "integer" },
|
|
37
|
+
"highlightLine": { "type": "integer" }
|
|
38
|
+
},
|
|
39
|
+
"additionalProperties": false
|
|
40
|
+
},
|
|
41
|
+
"FixDiff": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"required": ["before", "after", "startLine", "filePath"],
|
|
44
|
+
"properties": {
|
|
45
|
+
"before": {
|
|
46
|
+
"type": "array",
|
|
47
|
+
"items": { "type": "string" }
|
|
48
|
+
},
|
|
49
|
+
"after": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": { "type": "string" }
|
|
52
|
+
},
|
|
53
|
+
"startLine": { "type": "integer" },
|
|
54
|
+
"filePath": { "type": "string" },
|
|
55
|
+
"importLine": { "type": "string" }
|
|
56
|
+
},
|
|
57
|
+
"additionalProperties": false
|
|
58
|
+
},
|
|
59
|
+
"Finding": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"required": ["checkId", "type", "message", "severity"],
|
|
62
|
+
"properties": {
|
|
63
|
+
"checkId": { "type": "string" },
|
|
64
|
+
"type": { "$ref": "#/$defs/CheckResultType" },
|
|
65
|
+
"message": { "type": "string" },
|
|
66
|
+
"severity": { "$ref": "#/$defs/Severity" },
|
|
67
|
+
"file": { "type": "string" },
|
|
68
|
+
"line": { "type": "integer" },
|
|
69
|
+
"obligationId": { "type": "string" },
|
|
70
|
+
"articleReference": { "type": "string" },
|
|
71
|
+
"fix": { "type": "string" },
|
|
72
|
+
"priority": { "type": "integer" },
|
|
73
|
+
"confidence": { "type": "integer" },
|
|
74
|
+
"confidenceLevel": { "type": "string" },
|
|
75
|
+
"evidence": {
|
|
76
|
+
"type": "array",
|
|
77
|
+
"items": { "type": "object" }
|
|
78
|
+
},
|
|
79
|
+
"codeContext": { "$ref": "#/$defs/CodeContext" },
|
|
80
|
+
"fixDiff": { "$ref": "#/$defs/FixDiff" }
|
|
81
|
+
},
|
|
82
|
+
"additionalProperties": false
|
|
83
|
+
},
|
|
84
|
+
"CategoryScore": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"required": ["category", "weight", "score", "obligationCount", "passedCount"],
|
|
87
|
+
"properties": {
|
|
88
|
+
"category": { "type": "string" },
|
|
89
|
+
"weight": { "type": "number" },
|
|
90
|
+
"score": { "type": "number" },
|
|
91
|
+
"obligationCount": { "type": "integer" },
|
|
92
|
+
"passedCount": { "type": "integer" }
|
|
93
|
+
},
|
|
94
|
+
"additionalProperties": false
|
|
95
|
+
},
|
|
96
|
+
"ScoreBreakdown": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"required": [
|
|
99
|
+
"totalScore", "zone", "categoryScores",
|
|
100
|
+
"criticalCapApplied", "totalChecks", "passedChecks",
|
|
101
|
+
"failedChecks", "skippedChecks"
|
|
102
|
+
],
|
|
103
|
+
"properties": {
|
|
104
|
+
"totalScore": { "type": "number" },
|
|
105
|
+
"zone": { "$ref": "#/$defs/Zone" },
|
|
106
|
+
"categoryScores": {
|
|
107
|
+
"type": "array",
|
|
108
|
+
"items": { "$ref": "#/$defs/CategoryScore" }
|
|
109
|
+
},
|
|
110
|
+
"criticalCapApplied": { "type": "boolean" },
|
|
111
|
+
"totalChecks": { "type": "integer" },
|
|
112
|
+
"passedChecks": { "type": "integer" },
|
|
113
|
+
"failedChecks": { "type": "integer" },
|
|
114
|
+
"skippedChecks": { "type": "integer" },
|
|
115
|
+
"confidenceSummary": { "type": "object" }
|
|
116
|
+
},
|
|
117
|
+
"additionalProperties": false
|
|
118
|
+
},
|
|
119
|
+
"ScanResult": {
|
|
120
|
+
"type": "object",
|
|
121
|
+
"required": [
|
|
122
|
+
"score", "findings", "projectPath",
|
|
123
|
+
"scannedAt", "duration", "filesScanned"
|
|
124
|
+
],
|
|
125
|
+
"properties": {
|
|
126
|
+
"score": { "$ref": "#/$defs/ScoreBreakdown" },
|
|
127
|
+
"findings": {
|
|
128
|
+
"type": "array",
|
|
129
|
+
"items": { "$ref": "#/$defs/Finding" }
|
|
130
|
+
},
|
|
131
|
+
"projectPath": { "type": "string" },
|
|
132
|
+
"scannedAt": { "type": "string" },
|
|
133
|
+
"duration": { "type": "number" },
|
|
134
|
+
"filesScanned": { "type": "integer" },
|
|
135
|
+
"deepAnalysis": { "type": "boolean" },
|
|
136
|
+
"l5Cost": { "type": "number" },
|
|
137
|
+
"regulationVersion": { "type": "object" }
|
|
138
|
+
},
|
|
139
|
+
"additionalProperties": false
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"type": "object",
|
|
143
|
+
"$ref": "#/$defs/ScanResult"
|
|
144
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
rules:
|
|
2
|
+
- id: complior.bare-call
|
|
3
|
+
patterns:
|
|
4
|
+
- pattern-either:
|
|
5
|
+
# Python — OpenAI
|
|
6
|
+
- pattern: openai.ChatCompletion.create(...)
|
|
7
|
+
- pattern: openai.Completion.create(...)
|
|
8
|
+
- pattern: $CLIENT.chat.completions.create(...)
|
|
9
|
+
- pattern: $CLIENT.completions.create(...)
|
|
10
|
+
# Python — Anthropic
|
|
11
|
+
- pattern: $CLIENT.messages.create(...)
|
|
12
|
+
- pattern: anthropic.Anthropic(...).messages.create(...)
|
|
13
|
+
# JS/TS — constructors (bare usage without wrapper)
|
|
14
|
+
- pattern: new OpenAI(...)
|
|
15
|
+
- pattern: new Anthropic(...)
|
|
16
|
+
# JS/TS — Vercel AI SDK
|
|
17
|
+
- pattern: generateText(...)
|
|
18
|
+
- pattern: streamText(...)
|
|
19
|
+
- pattern-not-inside: complior(...)
|
|
20
|
+
- pattern-not-inside: compliorAgent(...)
|
|
21
|
+
message: >
|
|
22
|
+
Bare LLM API call detected. Consider wrapping with @complior/sdk
|
|
23
|
+
(complior() or compliorAgent()) for runtime EU AI Act enforcement:
|
|
24
|
+
AI disclosure (Art. 50), interaction logging (Art. 12),
|
|
25
|
+
content marking (Art. 50(2)), and human oversight (Art. 14).
|
|
26
|
+
This is informational — bare calls are not a compliance violation.
|
|
27
|
+
severity: INFO
|
|
28
|
+
languages: [python, javascript, typescript]
|
|
29
|
+
metadata:
|
|
30
|
+
category: ai-compliance
|
|
31
|
+
subcategory: unwrapped-call
|
|
32
|
+
article: "Art. 50(1)"
|
|
33
|
+
obligation: OBL-015
|
|
34
|
+
cwe:
|
|
35
|
+
- "CWE-778: Insufficient Logging"
|
|
36
|
+
confidence: HIGH
|
|
37
|
+
impact: HIGH
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
rules:
|
|
2
|
+
- id: complior.injection
|
|
3
|
+
patterns:
|
|
4
|
+
- pattern-either:
|
|
5
|
+
# Python — f-strings in messages
|
|
6
|
+
- pattern: |
|
|
7
|
+
$CLIENT.chat.completions.create(
|
|
8
|
+
...,
|
|
9
|
+
messages=[..., {"role": "user", "content": f"...{$VAR}..."}, ...],
|
|
10
|
+
...
|
|
11
|
+
)
|
|
12
|
+
- pattern: |
|
|
13
|
+
$CLIENT.messages.create(
|
|
14
|
+
...,
|
|
15
|
+
messages=[..., {"role": "user", "content": f"...{$VAR}..."}, ...],
|
|
16
|
+
...
|
|
17
|
+
)
|
|
18
|
+
# Python — .format()
|
|
19
|
+
- pattern: |
|
|
20
|
+
$CLIENT.chat.completions.create(
|
|
21
|
+
...,
|
|
22
|
+
messages=[..., {"role": "user", "content": "...{}...".format($VAR)}, ...],
|
|
23
|
+
...
|
|
24
|
+
)
|
|
25
|
+
# Python — concatenation
|
|
26
|
+
- pattern: |
|
|
27
|
+
$CLIENT.chat.completions.create(
|
|
28
|
+
...,
|
|
29
|
+
messages=[..., {"role": "user", "content": "..." + $VAR + "..."}, ...],
|
|
30
|
+
...
|
|
31
|
+
)
|
|
32
|
+
message: >
|
|
33
|
+
Potential prompt injection: user-controlled input interpolated directly
|
|
34
|
+
into an LLM prompt. This allows adversarial prompt manipulation,
|
|
35
|
+
violating EU AI Act Art. 15 (robustness) and Art. 9 (risk management).
|
|
36
|
+
Use parameterized prompts, input validation, or the @complior/sdk
|
|
37
|
+
sanitize hook.
|
|
38
|
+
severity: ERROR
|
|
39
|
+
languages: [python]
|
|
40
|
+
metadata:
|
|
41
|
+
category: security
|
|
42
|
+
subcategory: prompt-injection
|
|
43
|
+
article: "Art. 15"
|
|
44
|
+
obligation: OBL-006
|
|
45
|
+
cwe:
|
|
46
|
+
- "CWE-77: Command Injection"
|
|
47
|
+
- "CWE-94: Improper Control of Generation of Code"
|
|
48
|
+
confidence: MEDIUM
|
|
49
|
+
impact: HIGH
|
|
50
|
+
|
|
51
|
+
- id: complior.injection-js
|
|
52
|
+
patterns:
|
|
53
|
+
- pattern-either:
|
|
54
|
+
# Template literals in message content
|
|
55
|
+
- pattern: "{role: \"user\", content: `...${$VAR}...`}"
|
|
56
|
+
# String concatenation in message content
|
|
57
|
+
- pattern: "{role: \"user\", content: $PREFIX + $USER_INPUT}"
|
|
58
|
+
- pattern: "{role: \"user\", content: $PREFIX + $USER_INPUT + $SUFFIX}"
|
|
59
|
+
message: >
|
|
60
|
+
Potential prompt injection: user input interpolated via template literal
|
|
61
|
+
or concatenation into LLM message. Violates EU AI Act Art. 15
|
|
62
|
+
(robustness). Use parameterized prompts or input sanitization.
|
|
63
|
+
severity: ERROR
|
|
64
|
+
languages: [javascript, typescript]
|
|
65
|
+
metadata:
|
|
66
|
+
category: security
|
|
67
|
+
subcategory: prompt-injection
|
|
68
|
+
article: "Art. 15"
|
|
69
|
+
obligation: OBL-006
|
|
70
|
+
cwe:
|
|
71
|
+
- "CWE-77: Command Injection"
|
|
72
|
+
confidence: MEDIUM
|
|
73
|
+
impact: HIGH
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
rules:
|
|
2
|
+
- id: complior.missing-error-handling
|
|
3
|
+
patterns:
|
|
4
|
+
- pattern-either:
|
|
5
|
+
- pattern: await $CLIENT.chat.completions.create(...)
|
|
6
|
+
- pattern: await $CLIENT.completions.create(...)
|
|
7
|
+
- pattern: await $CLIENT.messages.create(...)
|
|
8
|
+
- pattern: await $CLIENT.embeddings.create(...)
|
|
9
|
+
- pattern: await generateText(...)
|
|
10
|
+
- pattern: await streamText(...)
|
|
11
|
+
- pattern-not-inside: |
|
|
12
|
+
try { ... } catch ($ERR) { ... }
|
|
13
|
+
message: >
|
|
14
|
+
LLM API call without error handling. LLM calls can fail from rate limits,
|
|
15
|
+
network errors, content filtering, or quota exhaustion. Unhandled errors
|
|
16
|
+
in AI systems violate EU AI Act Art. 15 (robustness) and may cause
|
|
17
|
+
undefined system behavior. Wrap in try/catch with fallback logic.
|
|
18
|
+
severity: WARNING
|
|
19
|
+
languages: [javascript, typescript]
|
|
20
|
+
metadata:
|
|
21
|
+
category: robustness
|
|
22
|
+
subcategory: error-handling
|
|
23
|
+
article: "Art. 15"
|
|
24
|
+
obligation: OBL-015
|
|
25
|
+
cwe:
|
|
26
|
+
- "CWE-755: Improper Handling of Exceptional Conditions"
|
|
27
|
+
- "CWE-391: Unchecked Error Condition"
|
|
28
|
+
confidence: MEDIUM
|
|
29
|
+
impact: MEDIUM
|
|
30
|
+
|
|
31
|
+
- id: complior.missing-error-handling-python
|
|
32
|
+
patterns:
|
|
33
|
+
- pattern-either:
|
|
34
|
+
- pattern: $CLIENT.chat.completions.create(...)
|
|
35
|
+
- pattern: $CLIENT.completions.create(...)
|
|
36
|
+
- pattern: $CLIENT.messages.create(...)
|
|
37
|
+
- pattern: $CLIENT.embeddings.create(...)
|
|
38
|
+
- pattern: openai.ChatCompletion.create(...)
|
|
39
|
+
- pattern-not-inside: |
|
|
40
|
+
try:
|
|
41
|
+
...
|
|
42
|
+
except $ERR:
|
|
43
|
+
...
|
|
44
|
+
message: >
|
|
45
|
+
LLM API call without error handling. Unhandled exceptions from LLM APIs
|
|
46
|
+
violate EU AI Act Art. 15 (robustness). Wrap in try/except with
|
|
47
|
+
appropriate fallback logic.
|
|
48
|
+
severity: WARNING
|
|
49
|
+
languages: [python]
|
|
50
|
+
metadata:
|
|
51
|
+
category: robustness
|
|
52
|
+
subcategory: error-handling
|
|
53
|
+
article: "Art. 15"
|
|
54
|
+
obligation: OBL-015
|
|
55
|
+
cwe:
|
|
56
|
+
- "CWE-755: Improper Handling of Exceptional Conditions"
|
|
57
|
+
confidence: MEDIUM
|
|
58
|
+
impact: MEDIUM
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
rules:
|
|
2
|
+
- id: complior.unsafe-deser
|
|
3
|
+
patterns:
|
|
4
|
+
- pattern-either:
|
|
5
|
+
# Python pickle family
|
|
6
|
+
- pattern: pickle.load(...)
|
|
7
|
+
- pattern: pickle.loads(...)
|
|
8
|
+
- pattern: _pickle.load(...)
|
|
9
|
+
- pattern: _pickle.loads(...)
|
|
10
|
+
- pattern: cPickle.load(...)
|
|
11
|
+
- pattern: cPickle.loads(...)
|
|
12
|
+
# Python marshal / shelve
|
|
13
|
+
- pattern: marshal.load(...)
|
|
14
|
+
- pattern: marshal.loads(...)
|
|
15
|
+
- pattern: shelve.open(...)
|
|
16
|
+
# Python YAML (unsafe loaders)
|
|
17
|
+
- pattern: yaml.load(...)
|
|
18
|
+
- pattern: yaml.unsafe_load(...)
|
|
19
|
+
# PyTorch — unsafe model loading
|
|
20
|
+
- pattern: torch.load(...)
|
|
21
|
+
# Python dill
|
|
22
|
+
- pattern: dill.load(...)
|
|
23
|
+
- pattern: dill.loads(...)
|
|
24
|
+
message: >
|
|
25
|
+
Unsafe deserialization detected. pickle, marshal, yaml.load, and
|
|
26
|
+
torch.load can execute arbitrary code on untrusted input — a critical
|
|
27
|
+
supply-chain risk for AI systems. Violates EU AI Act Art. 15
|
|
28
|
+
(cybersecurity). Use safe alternatives: json, yaml.safe_load(),
|
|
29
|
+
safetensors, torch.load(..., weights_only=True).
|
|
30
|
+
severity: ERROR
|
|
31
|
+
languages: [python]
|
|
32
|
+
metadata:
|
|
33
|
+
category: security
|
|
34
|
+
subcategory: unsafe-deserialization
|
|
35
|
+
article: "Art. 15"
|
|
36
|
+
obligation: OBL-006
|
|
37
|
+
cwe:
|
|
38
|
+
- "CWE-502: Deserialization of Untrusted Data"
|
|
39
|
+
confidence: HIGH
|
|
40
|
+
impact: HIGH
|
|
41
|
+
|
|
42
|
+
- id: complior.unsafe-deser-js
|
|
43
|
+
patterns:
|
|
44
|
+
- pattern-either:
|
|
45
|
+
- pattern: eval(...)
|
|
46
|
+
- pattern: new Function(...)
|
|
47
|
+
- pattern: vm.runInNewContext(...)
|
|
48
|
+
- pattern: vm.runInThisContext(...)
|
|
49
|
+
message: >
|
|
50
|
+
Unsafe code execution detected. eval(), Function(), and vm.runIn*()
|
|
51
|
+
on untrusted input can lead to code injection. In AI systems this
|
|
52
|
+
violates EU AI Act Art. 15 (cybersecurity). Use JSON.parse() with
|
|
53
|
+
Zod/schema validation instead.
|
|
54
|
+
severity: ERROR
|
|
55
|
+
languages: [javascript, typescript]
|
|
56
|
+
metadata:
|
|
57
|
+
category: security
|
|
58
|
+
subcategory: unsafe-deserialization
|
|
59
|
+
article: "Art. 15"
|
|
60
|
+
obligation: OBL-006
|
|
61
|
+
cwe:
|
|
62
|
+
- "CWE-502: Deserialization of Untrusted Data"
|
|
63
|
+
- "CWE-94: Improper Control of Generation of Code"
|
|
64
|
+
confidence: MEDIUM
|
|
65
|
+
impact: HIGH
|