@ai-primitives-hub/app 0.2.1 → 0.2.2-next.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/README.md +5 -1
- package/dist/collection/affected-collections.d.ts +11 -0
- package/dist/collection/affected-collections.d.ts.map +1 -0
- package/dist/collection/affected-collections.js +90 -0
- package/dist/collection/affected-collections.js.map +1 -0
- package/dist/collection/create-plugin.d.ts +35 -0
- package/dist/collection/create-plugin.d.ts.map +1 -0
- package/dist/collection/create-plugin.js +118 -0
- package/dist/collection/create-plugin.js.map +1 -0
- package/dist/collection/index.d.ts +4 -2
- package/dist/collection/index.d.ts.map +1 -1
- package/dist/collection/index.js +8 -4
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/kind-route-warning.d.ts +13 -0
- package/dist/collection/kind-route-warning.d.ts.map +1 -0
- package/dist/collection/kind-route-warning.js +40 -0
- package/dist/collection/kind-route-warning.js.map +1 -0
- package/dist/collection/plugin-item-issues.d.ts +36 -0
- package/dist/collection/plugin-item-issues.d.ts.map +1 -0
- package/dist/collection/plugin-item-issues.js +31 -0
- package/dist/collection/plugin-item-issues.js.map +1 -0
- package/dist/collection/read-collection.d.ts +1 -1
- package/dist/collection/read-collection.d.ts.map +1 -1
- package/dist/collection/read-collection.js +14 -15
- package/dist/collection/read-collection.js.map +1 -1
- package/dist/collection-editor/collection-contribution-workflow.d.ts +96 -0
- package/dist/collection-editor/collection-contribution-workflow.d.ts.map +1 -0
- package/dist/collection-editor/collection-contribution-workflow.js +479 -0
- package/dist/collection-editor/collection-contribution-workflow.js.map +1 -0
- package/dist/collection-editor/collection-editor-service.d.ts +232 -0
- package/dist/collection-editor/collection-editor-service.d.ts.map +1 -0
- package/dist/collection-editor/collection-editor-service.js +868 -0
- package/dist/collection-editor/collection-editor-service.js.map +1 -0
- package/dist/collection-editor/index.d.ts +7 -0
- package/dist/collection-editor/index.d.ts.map +1 -0
- package/dist/collection-editor/index.js +12 -0
- package/dist/collection-editor/index.js.map +1 -0
- package/dist/diagnostics/find-ancestor-file.d.ts +13 -0
- package/dist/diagnostics/find-ancestor-file.d.ts.map +1 -0
- package/dist/diagnostics/find-ancestor-file.js +85 -0
- package/dist/diagnostics/find-ancestor-file.js.map +1 -0
- package/dist/diagnostics/index.d.ts +10 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics/index.js +26 -0
- package/dist/diagnostics/index.js.map +1 -0
- package/dist/diagnostics/run-primitive-diagnostics.d.ts +43 -0
- package/dist/diagnostics/run-primitive-diagnostics.d.ts.map +1 -0
- package/dist/diagnostics/run-primitive-diagnostics.js +413 -0
- package/dist/diagnostics/run-primitive-diagnostics.js.map +1 -0
- package/dist/diagnostics/sandbox-snapshot.d.ts +20 -0
- package/dist/diagnostics/sandbox-snapshot.d.ts.map +1 -0
- package/dist/diagnostics/sandbox-snapshot.js +117 -0
- package/dist/diagnostics/sandbox-snapshot.js.map +1 -0
- package/dist/governance/generate-catalogue.d.ts +16 -0
- package/dist/governance/generate-catalogue.d.ts.map +1 -0
- package/dist/governance/generate-catalogue.js +67 -0
- package/dist/governance/generate-catalogue.js.map +1 -0
- package/dist/governance/hub-scoped-governance.d.ts +37 -0
- package/dist/governance/hub-scoped-governance.d.ts.map +1 -0
- package/dist/governance/hub-scoped-governance.js +110 -0
- package/dist/governance/hub-scoped-governance.js.map +1 -0
- package/dist/governance/index.d.ts +10 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +26 -0
- package/dist/governance/index.js.map +1 -0
- package/dist/governance/load-config.d.ts +45 -0
- package/dist/governance/load-config.d.ts.map +1 -0
- package/dist/governance/load-config.js +137 -0
- package/dist/governance/load-config.js.map +1 -0
- package/dist/governance/pr-scope.d.ts +23 -0
- package/dist/governance/pr-scope.d.ts.map +1 -0
- package/dist/governance/pr-scope.js +22 -0
- package/dist/governance/pr-scope.js.map +1 -0
- package/dist/governance/report.d.ts +23 -0
- package/dist/governance/report.d.ts.map +1 -0
- package/dist/governance/report.js +177 -0
- package/dist/governance/report.js.map +1 -0
- package/dist/governance/run-governance.d.ts +22 -0
- package/dist/governance/run-governance.d.ts.map +1 -0
- package/dist/governance/run-governance.js +78 -0
- package/dist/governance/run-governance.js.map +1 -0
- package/dist/governance/source-checks.d.ts +29 -0
- package/dist/governance/source-checks.d.ts.map +1 -0
- package/dist/governance/source-checks.js +80 -0
- package/dist/governance/source-checks.js.map +1 -0
- package/dist/governance/validate-collection-governance.d.ts +46 -0
- package/dist/governance/validate-collection-governance.d.ts.map +1 -0
- package/dist/governance/validate-collection-governance.js +291 -0
- package/dist/governance/validate-collection-governance.js.map +1 -0
- package/dist/hub-editor/hub-config-editor-service.d.ts +94 -0
- package/dist/hub-editor/hub-config-editor-service.d.ts.map +1 -0
- package/dist/hub-editor/hub-config-editor-service.js +289 -0
- package/dist/hub-editor/hub-config-editor-service.js.map +1 -0
- package/dist/hub-editor/hub-contribution-workflow.d.ts +99 -0
- package/dist/hub-editor/hub-contribution-workflow.d.ts.map +1 -0
- package/dist/hub-editor/hub-contribution-workflow.js +385 -0
- package/dist/hub-editor/hub-contribution-workflow.js.map +1 -0
- package/dist/hub-editor/index.d.ts +7 -0
- package/dist/hub-editor/index.d.ts.map +1 -0
- package/dist/hub-editor/index.js +23 -0
- package/dist/hub-editor/index.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/install/index.d.ts +2 -0
- package/dist/install/index.d.ts.map +1 -1
- package/dist/install/index.js +3 -1
- package/dist/install/index.js.map +1 -1
- package/dist/install/partial-target-write.d.ts +63 -0
- package/dist/install/partial-target-write.d.ts.map +1 -0
- package/dist/install/partial-target-write.js +128 -0
- package/dist/install/partial-target-write.js.map +1 -0
- package/dist/install/pipeline.d.ts +2 -1
- package/dist/install/pipeline.d.ts.map +1 -1
- package/dist/install/pipeline.js +4 -3
- package/dist/install/pipeline.js.map +1 -1
- package/dist/install/target-write.d.ts +10 -0
- package/dist/install/target-write.d.ts.map +1 -1
- package/dist/install/target-write.js +3 -2
- package/dist/install/target-write.js.map +1 -1
- package/dist/install/uninstall-pipeline.d.ts +11 -10
- package/dist/install/uninstall-pipeline.d.ts.map +1 -1
- package/dist/install/uninstall-pipeline.js +10 -11
- package/dist/install/uninstall-pipeline.js.map +1 -1
- package/dist/records/atomic-write.d.ts +11 -0
- package/dist/records/atomic-write.d.ts.map +1 -0
- package/dist/records/atomic-write.js +66 -0
- package/dist/records/atomic-write.js.map +1 -0
- package/dist/records/confine-path.d.ts +35 -0
- package/dist/records/confine-path.d.ts.map +1 -0
- package/dist/records/confine-path.js +140 -0
- package/dist/records/confine-path.js.map +1 -0
- package/dist/records/git-root.d.ts +66 -0
- package/dist/records/git-root.d.ts.map +1 -0
- package/dist/records/git-root.js +208 -0
- package/dist/records/git-root.js.map +1 -0
- package/dist/records/index.d.ts +30 -0
- package/dist/records/index.d.ts.map +1 -0
- package/dist/records/index.js +46 -0
- package/dist/records/index.js.map +1 -0
- package/dist/records/install-record-service.d.ts +496 -0
- package/dist/records/install-record-service.d.ts.map +1 -0
- package/dist/records/install-record-service.js +1365 -0
- package/dist/records/install-record-service.js.map +1 -0
- package/dist/records/install-record-services.d.ts +29 -0
- package/dist/records/install-record-services.d.ts.map +1 -0
- package/dist/records/install-record-services.js +17 -0
- package/dist/records/install-record-services.js.map +1 -0
- package/dist/records/legacy-shapes.d.ts +18 -0
- package/dist/records/legacy-shapes.d.ts.map +1 -0
- package/dist/records/legacy-shapes.js +30 -0
- package/dist/records/legacy-shapes.js.map +1 -0
- package/dist/records/map-tool-to-target.d.ts +33 -0
- package/dist/records/map-tool-to-target.d.ts.map +1 -0
- package/dist/records/map-tool-to-target.js +98 -0
- package/dist/records/map-tool-to-target.js.map +1 -0
- package/dist/records/mcp-servers.d.ts +116 -0
- package/dist/records/mcp-servers.d.ts.map +1 -0
- package/dist/records/mcp-servers.js +268 -0
- package/dist/records/mcp-servers.js.map +1 -0
- package/dist/records/modified-files.d.ts +32 -0
- package/dist/records/modified-files.d.ts.map +1 -0
- package/dist/records/modified-files.js +146 -0
- package/dist/records/modified-files.js.map +1 -0
- package/dist/records/plan-record-entries.d.ts +76 -0
- package/dist/records/plan-record-entries.d.ts.map +1 -0
- package/dist/records/plan-record-entries.js +84 -0
- package/dist/records/plan-record-entries.js.map +1 -0
- package/dist/records/read-record-text.d.ts +15 -0
- package/dist/records/read-record-text.d.ts.map +1 -0
- package/dist/records/read-record-text.js +36 -0
- package/dist/records/read-record-text.js.map +1 -0
- package/dist/records/record-entry.d.ts +31 -0
- package/dist/records/record-entry.d.ts.map +1 -0
- package/dist/records/record-entry.js +81 -0
- package/dist/records/record-entry.js.map +1 -0
- package/dist/records/record-file-shape.d.ts +90 -0
- package/dist/records/record-file-shape.d.ts.map +1 -0
- package/dist/records/record-file-shape.js +288 -0
- package/dist/records/record-file-shape.js.map +1 -0
- package/dist/records/record-hub.d.ts +42 -0
- package/dist/records/record-hub.d.ts.map +1 -0
- package/dist/records/record-hub.js +85 -0
- package/dist/records/record-hub.js.map +1 -0
- package/dist/records/record-identity.d.ts +14 -0
- package/dist/records/record-identity.d.ts.map +1 -0
- package/dist/records/record-identity.js +41 -0
- package/dist/records/record-identity.js.map +1 -0
- package/dist/records/record-migration.d.ts +118 -0
- package/dist/records/record-migration.d.ts.map +1 -0
- package/dist/records/record-migration.js +454 -0
- package/dist/records/record-migration.js.map +1 -0
- package/dist/records/record-store.d.ts +123 -0
- package/dist/records/record-store.d.ts.map +1 -0
- package/dist/records/record-store.js +291 -0
- package/dist/records/record-store.js.map +1 -0
- package/dist/records/resolve-record-source.d.ts +64 -0
- package/dist/records/resolve-record-source.d.ts.map +1 -0
- package/dist/records/resolve-record-source.js +160 -0
- package/dist/records/resolve-record-source.js.map +1 -0
- package/dist/records/sanitize-source.d.ts +18 -0
- package/dist/records/sanitize-source.d.ts.map +1 -0
- package/dist/records/sanitize-source.js +90 -0
- package/dist/records/sanitize-source.js.map +1 -0
- package/dist/records/select-record.d.ts +54 -0
- package/dist/records/select-record.d.ts.map +1 -0
- package/dist/records/select-record.js +180 -0
- package/dist/records/select-record.js.map +1 -0
- package/dist/records/serialize-record.d.ts +20 -0
- package/dist/records/serialize-record.d.ts.map +1 -0
- package/dist/records/serialize-record.js +100 -0
- package/dist/records/serialize-record.js.map +1 -0
- package/dist/records/source-fields.d.ts +21 -0
- package/dist/records/source-fields.d.ts.map +1 -0
- package/dist/records/source-fields.js +28 -0
- package/dist/records/source-fields.js.map +1 -0
- package/dist/records/to-record-source.d.ts +23 -0
- package/dist/records/to-record-source.d.ts.map +1 -0
- package/dist/records/to-record-source.js +39 -0
- package/dist/records/to-record-source.js.map +1 -0
- package/dist/records/user-home.d.ts +16 -0
- package/dist/records/user-home.d.ts.map +1 -0
- package/dist/records/user-home.js +84 -0
- package/dist/records/user-home.js.map +1 -0
- package/dist/records/writer-group.d.ts +7 -0
- package/dist/records/writer-group.d.ts.map +1 -0
- package/dist/records/writer-group.js +31 -0
- package/dist/records/writer-group.js.map +1 -0
- package/dist/registry/activate-registry-profile.d.ts.map +1 -1
- package/dist/registry/activate-registry-profile.js +4 -1
- package/dist/registry/activate-registry-profile.js.map +1 -1
- package/dist/registry/batch-install-profile.d.ts +76 -0
- package/dist/registry/batch-install-profile.d.ts.map +1 -0
- package/dist/registry/batch-install-profile.js +67 -0
- package/dist/registry/batch-install-profile.js.map +1 -0
- package/dist/registry/create-source-adapter.d.ts +16 -1
- package/dist/registry/create-source-adapter.d.ts.map +1 -1
- package/dist/registry/create-source-adapter.js +76 -3
- package/dist/registry/create-source-adapter.js.map +1 -1
- package/dist/registry/hub-manager.d.ts +41 -0
- package/dist/registry/hub-manager.d.ts.map +1 -1
- package/dist/registry/hub-manager.js +82 -4
- package/dist/registry/hub-manager.js.map +1 -1
- package/dist/registry/index.d.ts +1 -0
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +1 -0
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/install-registry-bundle.js +4 -3
- package/dist/registry/install-registry-bundle.js.map +1 -1
- package/dist/registry/list-installed-bundles.d.ts +2 -3
- package/dist/registry/list-installed-bundles.d.ts.map +1 -1
- package/dist/registry/list-installed-bundles.js.map +1 -1
- package/dist/registry/load-hub-sources.d.ts +8 -0
- package/dist/registry/load-hub-sources.d.ts.map +1 -1
- package/dist/registry/load-hub-sources.js +70 -3
- package/dist/registry/load-hub-sources.js.map +1 -1
- package/dist/registry/profile-lifecycle.d.ts +7 -2
- package/dist/registry/profile-lifecycle.d.ts.map +1 -1
- package/dist/registry/profile-lifecycle.js +82 -11
- package/dist/registry/profile-lifecycle.js.map +1 -1
- package/dist/registry/uninstall-installed-bundle.d.ts +2 -3
- package/dist/registry/uninstall-installed-bundle.d.ts.map +1 -1
- package/dist/registry/uninstall-installed-bundle.js.map +1 -1
- package/dist/registry/update-registry-bundle.d.ts +2 -2
- package/dist/registry/update-registry-bundle.js +2 -2
- package/dist/registry/update-registry-bundle.js.map +1 -1
- package/dist/registry/validate-hub-config-file.d.ts +14 -1
- package/dist/registry/validate-hub-config-file.d.ts.map +1 -1
- package/dist/registry/validate-hub-config-file.js +81 -44
- package/dist/registry/validate-hub-config-file.js.map +1 -1
- package/dist/release/plan-bundle-release.d.ts +6 -12
- package/dist/release/plan-bundle-release.d.ts.map +1 -1
- package/dist/release/plan-bundle-release.js +178 -7
- package/dist/release/plan-bundle-release.js.map +1 -1
- package/dist/replicate/replicate.d.ts +5 -2
- package/dist/replicate/replicate.d.ts.map +1 -1
- package/dist/replicate/replicate.js +121 -17
- package/dist/replicate/replicate.js.map +1 -1
- package/dist/security/index.d.ts +4 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +22 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/rating/bundle-discovery.d.ts +19 -0
- package/dist/security/rating/bundle-discovery.d.ts.map +1 -0
- package/dist/security/rating/bundle-discovery.js +244 -0
- package/dist/security/rating/bundle-discovery.js.map +1 -0
- package/dist/security/rating/index.d.ts +5 -0
- package/dist/security/rating/index.d.ts.map +1 -0
- package/dist/security/rating/index.js +21 -0
- package/dist/security/rating/index.js.map +1 -0
- package/dist/security/rating/security-rating-markdown.d.ts +17 -0
- package/dist/security/rating/security-rating-markdown.d.ts.map +1 -0
- package/dist/security/rating/security-rating-markdown.js +131 -0
- package/dist/security/rating/security-rating-markdown.js.map +1 -0
- package/dist/security/rating/security-rating-scan.d.ts +23 -0
- package/dist/security/rating/security-rating-scan.d.ts.map +1 -0
- package/dist/security/rating/security-rating-scan.js +40 -0
- package/dist/security/rating/security-rating-scan.js.map +1 -0
- package/dist/security/rating/security-rating-templates.d.ts +40 -0
- package/dist/security/rating/security-rating-templates.d.ts.map +1 -0
- package/dist/security/rating/security-rating-templates.js +83 -0
- package/dist/security/rating/security-rating-templates.js.map +1 -0
- package/dist/security/rating/security-rating.d.ts +32 -0
- package/dist/security/rating/security-rating.d.ts.map +1 -0
- package/dist/security/rating/security-rating.js +94 -0
- package/dist/security/rating/security-rating.js.map +1 -0
- package/dist/security/security-scan-use-case.d.ts +101 -0
- package/dist/security/security-scan-use-case.d.ts.map +1 -0
- package/dist/security/security-scan-use-case.js +185 -0
- package/dist/security/security-scan-use-case.js.map +1 -0
- package/dist/stores/json-lockfile-store.d.ts.map +1 -1
- package/dist/stores/json-lockfile-store.js +6 -32
- package/dist/stores/json-lockfile-store.js.map +1 -1
- package/dist/transform/transformer-registry.d.ts.map +1 -1
- package/dist/transform/transformer-registry.js +3 -0
- package/dist/transform/transformer-registry.js.map +1 -1
- package/dist/transform/transformers/windsurf-transformer.d.ts +5 -0
- package/dist/transform/transformers/windsurf-transformer.d.ts.map +1 -1
- package/dist/transform/transformers/windsurf-transformer.js.map +1 -1
- package/dist/writers/file-tree-writer.d.ts +14 -1
- package/dist/writers/file-tree-writer.d.ts.map +1 -1
- package/dist/writers/file-tree-writer.js +23 -71
- package/dist/writers/file-tree-writer.js.map +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Layout of the security rating Markdown report as templates with `{{slot}}` placeholders.
|
|
4
|
+
*
|
|
5
|
+
* `fillTemplate` escapes every value for the place it lands: `{{name}}` escapes it as a table
|
|
6
|
+
* cell (pipes and line breaks), `{{name|html}}` as HTML text, and `{{name|raw}}` inserts it as is
|
|
7
|
+
* for pieces this module already built. A slot without a value is an error, so a typo cannot
|
|
8
|
+
* silently drop part of the report. Values are inserted in a single pass and are not expanded
|
|
9
|
+
* again, so text from a finding cannot add slots of its own.
|
|
10
|
+
* @module app/security/rating/security-rating-templates
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.TEMPLATES = exports.fillTemplate = void 0;
|
|
14
|
+
const SLOT = /\{\{\s*([A-Za-z][A-Za-z0-9]*)(?:\|(raw|cell|html))?\s*\}\}/g;
|
|
15
|
+
const FILTERS = {
|
|
16
|
+
raw: (value) => value,
|
|
17
|
+
cell: (value) => value.replaceAll('|', String.raw `\|`).replaceAll(/\r?\n/g, ' ').trim(),
|
|
18
|
+
html: (value) => value.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>')
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Fill the slots of a template.
|
|
22
|
+
* @param template - Text with `{{name}}`, `{{name|html}}` or `{{name|raw}}` slots
|
|
23
|
+
* @param values - Value of every slot used
|
|
24
|
+
*/
|
|
25
|
+
const fillTemplate = (template, values) => template.replaceAll(SLOT, (_match, name, filter) => {
|
|
26
|
+
if (!Object.hasOwn(values, name)) {
|
|
27
|
+
throw new Error(`Template slot "${name}" has no value`);
|
|
28
|
+
}
|
|
29
|
+
return FILTERS[filter ?? 'cell'](values[name]);
|
|
30
|
+
});
|
|
31
|
+
exports.fillTemplate = fillTemplate;
|
|
32
|
+
exports.TEMPLATES = {
|
|
33
|
+
title: '## {{icon|raw}} Security scan: {{verdict|raw}}',
|
|
34
|
+
// The report when the source has bundles, and when it is rated as one repository.
|
|
35
|
+
bundlesReport: [
|
|
36
|
+
'{{title|raw}}',
|
|
37
|
+
'',
|
|
38
|
+
'**Source score {{score|raw}}/100 · {{risk|raw}}** (average of {{count|raw}} bundle{{plural|raw}}) {{scoreCell|raw}}',
|
|
39
|
+
'',
|
|
40
|
+
'{{riskCounts|raw}}',
|
|
41
|
+
'',
|
|
42
|
+
'> {{gate|raw}}',
|
|
43
|
+
'',
|
|
44
|
+
'{{sections|raw}}',
|
|
45
|
+
'{{scoring|raw}}',
|
|
46
|
+
''
|
|
47
|
+
].join('\n'),
|
|
48
|
+
repositoryReport: [
|
|
49
|
+
'{{title|raw}}',
|
|
50
|
+
'',
|
|
51
|
+
'**Whole repository {{score|raw}}/100 · {{risk|raw}}** {{scoreCell|raw}}',
|
|
52
|
+
'',
|
|
53
|
+
'> {{warn|raw}} No collections or skills were found, so the whole repository was scanned as one unit. Vendored code and changelogs can lower this score.',
|
|
54
|
+
'',
|
|
55
|
+
'> {{gate|raw}}',
|
|
56
|
+
'',
|
|
57
|
+
'{{findings|raw}}{{scoring|raw}}',
|
|
58
|
+
''
|
|
59
|
+
].join('\n'),
|
|
60
|
+
// Gate sentences.
|
|
61
|
+
gateOff: 'Gate: off (report only).',
|
|
62
|
+
gate: 'Gate `{{failOn|raw}}`: a bundle fails below a score of {{limit|raw}}. {{verdict|raw}}',
|
|
63
|
+
gateFailing: '**{{failing|raw}} of {{total|raw}} bundle(s) are below the limit.**',
|
|
64
|
+
gatePassing: 'All {{total|raw}} bundle(s) pass.',
|
|
65
|
+
// Findings and bundle tables.
|
|
66
|
+
findingsHeader: '| Cost | Rule | Where | How to fix |\n|---:|---|---|---|',
|
|
67
|
+
findingRow: '| -{{points|raw}} | `{{ruleId}}` {{title}} | `{{where}}` | {{fix}} |',
|
|
68
|
+
findingsMore: '| | _{{count|raw}} more in the JSON report_ | | |',
|
|
69
|
+
bundlesHeader: '| | Bundle | Score | Risk | Findings | Costliest finding |\n|:-:|---|---|---|---|---|',
|
|
70
|
+
bundleRow: '| {{status|raw}} | `{{id}}` {{version}} | {{score|raw}} | {{risk|raw}} | {{counts|raw}} | {{top}} |',
|
|
71
|
+
// Collapsible blocks.
|
|
72
|
+
details: '<details><summary>{{summary|raw}}</summary>\n\n{{body|raw}}\n\n</details>\n',
|
|
73
|
+
bundleSummary: '<b><code>{{id|html}}</code></b> {{score|raw}}/100 {{risk|raw}}',
|
|
74
|
+
attentionHeading: '#### Needs attention ({{failing|raw}} below the gate limit)',
|
|
75
|
+
lowestHeading: '#### Lowest scoring bundles',
|
|
76
|
+
moreBelowLimit: '_{{count|raw}} more below the limit are in the full table._',
|
|
77
|
+
allBundles: 'All {{count|raw}} bundles',
|
|
78
|
+
costliestFindings: 'Costliest findings',
|
|
79
|
+
scoreCell: '`{{bar|raw}}` **{{score|raw}}**',
|
|
80
|
+
scoring: '<sub>Score = 100 × exp(−penalty / {{scale|raw}}); each finding costs points by severity, confidence, location and repetition. '
|
|
81
|
+
+ 'Risk: 🟢 low ≥ {{low|raw}}, 🟡 medium ≥ {{medium|raw}}, 🟠 high ≥ {{high|raw}}, 🔴 critical below. Scores are advisory.</sub>'
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=security-rating-templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-rating-templates.js","sourceRoot":"","sources":["../../../src/security/rating/security-rating-templates.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,MAAM,IAAI,GAAG,6DAA6D,CAAC;AAE3E,MAAM,OAAO,GAAyE;IACpF,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACrB,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAA,IAAI,CAAC,CAAC,UAAU,CAAC,QAAQ,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IAClF,WAAW,EAAE,mCAAmC;IAEhD,8BAA8B;IAC9B,cAAc,EAAE,0DAA0D;IAC1E,UAAU,EAAE,sEAAsE;IAClF,YAAY,EAAE,mDAAmD;IACjE,aAAa,EAAE,uFAAuF;IACtG,SAAS,EAAE,qGAAqG;IAEhH,sBAAsB;IACtB,OAAO,EAAE,6EAA6E;IACtF,aAAa,EAAE,8EAA8E;IAC7F,gBAAgB,EAAE,6DAA6D;IAC/E,aAAa,EAAE,6BAA6B;IAC5C,cAAc,EAAE,6DAA6D;IAC7E,UAAU,EAAE,2BAA2B;IACvC,iBAAiB,EAAE,oBAAoB;IAEvC,SAAS,EAAE,iCAAiC;IAC5C,OAAO,EAAE,gIAAgI;UACrI,+HAA+H;CAC3H,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SecurityRatingFailOn, SecurityRatingFinding, SecurityRatingReport } from '@ai-primitives-hub/core';
|
|
2
|
+
export interface SecurityRatingRequest {
|
|
3
|
+
/** Checkout to rate. */
|
|
4
|
+
root: string;
|
|
5
|
+
/** `owner/repo`, recorded in the report and used for skill bundle ids. */
|
|
6
|
+
repository: string;
|
|
7
|
+
tag?: string;
|
|
8
|
+
commit?: string;
|
|
9
|
+
failOn: SecurityRatingFailOn;
|
|
10
|
+
collectionsPath?: string;
|
|
11
|
+
skillsPath?: string;
|
|
12
|
+
/** Name of the tool that produced the findings, recorded in the report. */
|
|
13
|
+
scannerName: string;
|
|
14
|
+
}
|
|
15
|
+
export interface SecurityRatingResult {
|
|
16
|
+
report: SecurityRatingReport;
|
|
17
|
+
/** Collection items that were missing or outside the repository. */
|
|
18
|
+
warnings: readonly string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Rate the bundles of a checkout from scan findings.
|
|
22
|
+
* @param options - The rating request, the findings and the report timestamp (ISO-8601 UTC)
|
|
23
|
+
* @param options.request
|
|
24
|
+
* @param options.findings
|
|
25
|
+
* @param options.generatedAt
|
|
26
|
+
*/
|
|
27
|
+
export declare const runSecurityRating: (options: {
|
|
28
|
+
request: SecurityRatingRequest;
|
|
29
|
+
findings: readonly SecurityRatingFinding[];
|
|
30
|
+
generatedAt: string;
|
|
31
|
+
}) => SecurityRatingResult;
|
|
32
|
+
//# sourceMappingURL=security-rating.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-rating.d.ts","sourceRoot":"","sources":["../../../src/security/rating/security-rating.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAQjC,MAAM,WAAW,qBAAqB;IACpC,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,oBAAoB,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,oEAAoE;IACpE,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAsBD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS;IACzC,OAAO,EAAE,qBAAqB,CAAC;IAC/B,QAAQ,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC3C,WAAW,EAAE,MAAM,CAAC;CACrB,KAAG,oBAqBH,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.runSecurityRating = void 0;
|
|
37
|
+
/**
|
|
38
|
+
* Security rating: score each bundle (collection or skill) of a source checkout from the findings
|
|
39
|
+
* of a scan, and the source as the average of its bundles.
|
|
40
|
+
*
|
|
41
|
+
* The rating does not scan anything itself, so it works with the findings of any scanner.
|
|
42
|
+
* @module app/security/rating/security-rating
|
|
43
|
+
*/
|
|
44
|
+
const path = __importStar(require("node:path"));
|
|
45
|
+
const core_1 = require("@ai-primitives-hub/core");
|
|
46
|
+
const bundle_discovery_1 = require("./bundle-discovery");
|
|
47
|
+
const isOutside = (relative) => relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative);
|
|
48
|
+
const relativeToRoot = (root, file) => {
|
|
49
|
+
if (!path.isAbsolute(file)) {
|
|
50
|
+
return file;
|
|
51
|
+
}
|
|
52
|
+
const relative = path.relative(path.resolve(root), file);
|
|
53
|
+
return isOutside(relative) ? file : relative;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* True when a finding path resolves outside the checkout.
|
|
57
|
+
* @param root
|
|
58
|
+
* @param file
|
|
59
|
+
*/
|
|
60
|
+
const isOutsideRoot = (root, file) => {
|
|
61
|
+
const base = path.resolve(root);
|
|
62
|
+
return isOutside(path.relative(base, path.resolve(base, file)));
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Rate the bundles of a checkout from scan findings.
|
|
66
|
+
* @param options - The rating request, the findings and the report timestamp (ISO-8601 UTC)
|
|
67
|
+
* @param options.request
|
|
68
|
+
* @param options.findings
|
|
69
|
+
* @param options.generatedAt
|
|
70
|
+
*/
|
|
71
|
+
const runSecurityRating = (options) => {
|
|
72
|
+
const { request } = options;
|
|
73
|
+
const discovered = (0, bundle_discovery_1.discoverBundles)(request.root, {
|
|
74
|
+
repository: request.repository,
|
|
75
|
+
collectionsPath: request.collectionsPath,
|
|
76
|
+
skillsPath: request.skillsPath
|
|
77
|
+
});
|
|
78
|
+
const findings = options.findings
|
|
79
|
+
.filter((item) => !isOutsideRoot(request.root, item.file))
|
|
80
|
+
.map((item) => ({ ...item, file: relativeToRoot(request.root, item.file) }));
|
|
81
|
+
const report = (0, core_1.buildSecurityRatingReport)({
|
|
82
|
+
findings,
|
|
83
|
+
bundles: discovered.bundles,
|
|
84
|
+
mode: discovered.mode,
|
|
85
|
+
failOn: request.failOn,
|
|
86
|
+
generatedAt: options.generatedAt,
|
|
87
|
+
// The report schema records only the scanner name.
|
|
88
|
+
scanner: { name: request.scannerName },
|
|
89
|
+
source: { repository: request.repository, tag: request.tag ?? '', commit: request.commit ?? '' }
|
|
90
|
+
});
|
|
91
|
+
return { report, warnings: discovered.warnings };
|
|
92
|
+
};
|
|
93
|
+
exports.runSecurityRating = runSecurityRating;
|
|
94
|
+
//# sourceMappingURL=security-rating.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-rating.js","sourceRoot":"","sources":["../../../src/security/rating/security-rating.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,gDAAkC;AAMlC,kDAEiC;AACjC,yDAE4B;AAsB5B,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAW,EAAE,CAAC,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AAExI,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,IAAY,EAAU,EAAE;IAC5D,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC/C,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,IAAY,EAAW,EAAE;IAC5D,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EA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EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC;AACnD,CAAC,CAAC;AAzBW,QAAA,iBAAiB,qBAyB5B"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { Clock, FailurePolicy, SecurityCancellation, SecurityFinding, SecurityResourceLimits, SecurityScanEngine, SecurityScanInput } from '@ai-primitives-hub/core';
|
|
2
|
+
import { SECURITY_SEVERITIES } from '@ai-primitives-hub/core';
|
|
3
|
+
export interface SecurityScanRequest {
|
|
4
|
+
roots: readonly string[];
|
|
5
|
+
extensions: readonly string[];
|
|
6
|
+
recursive: boolean;
|
|
7
|
+
excludes: readonly string[];
|
|
8
|
+
includeDocFiles: boolean;
|
|
9
|
+
ignoreTrust: 'repository' | 'none' | 'baseline';
|
|
10
|
+
baselineSuppressionPath?: string;
|
|
11
|
+
baselineFileIgnorePath?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SecurityScanOptions {
|
|
14
|
+
includeLlmControls: boolean;
|
|
15
|
+
skipInfoControls: boolean;
|
|
16
|
+
selectedSeverities?: readonly (typeof SECURITY_SEVERITIES[number])[];
|
|
17
|
+
}
|
|
18
|
+
export interface SecurityScanCoverage {
|
|
19
|
+
scanned: readonly {
|
|
20
|
+
path: string;
|
|
21
|
+
rootId: string;
|
|
22
|
+
bytes: number;
|
|
23
|
+
}[];
|
|
24
|
+
ignored: readonly {
|
|
25
|
+
path: string;
|
|
26
|
+
reason: string;
|
|
27
|
+
source?: string;
|
|
28
|
+
}[];
|
|
29
|
+
skipped: readonly {
|
|
30
|
+
path: string;
|
|
31
|
+
reason: string;
|
|
32
|
+
}[];
|
|
33
|
+
errors: readonly {
|
|
34
|
+
path?: string;
|
|
35
|
+
code: string;
|
|
36
|
+
message: string;
|
|
37
|
+
}[];
|
|
38
|
+
}
|
|
39
|
+
export interface SecuritySuppressedSummary {
|
|
40
|
+
ruleId: string;
|
|
41
|
+
severity: SecurityFinding['severity'];
|
|
42
|
+
fingerprint: string;
|
|
43
|
+
kind: 'instance' | 'canonical';
|
|
44
|
+
sourcePath: string;
|
|
45
|
+
}
|
|
46
|
+
export interface SecurityScanResult {
|
|
47
|
+
schemaVersion: 1;
|
|
48
|
+
scanId: string;
|
|
49
|
+
complete: boolean;
|
|
50
|
+
engine: SecurityScanEngine['descriptor'];
|
|
51
|
+
compatibility: string;
|
|
52
|
+
options: SecurityScanOptions & {
|
|
53
|
+
failOn: FailurePolicy;
|
|
54
|
+
ignoreTrust: SecurityScanRequest['ignoreTrust'];
|
|
55
|
+
};
|
|
56
|
+
coverage: SecurityScanCoverage;
|
|
57
|
+
summary: {
|
|
58
|
+
active: {
|
|
59
|
+
total: number;
|
|
60
|
+
bySeverity: Record<string, number>;
|
|
61
|
+
};
|
|
62
|
+
suppressed: {
|
|
63
|
+
total: number;
|
|
64
|
+
bySeverity: Record<string, number>;
|
|
65
|
+
};
|
|
66
|
+
policy: {
|
|
67
|
+
failOn: FailurePolicy;
|
|
68
|
+
passed: boolean;
|
|
69
|
+
blocking: string[];
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
findings: readonly SecurityFinding[];
|
|
73
|
+
suppressed: readonly SecuritySuppressedSummary[];
|
|
74
|
+
warnings: readonly string[];
|
|
75
|
+
errors: readonly {
|
|
76
|
+
code: string;
|
|
77
|
+
message: string;
|
|
78
|
+
path?: string;
|
|
79
|
+
}[];
|
|
80
|
+
timing: {
|
|
81
|
+
startedAt: string;
|
|
82
|
+
completedAt: string;
|
|
83
|
+
durationMs: number;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export interface SecurityScanDependencies {
|
|
87
|
+
input: SecurityScanInput;
|
|
88
|
+
engine: SecurityScanEngine;
|
|
89
|
+
clock: Clock;
|
|
90
|
+
cancellation: SecurityCancellation;
|
|
91
|
+
}
|
|
92
|
+
declare const DEFAULT_LIMITS: SecurityResourceLimits;
|
|
93
|
+
export declare const runSecurityScan: (options: SecurityScanDependencies & {
|
|
94
|
+
request: SecurityScanRequest;
|
|
95
|
+
scanOptions?: SecurityScanOptions;
|
|
96
|
+
limits?: SecurityResourceLimits;
|
|
97
|
+
failOn?: FailurePolicy;
|
|
98
|
+
compatibility?: string;
|
|
99
|
+
}) => Promise<SecurityScanResult>;
|
|
100
|
+
export { DEFAULT_LIMITS as SECURITY_SCAN_DEFAULT_LIMITS };
|
|
101
|
+
//# sourceMappingURL=security-scan-use-case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-scan-use-case.d.ts","sourceRoot":"","sources":["../../src/security/security-scan-use-case.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,aAAa,EACb,oBAAoB,EACpB,eAAe,EAGf,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,mBAAmB,EAEpB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,YAAY,GAAG,MAAM,GAAG,UAAU,CAAC;IAChD,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,SAAS,CAAC,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;CACtE;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CA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4
|
+
const core_1 = require("@ai-primitives-hub/core");
|
|
5
|
+
const DEFAULT_LIMITS = {
|
|
6
|
+
maxFiles: 10_000,
|
|
7
|
+
maxFileBytes: 1_048_576,
|
|
8
|
+
maxTotalBytes: 104_857_600,
|
|
9
|
+
maxDepth: 64,
|
|
10
|
+
maxFindings: 5000,
|
|
11
|
+
maxIgnoreBytes: 65_536,
|
|
12
|
+
maxIgnoreLines: 1024,
|
|
13
|
+
maxReportBytes: 10_485_760,
|
|
14
|
+
timeoutMs: 60_000,
|
|
15
|
+
documentTimeoutMs: 2000
|
|
16
|
+
};
|
|
17
|
+
exports.SECURITY_SCAN_DEFAULT_LIMITS = DEFAULT_LIMITS;
|
|
18
|
+
const bySeverity = (findings) => {
|
|
19
|
+
const counts = Object.fromEntries(core_1.SECURITY_SEVERITIES.map((severity) => [severity, 0]));
|
|
20
|
+
for (const finding of findings) {
|
|
21
|
+
counts[finding.severity] = (counts[finding.severity] ?? 0) + 1;
|
|
22
|
+
}
|
|
23
|
+
return counts;
|
|
24
|
+
};
|
|
25
|
+
const sortFindings = (findings) => findings.toSorted((a, b) => a.file.localeCompare(b.file)
|
|
26
|
+
|| (a.line ?? 0) - (b.line ?? 0)
|
|
27
|
+
|| a.ruleId.localeCompare(b.ruleId)
|
|
28
|
+
|| (a.variantId ?? '').localeCompare(b.variantId ?? '')
|
|
29
|
+
|| a.canonicalFingerprint.localeCompare(b.canonicalFingerprint));
|
|
30
|
+
const toInputRequest = (request) => request;
|
|
31
|
+
const runSecurityScan = async (options) => {
|
|
32
|
+
try {
|
|
33
|
+
const startedAt = options.clock.now();
|
|
34
|
+
const scanOptions = options.scanOptions ?? { includeLlmControls: false, skipInfoControls: false };
|
|
35
|
+
const failOn = options.failOn ?? 'HIGH';
|
|
36
|
+
const limits = options.limits ?? DEFAULT_LIMITS;
|
|
37
|
+
options.cancellation.throwIfCancelled();
|
|
38
|
+
let timedOut = false;
|
|
39
|
+
const cancellation = {
|
|
40
|
+
get cancelled() {
|
|
41
|
+
return timedOut || options.cancellation.cancelled;
|
|
42
|
+
},
|
|
43
|
+
throwIfCancelled: () => {
|
|
44
|
+
options.cancellation.throwIfCancelled();
|
|
45
|
+
if (timedOut) {
|
|
46
|
+
throw new Error('SECURITY.LIMIT_EXCEEDED: whole-scan deadline exceeded');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const withinDeadline = async (operation) => {
|
|
51
|
+
const remaining = limits.timeoutMs - (options.clock.now() - startedAt);
|
|
52
|
+
if (remaining <= 0) {
|
|
53
|
+
timedOut = true;
|
|
54
|
+
cancellation.throwIfCancelled();
|
|
55
|
+
}
|
|
56
|
+
let timer;
|
|
57
|
+
try {
|
|
58
|
+
return await Promise.race([
|
|
59
|
+
operation(),
|
|
60
|
+
new Promise((_resolve, reject) => {
|
|
61
|
+
timer = setTimeout(() => {
|
|
62
|
+
timedOut = true;
|
|
63
|
+
reject(new Error('SECURITY.LIMIT_EXCEEDED: whole-scan deadline exceeded'));
|
|
64
|
+
}, remaining);
|
|
65
|
+
})
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
clearTimeout(timer);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const operationalError = (error, fallbackCode) => {
|
|
73
|
+
options.cancellation.throwIfCancelled();
|
|
74
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
75
|
+
return {
|
|
76
|
+
code: message.startsWith('SECURITY.LIMIT_EXCEEDED:') ? 'SECURITY.LIMIT_EXCEEDED' : fallbackCode,
|
|
77
|
+
message
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
let collection;
|
|
81
|
+
try {
|
|
82
|
+
collection = await withinDeadline(() => options.input.collect(toInputRequest(options.request), limits, cancellation));
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
collection = {
|
|
86
|
+
candidates: [], ignoredFiles: [], skippedFiles: [], suppressions: [], warnings: [],
|
|
87
|
+
errors: [operationalError(error, 'SECURITY.INPUT_UNREADABLE')]
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const scanned = [];
|
|
91
|
+
const coverageErrors = [...collection.errors];
|
|
92
|
+
const allFindings = [];
|
|
93
|
+
let totalBytes = 0;
|
|
94
|
+
for (const candidate of collection.candidates) {
|
|
95
|
+
options.cancellation.throwIfCancelled();
|
|
96
|
+
let read;
|
|
97
|
+
try {
|
|
98
|
+
read = await withinDeadline(() => options.input.read(candidate, limits, cancellation));
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
coverageErrors.push({ path: candidate.displayPath, ...operationalError(error, 'SECURITY.INPUT_UNREADABLE') });
|
|
102
|
+
if (timedOut) {
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (read.error !== undefined || read.document === undefined) {
|
|
108
|
+
coverageErrors.push({ path: candidate.displayPath, code: read.error?.code ?? 'SECURITY.INPUT_UNREADABLE', message: read.error?.message ?? 'Input could not be read.' });
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
totalBytes += read.document.metadata.bytes;
|
|
112
|
+
if (totalBytes > limits.maxTotalBytes) {
|
|
113
|
+
coverageErrors.push({ path: candidate.displayPath, code: 'SECURITY.LIMIT_EXCEEDED', message: 'Maximum total input bytes exceeded.' });
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
const remainingFindings = limits.maxFindings - allFindings.length;
|
|
117
|
+
let findings;
|
|
118
|
+
try {
|
|
119
|
+
const document = read.document;
|
|
120
|
+
findings = await withinDeadline(() => options.engine.scanDocument(document, {
|
|
121
|
+
includeLlmControls: scanOptions.includeLlmControls,
|
|
122
|
+
skipInfoControls: scanOptions.skipInfoControls,
|
|
123
|
+
maxFindings: remainingFindings + 1
|
|
124
|
+
}, cancellation));
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
coverageErrors.push({ path: candidate.displayPath, ...operationalError(error, 'SECURITY.ENGINE_FAILED') });
|
|
128
|
+
if (timedOut) {
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
scanned.push({ path: candidate.displayPath, rootId: candidate.rootId, bytes: read.document.metadata.bytes });
|
|
134
|
+
const documentRootId = read.document.rootId;
|
|
135
|
+
allFindings.push(...findings.slice(0, remainingFindings).map((finding) => ({ ...finding, rootId: documentRootId })));
|
|
136
|
+
if (findings.length > remainingFindings) {
|
|
137
|
+
coverageErrors.push({ code: 'SECURITY.LIMIT_EXCEEDED', message: 'Maximum finding count exceeded.' });
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const suppressed = [];
|
|
142
|
+
const active = [];
|
|
143
|
+
const rootIds = new Set(scanned.map((file) => file.rootId));
|
|
144
|
+
for (const rootId of rootIds) {
|
|
145
|
+
const rootFindings = allFindings.filter((finding) => finding.rootId === rootId || (finding.rootId === undefined && scanned.some((file) => file.rootId === rootId && file.path === finding.file)));
|
|
146
|
+
const result = (0, core_1.applySuppressions)(rootFindings, collection.suppressions, rootId);
|
|
147
|
+
active.push(...result.active);
|
|
148
|
+
suppressed.push(...result.suppressed);
|
|
149
|
+
}
|
|
150
|
+
const sortedActive = sortFindings((0, core_1.selectSeverities)(active, scanOptions.selectedSeverities));
|
|
151
|
+
const policy = (0, core_1.evaluateFailurePolicy)(active, failOn);
|
|
152
|
+
const completedAt = options.clock.now();
|
|
153
|
+
const errors = coverageErrors.map((error) => ({ path: error.path, code: error.code, message: error.message }));
|
|
154
|
+
return {
|
|
155
|
+
schemaVersion: 1,
|
|
156
|
+
scanId: `${startedAt}-${options.engine.descriptor.rulePackDigest.slice(-12)}`,
|
|
157
|
+
complete: errors.length === 0,
|
|
158
|
+
engine: options.engine.descriptor,
|
|
159
|
+
compatibility: options.compatibility ?? 'md-security-scanner@1.10.9',
|
|
160
|
+
options: { ...scanOptions, failOn, ignoreTrust: options.request.ignoreTrust },
|
|
161
|
+
coverage: { scanned, ignored: collection.ignoredFiles, skipped: collection.skippedFiles, errors },
|
|
162
|
+
summary: {
|
|
163
|
+
active: { total: sortedActive.length, bySeverity: bySeverity(sortedActive) },
|
|
164
|
+
suppressed: { total: suppressed.length, bySeverity: bySeverity(suppressed.map((item) => item.finding)) },
|
|
165
|
+
policy: { failOn, passed: policy.passed && errors.length === 0, blocking: policy.blocking }
|
|
166
|
+
},
|
|
167
|
+
findings: sortedActive,
|
|
168
|
+
suppressed: suppressed.map((item) => ({
|
|
169
|
+
ruleId: item.finding.ruleId,
|
|
170
|
+
severity: item.finding.severity,
|
|
171
|
+
fingerprint: item.kind === 'instance' ? item.finding.fingerprint : item.finding.canonicalFingerprint,
|
|
172
|
+
kind: item.kind,
|
|
173
|
+
sourcePath: item.declaration.sourcePath
|
|
174
|
+
})),
|
|
175
|
+
warnings: collection.warnings.map((warning) => `${warning.sourcePath}:${warning.line}: ${warning.message}`),
|
|
176
|
+
errors,
|
|
177
|
+
timing: { startedAt: new Date(startedAt).toISOString(), completedAt: new Date(completedAt).toISOString(), durationMs: completedAt - startedAt }
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
await options.engine.dispose?.();
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
exports.runSecurityScan = runSecurityScan;
|
|
185
|
+
//# sourceMappingURL=security-scan-use-case.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-scan-use-case.js","sourceRoot":"","sources":["../../src/security/security-scan-use-case.ts"],"names":[],"mappings":";;;AAYA,kDAKiC;AA6DjC,MAAM,cAAc,GAA2B;IAC7C,QAAQ,EAAE,MAAM;IAChB,YAAY,EAAE,SAAS;IACvB,aAAa,EAAE,WAAW;IAC1B,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,IAAI;IACjB,cAAc,EAAE,MAAM;IACtB,cAAc,EAAE,IAAI;IACpB,cAAc,EAAE,UAA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;gBACpC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;gBAC3B,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ;gBAC/B,WAAW,EAAE,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB;gBACpG,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,UAAU;aACxC,CAAC,CAAC;YACH,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC;YAC3G,MAAM;YACN,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,EAAE,WAAW,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,WAAW,GAAG,SAAS,EAAE;SAChJ,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;IACnC,CAAC;AACH,CAAC,CAAC;AA9JW,QAAA,eAAe,mBA8J1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-lockfile-store.d.ts","sourceRoot":"","sources":["../../src/stores/json-lockfile-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-lockfile-store.d.ts","sourceRoot":"","sources":["../../src/stores/json-lockfile-store.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC,sEAAsE;AACtE,eAAO,MAAM,aAAa,8BAA8B,CAAC;AACzD,oEAAoE;AACpE,eAAO,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AM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAChD,iBAAiB,EAkBnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,MAAM,EAChB,IAAI,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC9B,eAAe,MAAM,KACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAmBvB,CAAC"}
|
|
@@ -35,38 +35,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.findLockfile = exports.checksumFiles = exports.cleanupOrphanedSource = exports.remapSourceId = exports.upsertSource = exports.removeBundleEntry = exports.upsertBundleEntry = exports.deleteLockfile = exports.writeLockfile = exports.readLockfile = exports.getLockfilePathForMode = exports.emptyLockfile = exports.LOCKFILE_SCHEMA_VERSION = exports.LOCAL_LOCKFILE_NAME = exports.LOCKFILE_NAME = void 0;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* `target`-keyed). The two are structurally incompatible:
|
|
45
|
-
*
|
|
46
|
-
* - Extension (this module): `version: '2.0.0'` (string), `bundles:
|
|
47
|
-
* Record<bundleId, LockfileBundleEntry>` (object), `files:
|
|
48
|
-
* LockfileFileEntry[]` (`{path, checksum}`), TWO separate physical
|
|
49
|
-
* files (`prompt-registry.lock.json` for `commit` mode,
|
|
50
|
-
* `prompt-registry.local.lock.json` for `local-only` mode —
|
|
51
|
-
* commitMode is implicit by which file an entry lives in).
|
|
52
|
-
* - Reference branch's original: `schemaVersion: 1` (number),
|
|
53
|
-
* `entries: LockfileEntry[]` (array keyed by target+sourceId+
|
|
54
|
-
* bundleId, to support multi-target lockfiles), `files: string[]`
|
|
55
|
-
* + parallel `fileChecksums`, ONE file with an explicit per-entry
|
|
56
|
-
* `commitMode` field.
|
|
57
|
-
*
|
|
58
|
-
* This module mirrors the extension's actual on-disk shape so a CLI
|
|
59
|
-
* install and an extension install of the same bundle produce
|
|
60
|
-
* byte-compatible lockfile entries. Scope: repository only — the
|
|
61
|
-
* lockfile has never tracked user/workspace-scope installs (no
|
|
62
|
-
* reproducibility/team-sharing use case there), so this store — and
|
|
63
|
-
* the uninstall pipeline that uses it — only applies to
|
|
64
|
-
* `target.scope === 'repository'`. No `target` field exists on
|
|
65
|
-
* `LockfileBundleEntry` for the same reason the extension has none:
|
|
66
|
-
* repository scope always writes to `.github/`, invariant of which
|
|
67
|
-
* IDE type nominally triggered the install (see
|
|
68
|
-
* `writers/repo-scope-writer.ts`'s `RepositoryScopeWriterAdapter`,
|
|
69
|
-
* which ignores its `Target` parameter entirely).
|
|
38
|
+
* Older 2.0.0 lockfile store: `prompt-registry.lock.json`,
|
|
39
|
+
* `prompt-registry.local.lock.json` and the CLI's old user lockfile, keyed by
|
|
40
|
+
* bundle only (no tool field). The current format is the 3.0.0 install record
|
|
41
|
+
* (`records/`). Still used for migration, the CLI's workspace scope and
|
|
42
|
+
* `profile activate`, an old-format `--lockfile`, and bundles only an older
|
|
43
|
+
* file lists.
|
|
70
44
|
* @module stores/json-lockfile-store
|
|
71
45
|
*/
|
|
72
46
|
const node_crypto_1 = require("node:crypto");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-lockfile-store.js","sourceRoot":"","sources":["../../src/stores/json-lockfile-store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"json-lockfile-store.js","sourceRoot":"","sources":["../../src/stores/json-lockfile-store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;GAQG;AACH,6CAEqB;AACrB,gDAAkC;AAKlC,sEAAsE;AACzD,QAAA,aAAa,GAAG,2BAA2B,CAAC;AACzD,oEAAoE;AACvD,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KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAC1D,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;SAC1D,CAAC,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAtBW,QAAA,aAAa,iBAsBxB;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACI,MAAM,YAAY,GAAG,KAAK,EAC/B,QAAgB,EAChB,EAA8B,EAC9B,YAAqB,EACG,EAAE;IAC1B,IAAI,GAAG,GAAG,QAAQ,CAAC;IACnB,OAAO,IAAI,EAAE,CAAC;QACZ,KAAK,MAAM,IAAI,IAAI,CAAC,qBAAa,EAAE,2BAAmB,CAAC,EAAE,CAAC;YACxD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YACvC,IAAI,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC/B,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,MAAM;QACR,CAAC;QACD,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,IAAI,YAAY,KAAK,SAAS,IAAI,MAAM,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;QAChE,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAvBW,QAAA,YAAY,gBAuBvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformer-registry.d.ts","sourceRoot":"","sources":["../../src/transform/transformer-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACX,MAAM,yBAAyB,CAAC;AAcjC;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAuC;IAEpE;;;OAGG;gBACgB,YAAY,GAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAM;IAItF;;;;;OAKG;IACI,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,mBAAmB;IAIlE;;;;OAIG;IACI,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,mBAAmB,GAAG,IAAI;IAI/E;;;;;OAKG;WACW,YAAY,IAAI,mBAAmB;
|
|
1
|
+
{"version":3,"file":"transformer-registry.d.ts","sourceRoot":"","sources":["../../src/transform/transformer-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACX,MAAM,yBAAyB,CAAC;AAcjC;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAuC;IAEpE;;;OAGG;gBACgB,YAAY,GAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAM;IAItF;;;;;OAKG;IACI,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,mBAAmB;IAIlE;;;;OAIG;IACI,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,mBAAmB,GAAG,IAAI;IAI/E;;;;;OAKG;WACW,YAAY,IAAI,mBAAmB;CAUlD"}
|