@dailephd/my-dev-kit-lab 0.3.4 → 0.4.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 +46 -270
- package/dist/scripts/security/validate.js +177 -70
- package/dist/src/audits/codeRot/detectors/architectureDriftDetector.js +5 -2
- package/dist/src/audits/codeRot/detectors/securityValidationAssumptionRotDetector.js +5 -2
- package/dist/src/mobile/android/audit/androidFinding.js +68 -0
- package/dist/src/mobile/android/audit/checkResultBuilder.js +97 -0
- package/dist/src/mobile/android/audit/deepLinkAudit.js +183 -0
- package/dist/src/mobile/android/audit/exportedComponentAudit.js +183 -0
- package/dist/src/mobile/android/audit/intentFilterAudit.js +128 -0
- package/dist/src/mobile/android/audit/permissionAudit.js +142 -0
- package/dist/src/mobile/android/detect/androidTargetDetection.js +18 -0
- package/dist/src/mobile/android/detect/buildFileEvidence.js +36 -0
- package/dist/src/mobile/android/detect/classify.js +150 -0
- package/dist/src/mobile/android/detect/detectAndroidProject.js +252 -0
- package/dist/src/mobile/android/detect/settingsModules.js +60 -0
- package/dist/src/mobile/android/detect/sourceEvidence.js +92 -0
- package/dist/src/mobile/android/detect/traversal.js +79 -0
- package/dist/src/mobile/android/detect/versionCatalogEvidence.js +37 -0
- package/dist/src/mobile/android/detection.js +28 -0
- package/dist/src/mobile/android/gradle/gradleMetadataCheckResult.js +120 -0
- package/dist/src/mobile/android/gradle/moduleMetadataExtractor.js +137 -0
- package/dist/src/mobile/android/gradle/pluginVersionExtractor.js +40 -0
- package/dist/src/mobile/android/gradle/readAndroidGradleMetadata.js +210 -0
- package/dist/src/mobile/android/gradle/releaseMetadataSummary.js +64 -0
- package/dist/src/mobile/android/gradle/settingsMetadata.js +20 -0
- package/dist/src/mobile/android/gradle/types.js +1 -0
- package/dist/src/mobile/android/gradle/validate/executor.js +9 -0
- package/dist/src/mobile/android/gradle/validate/operationCheckResult.js +99 -0
- package/dist/src/mobile/android/gradle/validate/operations.js +68 -0
- package/dist/src/mobile/android/gradle/validate/planner.js +49 -0
- package/dist/src/mobile/android/gradle/validate/runOptionalGradleValidation.js +113 -0
- package/dist/src/mobile/android/gradle/validate/targetMutation.js +45 -0
- package/dist/src/mobile/android/gradle/validate/taskListParser.js +24 -0
- package/dist/src/mobile/android/gradle/versionCatalogMetadata.js +94 -0
- package/dist/src/mobile/android/gradle/wrapperMetadata.js +32 -0
- package/dist/src/mobile/android/manifest/parseAndroidManifest.js +341 -0
- package/dist/src/mobile/android/manifest/types.js +29 -0
- package/dist/src/mobile/android/manifest/xml/parseXml.js +313 -0
- package/dist/src/mobile/android/profile.js +29 -0
- package/dist/src/mobile/android/report/model.js +104 -0
- package/dist/src/mobile/android/report/renderAndroidReport.js +223 -0
- package/dist/src/mobile/android/report/writeAndroidReportFiles.js +23 -0
- package/dist/src/mobile/android/targetMetadata.js +27 -0
- package/dist/src/mobile/android/validate/androidVerdict.js +248 -0
- package/dist/src/mobile/android/validate/detectionAndImmutabilityCheckResults.js +177 -0
- package/dist/src/mobile/android/validate/playReadinessChecklist.js +145 -0
- package/dist/src/mobile/android/validate/validateAndroidTarget.js +172 -0
- package/dist/src/mobile/android/validation/checkResult.js +51 -0
- package/dist/src/mobile/android/validation/result.js +25 -0
- package/dist/src/mobile/index.js +42 -0
- package/dist/src/mobile/types.js +27 -0
- package/dist/src/securityValidation/attackScenarios/attackProfile.js +2 -0
- package/dist/src/securityValidation/attackScenarios/profiles/androidProfile.js +20 -0
- package/dist/src/securityValidation/validate/cliOptions.js +46 -2
- package/package.json +2 -1
- package/tests/fixtures/android/compose-app/app/build.gradle.kts +21 -0
- package/tests/fixtures/android/compose-app/app/src/main/AndroidManifest.xml +22 -0
- package/tests/fixtures/android/compose-app/app/src/main/java/com/example/composeapp/MainActivity.kt +11 -0
- package/tests/fixtures/android/compose-app/build.gradle.kts +4 -0
- package/tests/fixtures/android/compose-app/gradle/wrapper/gradle-wrapper.properties +4 -0
- package/tests/fixtures/android/compose-app/settings.gradle.kts +2 -0
- package/tests/fixtures/android/gradle-metadata-fixtures/catalog-only-plugin/build.gradle.kts +3 -0
- package/tests/fixtures/android/gradle-metadata-fixtures/catalog-only-plugin/gradle/libs.versions.toml +5 -0
- package/tests/fixtures/android/gradle-metadata-fixtures/comment-safety.gradle.kts +21 -0
- package/tests/fixtures/android/gradle-metadata-fixtures/dynamic-values.gradle.kts +17 -0
- package/tests/fixtures/android/gradle-metadata-fixtures/groovy-literal.gradle +23 -0
- package/tests/fixtures/android/gradle-metadata-fixtures/wrapper-malformed.properties +4 -0
- package/tests/fixtures/android/gradle-metadata-fixtures/wrapper-missing-url.properties +3 -0
- package/tests/fixtures/android/gradle-metadata-fixtures/wrapper-with-checksum.properties +5 -0
- package/tests/fixtures/android/java-app/app/build.gradle +16 -0
- package/tests/fixtures/android/java-app/app/src/main/AndroidManifest.xml +19 -0
- package/tests/fixtures/android/java-app/app/src/main/java/com/example/javaapp/MainActivity.java +4 -0
- package/tests/fixtures/android/java-app/build.gradle +3 -0
- package/tests/fixtures/android/java-app/gradle/wrapper/gradle-wrapper.properties +4 -0
- package/tests/fixtures/android/java-app/settings.gradle +2 -0
- package/tests/fixtures/android/library/build.gradle.kts +3 -0
- package/tests/fixtures/android/library/gradle/wrapper/gradle-wrapper.properties +4 -0
- package/tests/fixtures/android/library/mylibrary/build.gradle.kts +13 -0
- package/tests/fixtures/android/library/mylibrary/src/main/AndroidManifest.xml +2 -0
- package/tests/fixtures/android/library/settings.gradle.kts +2 -0
- package/tests/fixtures/android/manifest-audit-fixtures/incomplete-intent-filter.xml +14 -0
- package/tests/fixtures/android/manifest-audit-fixtures/malformed-exported.xml +10 -0
- package/tests/fixtures/android/manifest-audit-fixtures/malformed.xml +5 -0
- package/tests/fixtures/android/manifest-audit-fixtures/missing-application.xml +7 -0
- package/tests/fixtures/android/manifest-audit-fixtures/missing-component-name.xml +11 -0
- package/tests/fixtures/android/manifest-audit-fixtures/permission-coverage.xml +29 -0
- package/tests/fixtures/android/manifest-audit-fixtures/risky-components.xml +62 -0
- package/tests/fixtures/android/manifest-audit-fixtures/risky-deep-links.xml +45 -0
- package/tests/fixtures/android/manifest-audit-fixtures/unresolved-placeholder.xml +14 -0
- package/tests/fixtures/android/manifest-audit-fixtures/unusual-namespace-prefix.xml +11 -0
- package/tests/fixtures/android/multi-module/app/build.gradle.kts +22 -0
- package/tests/fixtures/android/multi-module/app/src/androidTest/java/com/example/multimodule/app/ExampleInstrumentedTest.kt +3 -0
- package/tests/fixtures/android/multi-module/app/src/main/AndroidManifest.xml +11 -0
- package/tests/fixtures/android/multi-module/app/src/test/java/com/example/multimodule/app/ExampleUnitTest.kt +3 -0
- package/tests/fixtures/android/multi-module/build.gradle.kts +5 -0
- package/tests/fixtures/android/multi-module/core/build.gradle.kts +14 -0
- package/tests/fixtures/android/multi-module/core/src/main/AndroidManifest.xml +2 -0
- package/tests/fixtures/android/multi-module/feature-login/build.gradle.kts +18 -0
- package/tests/fixtures/android/multi-module/feature-login/src/main/AndroidManifest.xml +2 -0
- package/tests/fixtures/android/multi-module/gradle/libs.versions.toml +8 -0
- package/tests/fixtures/android/multi-module/gradle/wrapper/gradle-wrapper.properties +4 -0
- package/tests/fixtures/android/multi-module/settings.gradle.kts +4 -0
- package/tests/fixtures/android/non-android-gradle/build.gradle.kts +3 -0
- package/tests/fixtures/android/non-android-gradle/core/build.gradle.kts +3 -0
- package/tests/fixtures/android/non-android-gradle/core/src/main/java/com/example/core/Core.java +4 -0
- package/tests/fixtures/android/non-android-gradle/gradle/wrapper/gradle-wrapper.properties +4 -0
- package/tests/fixtures/android/non-android-gradle/settings.gradle.kts +2 -0
- package/tests/fixtures/android/partial/app/build.gradle.kts +7 -0
- package/tests/fixtures/android/partial/settings.gradle.kts +2 -0
- package/tests/fixtures/android/xml-view-app/app/build.gradle.kts +17 -0
- package/tests/fixtures/android/xml-view-app/app/src/main/AndroidManifest.xml +31 -0
- package/tests/fixtures/android/xml-view-app/app/src/main/kotlin/com/example/xmlviewapp/MainActivity.kt +7 -0
- package/tests/fixtures/android/xml-view-app/app/src/main/res/layout/activity_main.xml +4 -0
- package/tests/fixtures/android/xml-view-app/build.gradle.kts +4 -0
- package/tests/fixtures/android/xml-view-app/gradle/wrapper/gradle-wrapper.properties +4 -0
- package/tests/fixtures/android/xml-view-app/settings.gradle.kts +2 -0
package/README.md
CHANGED
|
@@ -1,302 +1,78 @@
|
|
|
1
1
|
# my-dev-kit-lab
|
|
2
2
|
|
|
3
|
-
my-dev-kit-lab is the experiment, evidence, reporting,
|
|
3
|
+
my-dev-kit-lab is the experiment, evidence, reporting, visualization, and security-validation companion for my-dev-kit. It provides controlled raw-full-file versus graph-guided retrieval experiments, deterministic fake-agent demonstrations, reports, plots, gallery artifacts, generic audits, and local security-validation workflows.
|
|
4
4
|
|
|
5
|
-
The current published baseline is `v0.3.
|
|
6
|
-
|
|
7
|
-
`v0.3.3` is the previously published npm baseline. Java/Kotlin support is conservative static analysis only: dependency-free scanners, static Gradle/Maven metadata detection, and no compiler, classpath, Gradle, Maven, Android, or target-test execution. `v0.3.4` is release-prepared in this repository: package metadata has been bumped to `0.3.4`, adding mixed-language stability coverage, repeated-run report hardening, cross-platform/path normalization tests, CRLF/LF stability checks, and final documentation reconciliation. `v0.3.4` is not yet published to npm, not tagged, and no GitHub release has been created — local Windows validation has passed and a latest-Node cross-platform workflow is configured for ubuntu/macos/windows, but a fresh remote multi-OS run should be verified during publication.
|
|
8
|
-
|
|
9
|
-
my-dev-kit is most useful when the repository is larger than the task. It helps coding agents work with large codebases through reusable structural indexing, graph-guided retrieval, targeted source slices, and auditable context selection. Results are scoped evidence; the project does not claim that my-dev-kit always saves tokens.
|
|
10
|
-
|
|
11
|
-
**my-dev-kit** is the repo indexing and graph-guided retrieval engine.
|
|
12
|
-
**my-dev-kit-lab** is the separate lab layer that feeds it benchmark inputs and records evaluation outputs.
|
|
13
|
-
|
|
14
|
-
---
|
|
5
|
+
The current published baseline is `v0.3.4`. The v0.4.0 Android validation implementation is release-prepared on `release/v0.4.0`; publication is pending. It is not published, and the npm registry latest version remains `0.3.4`.
|
|
15
6
|
|
|
16
7
|
## Current capabilities
|
|
17
8
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- Codex and Claude adapters for real-agent campaigns
|
|
23
|
-
- Controlled experiment runner comparing `raw-full-file` vs `my-dev-kit-guided` strategies
|
|
24
|
-
- Deterministic correctness scoring from answer keys
|
|
25
|
-
- Token usage, duration, and status comparisons between matched strategy pairs
|
|
26
|
-
- HTML experiment report rendering
|
|
27
|
-
- Static SVG plot generation
|
|
28
|
-
- Optional PNG screenshot capture
|
|
29
|
-
- Gallery manifest and static gallery index output
|
|
30
|
-
- Visualization demos using my-dev-kit commands against benchmark projects
|
|
31
|
-
- Final demo workflow combining all pipeline stages
|
|
32
|
-
- Generic experiment-plugin command surface: `experiment:list`, `experiment:describe`, and `experiment:run`
|
|
33
|
-
- First experiment plugin: `context-strategy-comparison`
|
|
34
|
-
- Target-aware experiment execution for local projects via `experiment:run -- --target <path>`
|
|
35
|
-
- Plugin-aware JSON and HTML reports with plugin, target, variant, metric, artifact, warning, skip, and failure metadata
|
|
36
|
-
- Security validation framework: dependency audit, package tarball inspection, CLI adversarial tests, static scans (CodeQL/Semgrep), bounded fuzz smoke, attack-scenario checks, and structured verdict/report output — runnable against any local project via `security:validate --target <path>`. `security:validate` remains the standalone, focused security-validation command; it is not replaced by the audit adapter below.
|
|
37
|
-
- Generic audit framework, current published baseline: `npm run audit` runs heuristic, conservative code-rot detectors and writes text/JSON reports under `reports/audits/code-rot/` by default. `code-rot` and `security` are the currently implemented audit types (`--types code-rot`, `--types security`, or combined `--types code-rot,security`); `quality`, `project`, and `all` audit types are planned and fail cleanly instead of running. `npm run audit` supports `--target`, `--types`, and other flags — see [docs/COMMANDS.md](docs/COMMANDS.md). Audit does not modify target files and does not auto-fix issues.
|
|
38
|
-
- Language-aware code-rot support, current published package state: normalized language/file-role inventory, a source-facts model and collector, TypeScript/JavaScript, Python, Java, and Kotlin analyzers, and conservative detector integrations for `dead-code-candidate`, `duplicate-implementation-candidate`, `test-rot`, and `docs-code-mismatch`. Python project metadata remains a top-level audit report field. Java/Kotlin support adds static JVM project metadata detection for Gradle/Maven/source-set shape and conservative source-facts evidence, but no compiler parsing, type resolution, classpath resolution, Gradle/Maven execution, Android validation, or target-project test execution. No `SourceFacts` schema change or new audit command was added for `v0.3.3`.
|
|
39
|
-
- Security-validation audit adapter, current published package state: `npm run audit -- --types security` runs security validation through the shared audit/report surface by calling the same `runSecurityValidation()` internals `security:validate` uses, maps security findings into audit-issue-shaped entries, and adds a `securitySummary` field (verdict, check counts, finding counts, and links to the original `reports/security/*.txt`/`*.json` report) to audit JSON/text reports. `npm run audit -- --types code-rot,security` runs both audit types together. The original `security:validate` command and its `reports/security/` output are unchanged.
|
|
40
|
-
- `v0.3.4` implementation state (release-prepared, not yet published): mixed-language fixture corpus, source-facts invariants, full-registry mixed-language detector stability tests, repeated-run audit report determinism checks, cross-platform/path normalization hardening, CRLF/LF parsing stability coverage, and final documentation reconciliation. Package metadata is bumped to `0.3.4`; it is not yet tagged or published.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Architecture overview
|
|
45
|
-
|
|
46
|
-
```mermaid
|
|
47
|
-
flowchart TD
|
|
48
|
-
A[scripts/experiments] --> B[Experiment plugin registry + runner]
|
|
49
|
-
B --> C[context-strategy-comparison]
|
|
50
|
-
C --> D[Controlled experiment foundations]
|
|
51
|
-
D --> E[Plugin + legacy artifacts]
|
|
52
|
-
E --> F[Plugin-aware reports]
|
|
53
|
-
E --> G[Plots / screenshots / gallery]
|
|
54
|
-
H[scripts/security] --> I[Automated security validation]
|
|
55
|
-
I --> J[Security reports + verdict]
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
---
|
|
9
|
+
- Controlled experiment plugins, reports, plots, screenshots, and gallery artifacts.
|
|
10
|
+
- Generic code-rot and general security audit types through `npm run audit`.
|
|
11
|
+
- Standalone CLI/package security validation through `npm run security:validate`.
|
|
12
|
+
- Android security validation through the canonical `android` profile on the v0.4.0 feature branch.
|
|
59
13
|
|
|
60
|
-
##
|
|
14
|
+
## Android validation
|
|
61
15
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
npm install
|
|
66
|
-
```
|
|
16
|
+
Run static Android validation with:
|
|
67
17
|
|
|
68
18
|
```powershell
|
|
69
|
-
npm
|
|
19
|
+
npm run security:validate -- --target "<android-project-path>" --profile android
|
|
70
20
|
```
|
|
71
21
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
### Build
|
|
22
|
+
This default path executes **no Gradle commands**. It detects/classifies Android projects and UI evidence, parses discovered manifests independently, audits permissions/exported components/intent filters/deep links, extracts static Gradle metadata, assembles release metadata and Play-readiness placeholders, calculates an Android verdict, and writes bounded text and JSON reports.
|
|
75
23
|
|
|
76
|
-
|
|
77
|
-
npm run build
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Verify the installation
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
npm run verify
|
|
84
|
-
```
|
|
24
|
+
Reports use the existing `reports/security/` root unless `--out` is supplied. Android report files use the `<prefix>-android-security-validation.txt` and `.json` convention.
|
|
85
25
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
npm run run-final-demo -- \
|
|
90
|
-
--cases examples/token-savings-cases.json \
|
|
91
|
-
--out lab-output/final-demo \
|
|
92
|
-
--kit-command "node tests/fixtures/fake-my-dev-kit-cli.js" \
|
|
93
|
-
--agents fake-agent \
|
|
94
|
-
--complexities short \
|
|
95
|
-
--no-screenshot
|
|
96
|
-
```
|
|
26
|
+
Optional Gradle validation is explicit:
|
|
97
27
|
|
|
98
28
|
```powershell
|
|
99
|
-
npm run
|
|
100
|
-
--cases examples/token-savings-cases.json `
|
|
101
|
-
--out lab-output/final-demo `
|
|
102
|
-
--kit-command "node tests/fixtures/fake-my-dev-kit-cli.js" `
|
|
103
|
-
--agents fake-agent `
|
|
104
|
-
--complexities short `
|
|
105
|
-
--no-screenshot
|
|
29
|
+
npm run security:validate -- --target "<android-project-path>" --profile android --android-gradle-operations wrapper-version,tasks
|
|
106
30
|
```
|
|
107
31
|
|
|
108
|
-
|
|
109
|
-
npm run run-final-demo -- --cases examples/token-savings-cases.json --out lab-output/final-demo --kit-command "node tests/fixtures/fake-my-dev-kit-cli.js" --agents fake-agent --complexities short --no-screenshot
|
|
110
|
-
```
|
|
32
|
+
The only allowed operation IDs are:
|
|
111
33
|
|
|
112
|
-
|
|
34
|
+
- `wrapper-version`
|
|
35
|
+
- `tasks`
|
|
36
|
+
- `assemble-debug`
|
|
37
|
+
- `unit-test-debug`
|
|
38
|
+
- `lint-debug`
|
|
113
39
|
|
|
114
|
-
|
|
40
|
+
Unknown or empty lists, arbitrary tasks, and use with a non-Android profile are rejected. Optional operations can require Java, Android SDK components, wrapper distributions, and cached dependencies; environment gaps can produce skipped or inconclusive evidence.
|
|
115
41
|
|
|
116
|
-
###
|
|
42
|
+
### Verdicts
|
|
117
43
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
--strategies raw-full-file,my-dev-kit-guided \
|
|
123
|
-
--complexities medium,multi-step \
|
|
124
|
-
--out lab-output/real-agent-campaign \
|
|
125
|
-
--include-real-agents \
|
|
126
|
-
--continue-on-failure \
|
|
127
|
-
--timeout-ms 240000
|
|
128
|
-
```
|
|
44
|
+
- `not-ready-security-blocker-remains`: a blocker remains.
|
|
45
|
+
- `inconclusive-audit-environment-incomplete`: required evidence/environment is incomplete.
|
|
46
|
+
- `ready-except-optional-manual-checks`: advisory or manual follow-up remains.
|
|
47
|
+
- `ready-for-release-preparation`: required static evidence passed.
|
|
129
48
|
|
|
130
|
-
|
|
49
|
+
These are validation-evidence states, not claims that an app is published, Play-ready, Play-compliant, runtime-secure, or signing-valid.
|
|
131
50
|
|
|
132
|
-
###
|
|
51
|
+
### Important Android limitations
|
|
133
52
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
--no-screenshot
|
|
143
|
-
```
|
|
53
|
+
- Static analysis does not prove runtime behavior.
|
|
54
|
+
- Manifests are not merged; placeholders and resource references are not resolved.
|
|
55
|
+
- Gradle scripts are not evaluated; dynamic metadata can stay unresolved; same-file duplicate assignment extraction uses the first match.
|
|
56
|
+
- Optional Gradle execution is disabled by default and environment-dependent.
|
|
57
|
+
- APK/AAB contents, signing, emulator/device behavior, Digital Asset Links, domain ownership, and live Google Play policy are not validated.
|
|
58
|
+
- Play Console items such as privacy policy, Data Safety, permissions declarations, store listing, release notes, content rating, and policy review remain manual placeholders.
|
|
59
|
+
|
|
60
|
+
## Development
|
|
144
61
|
|
|
145
62
|
```powershell
|
|
146
|
-
npm run
|
|
147
|
-
npm run
|
|
148
|
-
npm run
|
|
149
|
-
|
|
150
|
-
--target "Z:\Users\newuser\Projects\my-dev-kit-v1" `
|
|
151
|
-
--agents fake-agent `
|
|
152
|
-
--complexities short `
|
|
153
|
-
--no-screenshot
|
|
63
|
+
npm run typecheck
|
|
64
|
+
npm run build
|
|
65
|
+
npm run test
|
|
66
|
+
npm run verify
|
|
154
67
|
```
|
|
155
68
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## Where to find outputs
|
|
161
|
-
|
|
162
|
-
| Artifact | Location |
|
|
163
|
-
|---|---|
|
|
164
|
-
| Experiment summary | `lab-output/<experiment>/experiment-summary.json` |
|
|
165
|
-
| All runs | `lab-output/<experiment>/experiment-runs.json` |
|
|
166
|
-
| Strategy comparisons | `lab-output/<experiment>/experiment-comparisons.json` |
|
|
167
|
-
| HTML report | `lab-output/<report>/experiment-report.html` |
|
|
168
|
-
| Report JSON | `lab-output/<report>/experiment-report.json` |
|
|
169
|
-
| Report screenshot | `lab-output/<report>/experiment-report.png` |
|
|
170
|
-
| Plugin experiment report JSON | `lab-output/experiments/<plugin>/<target>/<run>/report.json` |
|
|
171
|
-
| Plugin experiment report HTML | `lab-output/experiments/<plugin>/<target>/<run>/report.html` |
|
|
172
|
-
| Plot data | `lab-output/<plots>/plot-data.json` |
|
|
173
|
-
| SVG charts | `lab-output/<plots>/charts/*.svg` |
|
|
174
|
-
| Gallery manifest | `lab-output/<gallery>/gallery-manifest.json` |
|
|
175
|
-
| Gallery index | `lab-output/<gallery>/gallery-index.html` |
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
## How to read the main report
|
|
180
|
-
|
|
181
|
-
Open `experiment-report.html` in a browser. The report shows:
|
|
182
|
-
|
|
183
|
-
- **Project profile** — benchmark project name, language mix, complexity score, and file tree
|
|
184
|
-
- **Benchmark tasks** — task descriptions and answer keys
|
|
185
|
-
- **Strategy comparisons** — paired `raw-full-file` vs `my-dev-kit-guided` runs per case
|
|
186
|
-
- **Correctness scores** — deterministic answer-key scoring (not semantic LLM judging)
|
|
187
|
-
- **Token usage** — estimated or reported token totals per run
|
|
188
|
-
- **Token savings** — positive means my-dev-kit used fewer tokens; negative means it used more
|
|
189
|
-
- **Duration** — wall-clock time per run
|
|
190
|
-
- **Status** — completed, timeout, invalid-output, or limit-reached
|
|
191
|
-
- **Warnings and limitations** — notes on missing token totals or partial results
|
|
192
|
-
|
|
193
|
-
See [docs/METRICS.md](docs/METRICS.md) for full metric definitions.
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
## Current limitations
|
|
198
|
-
|
|
199
|
-
- Token savings shown in fake-agent runs are based on estimated character counts, not provider billing telemetry
|
|
200
|
-
- Claude does not expose token totals; token savings comparisons are unavailable for Claude runs
|
|
201
|
-
- Codex may expose token totals but can produce timeouts or invalid-output runs
|
|
202
|
-
- Small projects may make raw-full-file cheaper than my-dev-kit-guided; larger localized tasks are where my-dev-kit is expected to become more useful
|
|
203
|
-
- The generic experiment-plugin framework currently ships one plugin, `context-strategy-comparison`; future plugins such as warm-index reuse, incremental-change, and context-window scaling are not implemented yet
|
|
204
|
-
- The current baseline does not prove token savings are guaranteed; it produces auditable evidence for specific cases, targets, agents, and strategies
|
|
205
|
-
- Provider telemetry dashboards, semantic LLM judging, and cloud API billing integration are not yet implemented
|
|
206
|
-
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
## Current baseline release positioning
|
|
210
|
-
|
|
211
|
-
my-dev-kit-lab is at a working baseline. The raw-vs-indexed experiment pipeline is fully implemented and produces reproducible artifacts. Real-agent campaign support exists for Codex and Claude. The previously published npm baseline is `v0.3.3`, which added Java/Kotlin analyzers, JVM metadata detection, Java/Kotlin detector support, and Java/Kotlin/Gradle/Maven docs-code-mismatch checks on top of the published `v0.3.2` baseline.
|
|
212
|
-
|
|
213
|
-
`v0.3.4` is release-prepared in this repository: package metadata has been bumped to `0.3.4`. It hardens the existing language-aware audit path with mixed-language fixture coverage, detector and report determinism checks, cross-platform/path normalization coverage, CRLF/LF stability coverage, and documentation reconciliation. It does not add a new command. It is not yet published, not tagged, and no GitHub release has been created.
|
|
214
|
-
|
|
215
|
-
Planned roadmap direction after the previously published baseline:
|
|
216
|
-
|
|
217
|
-
- `v0.3.3`: Java/Kotlin code-rot support (published)
|
|
218
|
-
- `v0.3.4`: cross-language stability for the language-aware code-rot track (release-prepared in this checkout; not yet published)
|
|
219
|
-
- `v0.4.0` through `v0.4.2`: Android automated security validation, including an Android-specific extension of the security audit adapter
|
|
220
|
-
- manual pentest: post-v1 / version TBD
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
224
|
-
## Security validation
|
|
225
|
-
|
|
226
|
-
my-dev-kit-lab owns a release-security validation track for **my-dev-kit**. This work is separate from the experiment pipeline and does not replace the generic experiment-plugin roadmap. Its purpose is to generate release-validation evidence for the local CLI/package before release preparation.
|
|
227
|
-
|
|
228
|
-
`security:validate` remains the standalone, focused command for this validation and is unaffected by the current checked-out state. `npm run audit -- --types security` additionally adapts the same `security:validate` internals into the shared audit/report surface (mapped issues, a `securitySummary` field, and links to the original `reports/security/` output) — it does not replace or duplicate `security:validate`'s own checks or reports.
|
|
229
|
-
|
|
230
|
-
This is not a web application pentest framework. **my-dev-kit** is a local CLI/package, so the validation model is CLI/package adversarial testing focused on whether it remains:
|
|
231
|
-
|
|
232
|
-
- local-first
|
|
233
|
-
- deterministic
|
|
234
|
-
- read-only with respect to user source files
|
|
235
|
-
- network-free during normal CLI operation
|
|
236
|
-
- LLM-free
|
|
237
|
-
- database-free
|
|
238
|
-
- safe to run on local repositories
|
|
239
|
-
|
|
240
|
-
The automated validation gate is implemented. It combines static scans, dependency/package checks, adversarial CLI tests, bounded fuzz smoke tests, and attack-scenario checks with structured text/JSON reports and a four-category verdict.
|
|
241
|
-
|
|
242
|
-
### Security commands
|
|
243
|
-
|
|
244
|
-
| Command | Description |
|
|
245
|
-
|---|---|
|
|
246
|
-
| `npm run security:deps` | npm audit, OSV-Scanner (if available), outdated packages |
|
|
247
|
-
| `npm run security:package` | npm pack --dry-run, forbidden content detection |
|
|
248
|
-
| `npm run security:codeql` | CodeQL CLI availability check; skipped gracefully when absent |
|
|
249
|
-
| `npm run security:semgrep` | Semgrep scan via local binary or npx; skipped gracefully when both absent |
|
|
250
|
-
| `npm run test:security` | Automated security and adversarial CLI tests (path traversal, read-only boundaries, malformed artifacts, JSON safety, and related checks) |
|
|
251
|
-
| `npm run test:fuzz:smoke` | 9 bounded fuzz targets, seeded PRNG, completes in under 1 second |
|
|
252
|
-
| `npm run security:validate` | Runs selected security checks, applies profile-aware defaults when requested, and writes text/JSON reports according to `--format` |
|
|
253
|
-
|
|
254
|
-
CodeQL, Semgrep, and OSV-Scanner are optional. When unavailable locally, they are recorded as `skipped` in the report, not as passed. That can lead to `ready except optional manual checks`; it does not silently turn missing tooling into a clean pass.
|
|
255
|
-
|
|
256
|
-
Each security command can validate my-dev-kit-lab itself or another local project via `--target <path>`. When `--target` is omitted, the framework performs self-validation. Target projects are inspected in place: their source files are not modified by default, generated artifacts stay under `reports/security/` unless `--out` is used, and external-target reports identify the tool root, target root, target package metadata, target git metadata, command cwd, exit code, and stdout/stderr summaries.
|
|
257
|
-
|
|
258
|
-
`security:validate` supports `--checks`, `--profile`, `--format`, `--fail-on`, `--out`, and `--report-prefix`. The no-flag path remains backward compatible and still runs the classic implemented check groups: `deps`, `package`, `static`, `cli-adversarial`, and `fuzz`. Supplying `--profile` without `--checks` swaps in that profile's default checks; supplying explicit `--checks` always wins over profile defaults.
|
|
259
|
-
|
|
260
|
-
The current attack-scenario checks cover boundary, subprocess, secrets, and network assumptions. They are automated adversarial checks, not a manual pentest. Manual pentest is deferred until after `v1.0.0`. `verdictImpact` metadata from each registered scenario drives blocker categorization in report reasoning, and narrowed `--checks` runs are labeled as scoped rather than described as a full release gate.
|
|
261
|
-
|
|
262
|
-
JSON report poisoning/config-injection checks use a baseline-diff schema guard so legitimate additive JSON fields do not fail the guard while payload-created trusted top-level fields still do. Text reports are sanitized to strip ANSI/control-byte payloads before rendering.
|
|
263
|
-
|
|
264
|
-
Known limits remain intentionally explicit: secret scanning is bounded rather than exhaustive, the network/local-first check is a bounded static assumption check rather than proof of runtime isolation, package-boundary severity is still result-level rather than per-evidence-item, and profile-specific scenario behavior is limited to profile-based scenario selection/default checks.
|
|
265
|
-
|
|
266
|
-
For external-target validation, `security:validate` reads the target `package.json`, detects `scripts.test:security`, and runs `npm run test:security` in the target project root when that script exists. This behavior is validated both from the source checkout and from an installed packed tarball because published-package execution differs from local source execution.
|
|
267
|
-
|
|
268
|
-
Generated security reports under `reports/security/` are excluded from git by default. They are produced locally or in CI as release-gate evidence and are not committed to the repository.
|
|
269
|
-
|
|
270
|
-
See [docs/COMMANDS.md](docs/COMMANDS.md) for full command options and [docs/security-validation-framework.md](docs/security-validation-framework.md) for the security model, implemented modules, and release verdicts.
|
|
271
|
-
|
|
272
|
-
---
|
|
273
|
-
|
|
274
|
-
## License
|
|
275
|
-
|
|
276
|
-
MIT License. See [LICENSE](LICENSE) for the full text.
|
|
277
|
-
|
|
278
|
-
---
|
|
279
|
-
|
|
280
|
-
## Support
|
|
281
|
-
|
|
282
|
-
my-dev-kit-lab is an independent project by dailephd LLC, developed and maintained by Dai Le.
|
|
283
|
-
|
|
284
|
-
If this project helps your workflow, you can support continued development through GitHub Sponsors or PayPal:
|
|
285
|
-
|
|
286
|
-
- [Sponsor on GitHub](https://github.com/sponsors/dailephd)
|
|
287
|
-
- [Support via PayPal](https://paypal.me/daile88)
|
|
288
|
-
|
|
289
|
-
Support is optional and does not affect access to the project.
|
|
69
|
+
Use `npm run security:validate -- --help` for command usage. Help does not run validation or write reports.
|
|
290
70
|
|
|
291
|
-
|
|
71
|
+
## Roadmap status
|
|
292
72
|
|
|
293
|
-
|
|
73
|
+
- `v0.4.0`: Android validation MVP — release-prepared; publication pending.
|
|
74
|
+
- `v0.4.1`: planned advanced Android security checks.
|
|
75
|
+
- `v0.4.2`: planned Android extension of the existing security audit adapter; it will not replace `security:validate`.
|
|
76
|
+
- Manual pentest: deferred post-v1 / version TBD; not part of v0.4.x.
|
|
294
77
|
|
|
295
|
-
|
|
296
|
-
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) — current and future architecture
|
|
297
|
-
- [docs/WORKFLOWS.md](docs/WORKFLOWS.md) — step-by-step workflows with diagrams
|
|
298
|
-
- [docs/COMMANDS.md](docs/COMMANDS.md) — all commands with options and examples
|
|
299
|
-
- [docs/TUTORIAL.md](docs/TUTORIAL.md) — first-run walkthrough
|
|
300
|
-
- [docs/METRICS.md](docs/METRICS.md) — metric definitions and interpretation
|
|
301
|
-
- [docs/ROADMAP.md](docs/ROADMAP.md) — current baseline and future phases
|
|
302
|
-
- [docs/GALLERY.md](docs/GALLERY.md) — gallery output explained
|
|
78
|
+
See [docs/PROJECT_OVERVIEW.md](docs/PROJECT_OVERVIEW.md), [docs/COMMANDS.md](docs/COMMANDS.md), [docs/WORKFLOWS.md](docs/WORKFLOWS.md), [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md), and [docs/ROADMAP.md](docs/ROADMAP.md).
|
|
@@ -8,12 +8,36 @@ import { parseSecurityValidateArgs, normalizeSecurityValidateConfig, applyProfil
|
|
|
8
8
|
import { resolveAttackProfile } from "../../src/securityValidation/attackScenarios/attackProfile.js";
|
|
9
9
|
import { findingsBreachFailOnThreshold } from "../../src/securityValidation/validate/verdict.js";
|
|
10
10
|
import { resolveToolRoot } from "./resolveToolRoot.js";
|
|
11
|
+
import { validateAndroidTarget } from "../../src/mobile/android/validate/validateAndroidTarget.js";
|
|
12
|
+
import { toAndroidReportModel } from "../../src/mobile/android/report/model.js";
|
|
13
|
+
import { renderAndroidTextReport } from "../../src/mobile/android/report/renderAndroidReport.js";
|
|
14
|
+
import { writeAndroidReportFiles } from "../../src/mobile/android/report/writeAndroidReportFiles.js";
|
|
11
15
|
const USAGE = "Usage: npm run security:validate -- [--target <path>] [--out <dir>] [--report-prefix <name>] " +
|
|
12
16
|
"[--checks deps,package,static,cli-adversarial,fuzz,boundary,subprocess,secrets,network] " +
|
|
13
|
-
"[--profile node-cli-package|local-tool|npm-package] [--format text,json] [--fail-on blocker|high|medium|low]"
|
|
17
|
+
"[--profile node-cli-package|local-tool|npm-package|android] [--format text,json] [--fail-on blocker|high|medium|low] " +
|
|
18
|
+
"[--android-gradle-operations wrapper-version,tasks,assemble-debug,unit-test-debug,lint-debug]\n" +
|
|
19
|
+
"\n" +
|
|
20
|
+
"Android profile:\n" +
|
|
21
|
+
" --profile android performs static, read-only Android project detection, manifest parsing,\n" +
|
|
22
|
+
" permission/exported-component/intent-filter/deep-link audits, and static Gradle metadata\n" +
|
|
23
|
+
" extraction. Gradle is never executed by default.\n" +
|
|
24
|
+
" --android-gradle-operations explicitly opts into running ONLY the listed allowlisted Gradle\n" +
|
|
25
|
+
" operations (wrapper-version, tasks, assemble-debug, unit-test-debug, lint-debug) via the\n" +
|
|
26
|
+
" project's own Gradle wrapper. Arbitrary Gradle tasks cannot be passed. This option is only\n" +
|
|
27
|
+
" valid together with --profile android.\n" +
|
|
28
|
+
" Example: npm run security:validate -- --target \"<android-project-path>\" --profile android\n" +
|
|
29
|
+
" Example: npm run security:validate -- --target \"<android-project-path>\" --profile android --android-gradle-operations wrapper-version,tasks";
|
|
14
30
|
// Parse CLI arguments from process.argv (after the node/tsx and script path).
|
|
15
31
|
const rawArgs = process.argv.slice(2);
|
|
16
32
|
const toolRoot = resolveToolRoot(import.meta.url);
|
|
33
|
+
// Help deliberately wins over every other argument. It must remain a
|
|
34
|
+
// no-work path: no target/default resolution, option normalization, report
|
|
35
|
+
// directory creation, validation orchestration, or subprocess execution.
|
|
36
|
+
if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
|
|
37
|
+
console.log(USAGE);
|
|
38
|
+
process.exitCode = 0;
|
|
39
|
+
process.exit(0);
|
|
40
|
+
}
|
|
17
41
|
let args;
|
|
18
42
|
let config;
|
|
19
43
|
try {
|
|
@@ -22,15 +46,18 @@ try {
|
|
|
22
46
|
// v0.2.2 Batch 5: --profile with no --checks uses that profile's declared
|
|
23
47
|
// default checks. No-op unless the user passed --profile without --checks
|
|
24
48
|
// (see applyProfileDefaultChecksIfApplicable's guard) — the true no-flag
|
|
25
|
-
// case and any explicit --checks case are always unaffected.
|
|
26
|
-
|
|
49
|
+
// case and any explicit --checks case are always unaffected. Skipped for
|
|
50
|
+
// "android": that profile does not use the classic --checks pipeline.
|
|
51
|
+
if (config.profile !== "android") {
|
|
52
|
+
config = applyProfileDefaultChecksIfApplicable(config, resolveAttackProfile(config.profile).defaultCheckIds);
|
|
53
|
+
}
|
|
27
54
|
}
|
|
28
55
|
catch (err) {
|
|
29
56
|
const msg = err instanceof Error ? err.message : String(err);
|
|
30
57
|
console.error(`\nERROR: ${msg}`);
|
|
31
58
|
console.error(USAGE);
|
|
32
|
-
process.exitCode =
|
|
33
|
-
process.exit(
|
|
59
|
+
process.exitCode = 2;
|
|
60
|
+
process.exit(2);
|
|
34
61
|
}
|
|
35
62
|
// Resolve and validate target early so we can fail fast with a clean error.
|
|
36
63
|
let target;
|
|
@@ -56,71 +83,151 @@ if (!target.isSelf) {
|
|
|
56
83
|
else {
|
|
57
84
|
console.log(`Mode : self-validation`);
|
|
58
85
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
86
|
+
console.log(`Profile : ${config.profile}`);
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
// v0.4.0 Batch 5 — Android profile path.
|
|
89
|
+
//
|
|
90
|
+
// A separate orchestrator (not the classic check-group/attack-scenario
|
|
91
|
+
// pipeline below) because the Android check/finding/status vocabulary
|
|
92
|
+
// established in Batches 1-4 does not fit SecurityCheckId/SecurityCheckResult.
|
|
93
|
+
// Same command, same --profile flag, same reports/security/ output root.
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
if (config.profile === "android") {
|
|
96
|
+
if (config.androidGradleOperationIds.length > 0) {
|
|
97
|
+
console.log(`Gradle ops : ${config.androidGradleOperationIds.join(", ")} (explicitly requested — will execute via the target's Gradle wrapper)`);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
console.log(`Gradle ops : (none requested — static-only validation, zero Gradle process execution)`);
|
|
101
|
+
}
|
|
102
|
+
console.log("");
|
|
103
|
+
let result;
|
|
104
|
+
try {
|
|
105
|
+
result = await validateAndroidTarget({
|
|
106
|
+
toolRoot,
|
|
107
|
+
targetPath: args.target,
|
|
108
|
+
requestedGradleOperationIds: config.androidGradleOperationIds,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
113
|
+
console.error(`\nERROR: Android validation failed to run: ${msg}`);
|
|
114
|
+
process.exitCode = 3;
|
|
115
|
+
process.exit(3);
|
|
116
|
+
}
|
|
117
|
+
const reportModel = toAndroidReportModel(result, {
|
|
118
|
+
profile: config.profile,
|
|
119
|
+
requestedGradleOperations: config.androidGradleOperationIds,
|
|
120
|
+
});
|
|
121
|
+
const textReport = renderAndroidTextReport(reportModel);
|
|
122
|
+
const reportsDir = config.out;
|
|
123
|
+
const prefix = args.reportPrefix ??
|
|
124
|
+
reportFilenamePrefix({
|
|
125
|
+
isSelf: result.target.local.isSelf,
|
|
126
|
+
packageName: result.target.local.packageName,
|
|
127
|
+
packageVersion: result.target.local.packageVersion,
|
|
128
|
+
targetRoot: result.target.local.targetRoot,
|
|
129
|
+
});
|
|
130
|
+
let writtenPaths;
|
|
131
|
+
try {
|
|
132
|
+
({ writtenPaths } = writeAndroidReportFiles({ outDir: reportsDir, prefix, report: reportModel, formats: config.formats }));
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
136
|
+
console.error(`\nERROR: Failed to write Android report files: ${msg}`);
|
|
137
|
+
console.error("Validation completed but the report could not be written. The in-memory result was not persisted.");
|
|
138
|
+
process.exitCode = 4;
|
|
139
|
+
process.exit(4);
|
|
140
|
+
}
|
|
141
|
+
console.log(textReport);
|
|
142
|
+
console.log(`\nReports written:`);
|
|
143
|
+
for (const p of writtenPaths) {
|
|
144
|
+
console.log(` ${p}`);
|
|
145
|
+
}
|
|
146
|
+
const blockerExists = result.verdict === "not-ready-security-blocker-remains";
|
|
147
|
+
const inconclusive = result.verdict === "inconclusive-audit-environment-incomplete";
|
|
148
|
+
if (blockerExists) {
|
|
149
|
+
console.error("\nExit 1 — security blocker remains.");
|
|
150
|
+
process.exitCode = 1;
|
|
151
|
+
}
|
|
152
|
+
else if (inconclusive) {
|
|
153
|
+
console.warn("\nExit 2 — android environment incomplete.");
|
|
154
|
+
process.exitCode = 2;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
console.log("\nExit 0 — validation completed.");
|
|
158
|
+
process.exitCode = 0;
|
|
159
|
+
}
|
|
122
160
|
}
|
|
123
161
|
else {
|
|
124
|
-
|
|
125
|
-
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
// Classic check-group/attack-scenario pipeline (unchanged from prior versions).
|
|
164
|
+
// ---------------------------------------------------------------------------
|
|
165
|
+
if (!config.checksWereDefault) {
|
|
166
|
+
console.log(`Checks : ${config.checks.join(", ")}`);
|
|
167
|
+
}
|
|
168
|
+
if (config.plannedChecksRequested.length > 0) {
|
|
169
|
+
console.log(`Note : ${config.plannedChecksRequested.join(", ")} are routed through the attack-scenario framework rather than the classic check-group runners. Review the attack-scenario section in the report for their concrete results.`);
|
|
170
|
+
}
|
|
171
|
+
console.log("");
|
|
172
|
+
const summary = await runSecurityValidation({
|
|
173
|
+
cwd: toolRoot,
|
|
174
|
+
targetPath: args.target,
|
|
175
|
+
fuzzIterations: parseInt(process.env["FUZZ_ITERATIONS"] ?? "50", 10),
|
|
176
|
+
fuzzSeed: parseInt(process.env["FUZZ_SEED"] ?? "0xDEADBEEF", 16),
|
|
177
|
+
// Full selection (implemented + planned/attack-scenario ids) — the runner
|
|
178
|
+
// gates both implemented check groups and attack-scenario checks off the
|
|
179
|
+
// same selectedChecks set.
|
|
180
|
+
selectedChecks: config.checks,
|
|
181
|
+
profile: config.profile,
|
|
182
|
+
});
|
|
183
|
+
// v0.2.2 Batch 5: --fail-on breach is additive to (never a substitute for)
|
|
184
|
+
// the existing verdict-based exit decision below — it can only escalate
|
|
185
|
+
// exit 0 to exit 1 (e.g. --fail-on medium/low catching minor/informational
|
|
186
|
+
// findings the verdict policy doesn't already treat as blocking), never
|
|
187
|
+
// downgrade an existing blocker.
|
|
188
|
+
const failOnBreached = findingsBreachFailOnThreshold(summary.findings, config.failOnThreshold);
|
|
189
|
+
// Build report object
|
|
190
|
+
const report = buildSecurityReportFromSummary(summary, {
|
|
191
|
+
profile: config.profile,
|
|
192
|
+
selectedChecks: config.checks,
|
|
193
|
+
failOnThreshold: config.failOnThreshold,
|
|
194
|
+
formats: config.formats,
|
|
195
|
+
failOnBreached,
|
|
196
|
+
});
|
|
197
|
+
const textReport = renderTextReport(report);
|
|
198
|
+
// Determine output directory
|
|
199
|
+
const reportsDir = config.out;
|
|
200
|
+
// Determine report filename prefix
|
|
201
|
+
const prefix = args.reportPrefix ?? reportFilenamePrefix(target);
|
|
202
|
+
const { writtenPaths } = writeSecurityReportFiles({
|
|
203
|
+
outDir: reportsDir,
|
|
204
|
+
prefix,
|
|
205
|
+
report,
|
|
206
|
+
formats: config.formats,
|
|
207
|
+
});
|
|
208
|
+
// Print report to stdout
|
|
209
|
+
console.log(textReport);
|
|
210
|
+
console.log(`\nReports written:`);
|
|
211
|
+
for (const p of writtenPaths) {
|
|
212
|
+
console.log(` ${p}`);
|
|
213
|
+
}
|
|
214
|
+
// Exit code based on verdict, escalated (never downgraded) by --fail-on.
|
|
215
|
+
const blockerExists = summary.verdict === "not-ready-security-blocker-remains";
|
|
216
|
+
const inconclusive = summary.verdict === "inconclusive-audit-environment-incomplete";
|
|
217
|
+
if (blockerExists) {
|
|
218
|
+
console.error("\nExit 1 — security blocker remains.");
|
|
219
|
+
process.exitCode = 1;
|
|
220
|
+
}
|
|
221
|
+
else if (inconclusive) {
|
|
222
|
+
console.warn("\nExit 2 — audit environment incomplete.");
|
|
223
|
+
process.exitCode = 2;
|
|
224
|
+
}
|
|
225
|
+
else if (failOnBreached) {
|
|
226
|
+
console.error(`\nExit 1 — --fail-on ${config.failOnThreshold} threshold breached.`);
|
|
227
|
+
process.exitCode = 1;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
console.log("\nExit 0 — validation completed.");
|
|
231
|
+
process.exitCode = 0;
|
|
232
|
+
}
|
|
126
233
|
}
|