@dailephd/my-dev-kit-lab 0.3.4 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (252) hide show
  1. package/README.md +12 -287
  2. package/dist/scripts/security/validate.js +210 -70
  3. package/dist/src/audits/codeRot/detectors/architectureDriftDetector.js +5 -2
  4. package/dist/src/audits/codeRot/detectors/securityValidationAssumptionRotDetector.js +5 -2
  5. package/dist/src/mobile/android/advancedSecurity/backupConfiguration/analyzeBackupConfiguration.js +300 -0
  6. package/dist/src/mobile/android/advancedSecurity/backupConfiguration/checkResult.js +41 -0
  7. package/dist/src/mobile/android/advancedSecurity/backupConfiguration/index.js +8 -0
  8. package/dist/src/mobile/android/advancedSecurity/backupConfiguration/manifestEvidence.js +102 -0
  9. package/dist/src/mobile/android/advancedSecurity/backupConfiguration/parseBackupRules.js +110 -0
  10. package/dist/src/mobile/android/advancedSecurity/backupConfiguration/types.js +27 -0
  11. package/dist/src/mobile/android/advancedSecurity/candidateEvidence.js +50 -0
  12. package/dist/src/mobile/android/advancedSecurity/clipboard/analyzeClipboardSecurity.js +166 -0
  13. package/dist/src/mobile/android/advancedSecurity/clipboard/checkResult.js +74 -0
  14. package/dist/src/mobile/android/advancedSecurity/clipboard/collectClipboardEvidence.js +82 -0
  15. package/dist/src/mobile/android/advancedSecurity/clipboard/index.js +1 -0
  16. package/dist/src/mobile/android/advancedSecurity/clipboard/types.js +1 -0
  17. package/dist/src/mobile/android/advancedSecurity/externalTools/androidLint/checkResult.js +255 -0
  18. package/dist/src/mobile/android/advancedSecurity/externalTools/androidLint/index.js +1 -0
  19. package/dist/src/mobile/android/advancedSecurity/externalTools/androidLint/parseLintSarif.js +37 -0
  20. package/dist/src/mobile/android/advancedSecurity/externalTools/androidLint/parseLintXml.js +36 -0
  21. package/dist/src/mobile/android/advancedSecurity/externalTools/artifacts.js +95 -0
  22. package/dist/src/mobile/android/advancedSecurity/externalTools/boundedOutput.js +33 -0
  23. package/dist/src/mobile/android/advancedSecurity/externalTools/dependencyCheck/checkResult.js +173 -0
  24. package/dist/src/mobile/android/advancedSecurity/externalTools/dependencyCheck/command.js +33 -0
  25. package/dist/src/mobile/android/advancedSecurity/externalTools/dependencyCheck/index.js +1 -0
  26. package/dist/src/mobile/android/advancedSecurity/externalTools/dependencyCheck/parseDependencyCheckJson.js +133 -0
  27. package/dist/src/mobile/android/advancedSecurity/externalTools/discoverExecutable.js +13 -0
  28. package/dist/src/mobile/android/advancedSecurity/externalTools/index.js +8 -0
  29. package/dist/src/mobile/android/advancedSecurity/externalTools/minimalEnvironment.js +26 -0
  30. package/dist/src/mobile/android/advancedSecurity/externalTools/mutation.js +77 -0
  31. package/dist/src/mobile/android/advancedSecurity/externalTools/osv/checkResult.js +161 -0
  32. package/dist/src/mobile/android/advancedSecurity/externalTools/osv/command.js +25 -0
  33. package/dist/src/mobile/android/advancedSecurity/externalTools/osv/index.js +1 -0
  34. package/dist/src/mobile/android/advancedSecurity/externalTools/osv/parseOsvJson.js +136 -0
  35. package/dist/src/mobile/android/advancedSecurity/externalTools/runBoundedExternalTool.js +51 -0
  36. package/dist/src/mobile/android/advancedSecurity/externalTools/runRequestedAndroidExternalTools.js +54 -0
  37. package/dist/src/mobile/android/advancedSecurity/externalTools/semgrep/checkResult.js +170 -0
  38. package/dist/src/mobile/android/advancedSecurity/externalTools/semgrep/command.js +28 -0
  39. package/dist/src/mobile/android/advancedSecurity/externalTools/semgrep/index.js +2 -0
  40. package/dist/src/mobile/android/advancedSecurity/externalTools/semgrep/parseSemgrepJson.js +141 -0
  41. package/dist/src/mobile/android/advancedSecurity/externalTools/semgrep/rules.js +105 -0
  42. package/dist/src/mobile/android/advancedSecurity/externalTools/types.js +107 -0
  43. package/dist/src/mobile/android/advancedSecurity/fileProvider/checkResult.js +188 -0
  44. package/dist/src/mobile/android/advancedSecurity/fileProvider/index.js +1 -0
  45. package/dist/src/mobile/android/advancedSecurity/firebaseGoogle/analyzeFirebaseGoogleServices.js +197 -0
  46. package/dist/src/mobile/android/advancedSecurity/firebaseGoogle/checkResult.js +77 -0
  47. package/dist/src/mobile/android/advancedSecurity/firebaseGoogle/collectFirebaseServiceEvidence.js +193 -0
  48. package/dist/src/mobile/android/advancedSecurity/firebaseGoogle/discoverFirebaseArtifacts.js +128 -0
  49. package/dist/src/mobile/android/advancedSecurity/firebaseGoogle/index.js +1 -0
  50. package/dist/src/mobile/android/advancedSecurity/firebaseGoogle/parseDatabaseRules.js +55 -0
  51. package/dist/src/mobile/android/advancedSecurity/firebaseGoogle/parseFirebaseConfig.js +75 -0
  52. package/dist/src/mobile/android/advancedSecurity/firebaseGoogle/parseFirestoreStorageRules.js +88 -0
  53. package/dist/src/mobile/android/advancedSecurity/firebaseGoogle/parseGoogleServicesConfig.js +55 -0
  54. package/dist/src/mobile/android/advancedSecurity/firebaseGoogle/types.js +6 -0
  55. package/dist/src/mobile/android/advancedSecurity/networkSecurity/analyzeNetworkSecurity.js +394 -0
  56. package/dist/src/mobile/android/advancedSecurity/networkSecurity/checkResult.js +47 -0
  57. package/dist/src/mobile/android/advancedSecurity/networkSecurity/deriveEffectiveNetworkPolicy.js +52 -0
  58. package/dist/src/mobile/android/advancedSecurity/networkSecurity/index.js +14 -0
  59. package/dist/src/mobile/android/advancedSecurity/networkSecurity/manifestEvidence.js +109 -0
  60. package/dist/src/mobile/android/advancedSecurity/networkSecurity/parseNetworkSecurityConfig.js +186 -0
  61. package/dist/src/mobile/android/advancedSecurity/networkSecurity/types.js +1 -0
  62. package/dist/src/mobile/android/advancedSecurity/ordering.js +44 -0
  63. package/dist/src/mobile/android/advancedSecurity/redaction.js +54 -0
  64. package/dist/src/mobile/android/advancedSecurity/releaseConfiguration/analyzeReleaseConfiguration.js +221 -0
  65. package/dist/src/mobile/android/advancedSecurity/releaseConfiguration/checkResult.js +39 -0
  66. package/dist/src/mobile/android/advancedSecurity/releaseConfiguration/index.js +7 -0
  67. package/dist/src/mobile/android/advancedSecurity/releaseConfiguration/manifestEvidence.js +19 -0
  68. package/dist/src/mobile/android/advancedSecurity/resourceReference.js +69 -0
  69. package/dist/src/mobile/android/advancedSecurity/resourceResolution.js +118 -0
  70. package/dist/src/mobile/android/advancedSecurity/ruleIds.js +141 -0
  71. package/dist/src/mobile/android/advancedSecurity/secretCandidates/analyzeSecretCandidates.js +116 -0
  72. package/dist/src/mobile/android/advancedSecurity/secretCandidates/checkResult.js +80 -0
  73. package/dist/src/mobile/android/advancedSecurity/secretCandidates/discoverSecretSourceFiles.js +152 -0
  74. package/dist/src/mobile/android/advancedSecurity/secretCandidates/index.js +9 -0
  75. package/dist/src/mobile/android/advancedSecurity/secretCandidates/matchSecretCandidates.js +136 -0
  76. package/dist/src/mobile/android/advancedSecurity/secretCandidates/suppressValue.js +61 -0
  77. package/dist/src/mobile/android/advancedSecurity/secretCandidates/types.js +11 -0
  78. package/dist/src/mobile/android/advancedSecurity/sensitiveCategories.js +34 -0
  79. package/dist/src/mobile/android/advancedSecurity/sensitiveData/classifyDirectExpression.js +99 -0
  80. package/dist/src/mobile/android/advancedSecurity/sensitiveData/classifySensitiveIdentifier.js +111 -0
  81. package/dist/src/mobile/android/advancedSecurity/sensitiveData/index.js +3 -0
  82. package/dist/src/mobile/android/advancedSecurity/sensitiveData/localSourceContext.js +90 -0
  83. package/dist/src/mobile/android/advancedSecurity/sensitiveData/splitArguments.js +59 -0
  84. package/dist/src/mobile/android/advancedSecurity/sensitiveLogging/analyzeSensitiveLogging.js +117 -0
  85. package/dist/src/mobile/android/advancedSecurity/sensitiveLogging/checkResult.js +74 -0
  86. package/dist/src/mobile/android/advancedSecurity/sensitiveLogging/collectLoggingEvidence.js +87 -0
  87. package/dist/src/mobile/android/advancedSecurity/sensitiveLogging/index.js +1 -0
  88. package/dist/src/mobile/android/advancedSecurity/sensitiveLogging/types.js +1 -0
  89. package/dist/src/mobile/android/advancedSecurity/sensitiveStorage/analyzeSensitiveStorage.js +182 -0
  90. package/dist/src/mobile/android/advancedSecurity/sensitiveStorage/checkResult.js +74 -0
  91. package/dist/src/mobile/android/advancedSecurity/sensitiveStorage/collectStorageEvidence.js +109 -0
  92. package/dist/src/mobile/android/advancedSecurity/sensitiveStorage/index.js +1 -0
  93. package/dist/src/mobile/android/advancedSecurity/sensitiveStorage/types.js +4 -0
  94. package/dist/src/mobile/android/advancedSecurity/signingConfiguration/analyzeSigningConfiguration.js +270 -0
  95. package/dist/src/mobile/android/advancedSecurity/signingConfiguration/checkResult.js +119 -0
  96. package/dist/src/mobile/android/advancedSecurity/signingConfiguration/discoverKeystoreCandidates.js +55 -0
  97. package/dist/src/mobile/android/advancedSecurity/signingConfiguration/extractSigningConfigurations.js +81 -0
  98. package/dist/src/mobile/android/advancedSecurity/signingConfiguration/index.js +8 -0
  99. package/dist/src/mobile/android/advancedSecurity/signingConfiguration/types.js +20 -0
  100. package/dist/src/mobile/android/advancedSecurity/sourceLocation.js +15 -0
  101. package/dist/src/mobile/android/advancedSecurity/webview/checkResult.js +210 -0
  102. package/dist/src/mobile/android/advancedSecurity/webview/index.js +1 -0
  103. package/dist/src/mobile/android/audit/androidFinding.js +68 -0
  104. package/dist/src/mobile/android/audit/checkResultBuilder.js +97 -0
  105. package/dist/src/mobile/android/audit/deepLinkAudit.js +183 -0
  106. package/dist/src/mobile/android/audit/exportedComponentAudit.js +183 -0
  107. package/dist/src/mobile/android/audit/intentFilterAudit.js +128 -0
  108. package/dist/src/mobile/android/audit/permissionAudit.js +142 -0
  109. package/dist/src/mobile/android/detect/androidTargetDetection.js +18 -0
  110. package/dist/src/mobile/android/detect/buildFileEvidence.js +36 -0
  111. package/dist/src/mobile/android/detect/classify.js +150 -0
  112. package/dist/src/mobile/android/detect/detectAndroidProject.js +252 -0
  113. package/dist/src/mobile/android/detect/settingsModules.js +60 -0
  114. package/dist/src/mobile/android/detect/sourceEvidence.js +92 -0
  115. package/dist/src/mobile/android/detect/traversal.js +79 -0
  116. package/dist/src/mobile/android/detect/versionCatalogEvidence.js +37 -0
  117. package/dist/src/mobile/android/detection.js +28 -0
  118. package/dist/src/mobile/android/gradle/gradleMetadataCheckResult.js +120 -0
  119. package/dist/src/mobile/android/gradle/moduleMetadataExtractor.js +243 -0
  120. package/dist/src/mobile/android/gradle/pluginVersionExtractor.js +40 -0
  121. package/dist/src/mobile/android/gradle/readAndroidGradleMetadata.js +210 -0
  122. package/dist/src/mobile/android/gradle/releaseMetadataSummary.js +64 -0
  123. package/dist/src/mobile/android/gradle/settingsMetadata.js +20 -0
  124. package/dist/src/mobile/android/gradle/types.js +1 -0
  125. package/dist/src/mobile/android/gradle/validate/executor.js +9 -0
  126. package/dist/src/mobile/android/gradle/validate/operationCheckResult.js +99 -0
  127. package/dist/src/mobile/android/gradle/validate/operations.js +68 -0
  128. package/dist/src/mobile/android/gradle/validate/planner.js +49 -0
  129. package/dist/src/mobile/android/gradle/validate/runOptionalGradleValidation.js +113 -0
  130. package/dist/src/mobile/android/gradle/validate/targetMutation.js +45 -0
  131. package/dist/src/mobile/android/gradle/validate/taskListParser.js +24 -0
  132. package/dist/src/mobile/android/gradle/versionCatalogMetadata.js +94 -0
  133. package/dist/src/mobile/android/gradle/wrapperMetadata.js +32 -0
  134. package/dist/src/mobile/android/manifest/parseAndroidManifest.js +364 -0
  135. package/dist/src/mobile/android/manifest/types.js +29 -0
  136. package/dist/src/mobile/android/manifest/xml/parseXml.js +329 -0
  137. package/dist/src/mobile/android/profile.js +29 -0
  138. package/dist/src/mobile/android/report/model.js +135 -0
  139. package/dist/src/mobile/android/report/renderAndroidReport.js +286 -0
  140. package/dist/src/mobile/android/report/writeAndroidReportFiles.js +23 -0
  141. package/dist/src/mobile/android/targetMetadata.js +27 -0
  142. package/dist/src/mobile/android/validate/androidVerdict.js +248 -0
  143. package/dist/src/mobile/android/validate/detectionAndImmutabilityCheckResults.js +177 -0
  144. package/dist/src/mobile/android/validate/playReadinessChecklist.js +145 -0
  145. package/dist/src/mobile/android/validate/validateAndroidTarget.js +315 -0
  146. package/dist/src/mobile/android/validation/checkResult.js +58 -0
  147. package/dist/src/mobile/android/validation/result.js +25 -0
  148. package/dist/src/mobile/index.js +42 -0
  149. package/dist/src/mobile/types.js +27 -0
  150. package/dist/src/securityValidation/attackScenarios/attackProfile.js +2 -0
  151. package/dist/src/securityValidation/attackScenarios/profiles/androidProfile.js +20 -0
  152. package/dist/src/securityValidation/commandRunner.js +10 -1
  153. package/dist/src/securityValidation/validate/cliOptions.js +92 -2
  154. package/package.json +2 -1
  155. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/debug/res/xml/ambiguous_backup_rules.xml +4 -0
  156. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/ambiguous_backup_rules.xml +4 -0
  157. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/backup_rules.xml +5 -0
  158. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/broad_backup_rules.xml +4 -0
  159. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/data_extraction_rules.xml +10 -0
  160. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-a/src/main/res/xml/unsupported_domain_rules.xml +4 -0
  161. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-b/src/main/res/xml/malformed_backup_rules.xml +4 -0
  162. package/tests/fixtures/android/advanced-security-fixtures/backup-configuration/module-b/src/main/res/xml/unsupported_root.xml +4 -0
  163. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/debug/res/xml/ambiguous_config.xml +4 -0
  164. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/ambiguous_config.xml +4 -0
  165. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/base_cleartext_false.xml +8 -0
  166. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/broad_and_duplicate_domains.xml +8 -0
  167. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/empty_domain.xml +6 -0
  168. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/malformed_pin.xml +11 -0
  169. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-a/src/main/res/xml/network_security_config.xml +26 -0
  170. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-b/src/main/res/xml/malformed_network_security_config.xml +6 -0
  171. package/tests/fixtures/android/advanced-security-fixtures/network-security/module-b/src/main/res/xml/unsupported_root.xml +4 -0
  172. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/groovy-release-debuggable-dynamic.gradle +7 -0
  173. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/groovy-release-debuggable-false.gradle +9 -0
  174. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/groovy-release-debuggable-true.gradle +13 -0
  175. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/kotlin-release-debuggable-false.gradle.kts +7 -0
  176. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/kotlin-release-debuggable-true.gradle.kts +10 -0
  177. package/tests/fixtures/android/advanced-security-fixtures/release-configuration/missing-release-build-type.gradle.kts +7 -0
  178. package/tests/fixtures/android/advanced-security-fixtures/resource-resolution/module-a/src/debug/res/xml/network_security_config.xml +8 -0
  179. package/tests/fixtures/android/advanced-security-fixtures/resource-resolution/module-a/src/main/res/xml/backup_rules.xml +4 -0
  180. package/tests/fixtures/android/advanced-security-fixtures/resource-resolution/module-a/src/main/res/xml/network_security_config.xml +8 -0
  181. package/tests/fixtures/android/advanced-security-fixtures/resource-resolution/module-b/src/main/res/xml/malformed_network_security_config.xml +7 -0
  182. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/SampleActivity.java +8 -0
  183. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/SampleActivity.kt +9 -0
  184. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/build.gradle +11 -0
  185. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/build.gradle.kts +11 -0
  186. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/google-services.json +16 -0
  187. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates/local.properties +3 -0
  188. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates-bounds/module/binary.properties +0 -0
  189. package/tests/fixtures/android/advanced-security-fixtures/secret-candidates-bounds/module/oversized.json +1 -0
  190. package/tests/fixtures/android/advanced-security-fixtures/signing-configuration/app/fake-release-keystore.jks +1 -0
  191. package/tests/fixtures/android/advanced-security-fixtures/signing-configuration/build/generated-fake.keystore +1 -0
  192. package/tests/fixtures/android/compose-app/app/build.gradle.kts +21 -0
  193. package/tests/fixtures/android/compose-app/app/src/main/AndroidManifest.xml +22 -0
  194. package/tests/fixtures/android/compose-app/app/src/main/java/com/example/composeapp/MainActivity.kt +11 -0
  195. package/tests/fixtures/android/compose-app/build.gradle.kts +4 -0
  196. package/tests/fixtures/android/compose-app/gradle/wrapper/gradle-wrapper.properties +4 -0
  197. package/tests/fixtures/android/compose-app/settings.gradle.kts +2 -0
  198. package/tests/fixtures/android/gradle-metadata-fixtures/catalog-only-plugin/build.gradle.kts +3 -0
  199. package/tests/fixtures/android/gradle-metadata-fixtures/catalog-only-plugin/gradle/libs.versions.toml +5 -0
  200. package/tests/fixtures/android/gradle-metadata-fixtures/comment-safety.gradle.kts +21 -0
  201. package/tests/fixtures/android/gradle-metadata-fixtures/dynamic-values.gradle.kts +17 -0
  202. package/tests/fixtures/android/gradle-metadata-fixtures/groovy-literal.gradle +23 -0
  203. package/tests/fixtures/android/gradle-metadata-fixtures/wrapper-malformed.properties +4 -0
  204. package/tests/fixtures/android/gradle-metadata-fixtures/wrapper-missing-url.properties +3 -0
  205. package/tests/fixtures/android/gradle-metadata-fixtures/wrapper-with-checksum.properties +5 -0
  206. package/tests/fixtures/android/java-app/app/build.gradle +16 -0
  207. package/tests/fixtures/android/java-app/app/src/main/AndroidManifest.xml +19 -0
  208. package/tests/fixtures/android/java-app/app/src/main/java/com/example/javaapp/MainActivity.java +4 -0
  209. package/tests/fixtures/android/java-app/build.gradle +3 -0
  210. package/tests/fixtures/android/java-app/gradle/wrapper/gradle-wrapper.properties +4 -0
  211. package/tests/fixtures/android/java-app/settings.gradle +2 -0
  212. package/tests/fixtures/android/library/build.gradle.kts +3 -0
  213. package/tests/fixtures/android/library/gradle/wrapper/gradle-wrapper.properties +4 -0
  214. package/tests/fixtures/android/library/mylibrary/build.gradle.kts +13 -0
  215. package/tests/fixtures/android/library/mylibrary/src/main/AndroidManifest.xml +2 -0
  216. package/tests/fixtures/android/library/settings.gradle.kts +2 -0
  217. package/tests/fixtures/android/manifest-audit-fixtures/incomplete-intent-filter.xml +14 -0
  218. package/tests/fixtures/android/manifest-audit-fixtures/malformed-exported.xml +10 -0
  219. package/tests/fixtures/android/manifest-audit-fixtures/malformed.xml +5 -0
  220. package/tests/fixtures/android/manifest-audit-fixtures/missing-application.xml +7 -0
  221. package/tests/fixtures/android/manifest-audit-fixtures/missing-component-name.xml +11 -0
  222. package/tests/fixtures/android/manifest-audit-fixtures/permission-coverage.xml +29 -0
  223. package/tests/fixtures/android/manifest-audit-fixtures/risky-components.xml +62 -0
  224. package/tests/fixtures/android/manifest-audit-fixtures/risky-deep-links.xml +45 -0
  225. package/tests/fixtures/android/manifest-audit-fixtures/unresolved-placeholder.xml +14 -0
  226. package/tests/fixtures/android/manifest-audit-fixtures/unusual-namespace-prefix.xml +11 -0
  227. package/tests/fixtures/android/multi-module/app/build.gradle.kts +22 -0
  228. package/tests/fixtures/android/multi-module/app/src/androidTest/java/com/example/multimodule/app/ExampleInstrumentedTest.kt +3 -0
  229. package/tests/fixtures/android/multi-module/app/src/main/AndroidManifest.xml +11 -0
  230. package/tests/fixtures/android/multi-module/app/src/test/java/com/example/multimodule/app/ExampleUnitTest.kt +3 -0
  231. package/tests/fixtures/android/multi-module/build.gradle.kts +5 -0
  232. package/tests/fixtures/android/multi-module/core/build.gradle.kts +14 -0
  233. package/tests/fixtures/android/multi-module/core/src/main/AndroidManifest.xml +2 -0
  234. package/tests/fixtures/android/multi-module/feature-login/build.gradle.kts +18 -0
  235. package/tests/fixtures/android/multi-module/feature-login/src/main/AndroidManifest.xml +2 -0
  236. package/tests/fixtures/android/multi-module/gradle/libs.versions.toml +8 -0
  237. package/tests/fixtures/android/multi-module/gradle/wrapper/gradle-wrapper.properties +4 -0
  238. package/tests/fixtures/android/multi-module/settings.gradle.kts +4 -0
  239. package/tests/fixtures/android/non-android-gradle/build.gradle.kts +3 -0
  240. package/tests/fixtures/android/non-android-gradle/core/build.gradle.kts +3 -0
  241. package/tests/fixtures/android/non-android-gradle/core/src/main/java/com/example/core/Core.java +4 -0
  242. package/tests/fixtures/android/non-android-gradle/gradle/wrapper/gradle-wrapper.properties +4 -0
  243. package/tests/fixtures/android/non-android-gradle/settings.gradle.kts +2 -0
  244. package/tests/fixtures/android/partial/app/build.gradle.kts +7 -0
  245. package/tests/fixtures/android/partial/settings.gradle.kts +2 -0
  246. package/tests/fixtures/android/xml-view-app/app/build.gradle.kts +17 -0
  247. package/tests/fixtures/android/xml-view-app/app/src/main/AndroidManifest.xml +31 -0
  248. package/tests/fixtures/android/xml-view-app/app/src/main/kotlin/com/example/xmlviewapp/MainActivity.kt +7 -0
  249. package/tests/fixtures/android/xml-view-app/app/src/main/res/layout/activity_main.xml +4 -0
  250. package/tests/fixtures/android/xml-view-app/build.gradle.kts +4 -0
  251. package/tests/fixtures/android/xml-view-app/gradle/wrapper/gradle-wrapper.properties +4 -0
  252. package/tests/fixtures/android/xml-view-app/settings.gradle.kts +2 -0
package/README.md CHANGED
@@ -1,302 +1,27 @@
1
1
  # my-dev-kit-lab
2
2
 
3
- my-dev-kit-lab is the experiment, evidence, reporting, security-validation, and audit companion for my-dev-kit. It runs reproducible experiments that test whether my-dev-kit's graph-guided retrieval helps coding-agent workflows, collects metrics, renders reports, generates plots, captures screenshots, builds gallery outputs, performs automated CLI/package security validation, and runs the generic audit framework.
3
+ my-dev-kit-lab is the experiment, evidence, reporting, visualization, audit, and security-validation companion for my-dev-kit. It provides controlled retrieval experiments, deterministic demonstrations, reports, plots, galleries, generic audits, and local security-validation workflows.
4
4
 
5
- The current published baseline is `v0.3.3`. `v0.3.0` introduced the generic audit framework and the first implemented code-rot detector family; `v0.3.1` added the language-aware code-rot substrate plus TypeScript/JavaScript support; `v0.3.2` added Python-aware code-rot support and a first security-validation audit adapter; `v0.3.3` adds Java/Kotlin source-facts support and JVM-aware code-rot detector integration. The generic experiment-plugin framework was introduced in `v0.2.0`. The first plugin is `context-strategy-comparison`, which preserves the existing raw-full-file vs my-dev-kit-guided workflow through the plugin runner.
5
+ ## Version state
6
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.
7
+ `v0.4.1` is the published baseline, with the advanced Android implementation released. `v0.4.0` is the previous published baseline. `v0.4.2` remains future work.
8
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
- ---
15
-
16
- ## Current capabilities
17
-
18
- - Benchmark projects at small, medium, and large complexity levels
19
- - Project complexity metrics and benchmark case metadata with answer keys
20
- - Prompt variant generation at `short`, `medium`, `long`, and `multi-step` complexity levels
21
- - Fake-agent adapter for deterministic smoke and demo validation
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
- ---
59
-
60
- ## Quickstart
61
-
62
- ### Install
63
-
64
- ```bash
65
- npm install
66
- ```
9
+ ## Android validation
67
10
 
68
11
  ```powershell
69
- npm install
70
- ```
71
-
72
- `cmd.exe` users should run the same command on one line.
73
-
74
- ### Build
75
-
76
- ```bash
77
- npm run build
12
+ npm run security:validate -- --target "<android-project-path>" --profile android
78
13
  ```
79
14
 
80
- ### Verify the installation
81
-
82
- ```bash
83
- npm run verify
84
- ```
85
-
86
- ### Run the fake-agent final demo (deterministic, no external CLIs required)
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
- ```
97
-
98
- ```powershell
99
- npm run run-final-demo -- `
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
106
- ```
107
-
108
- ```bat
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
- ```
111
-
112
- The lab resolves Windows `.cmd` and `.ps1` CLI shims, supports command paths with spaces, and keeps generated artifacts inside the requested output directory.
113
-
114
- This runs a full pipeline: controlled experiment → report → plots → visualization demos → gallery.
115
-
116
- ### Run a real-agent campaign (requires Codex or Claude CLI)
117
-
118
- ```bash
119
- npm run run-controlled-experiment -- \
120
- --cases examples/real-agent-campaign-cases.json \
121
- --agents codex,claude \
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
- ```
129
-
130
- Real-agent runs require local Codex or Claude CLI setup and available usage capacity. Runs that time out, produce invalid output, or hit session limits are recorded as structured outcomes rather than failures.
131
-
132
- ### List, describe, and run experiment plugins
133
-
134
- ```bash
135
- npm run experiment:list
136
- npm run experiment:describe -- --experiment context-strategy-comparison
137
- npm run experiment:run -- \
138
- --experiment context-strategy-comparison \
139
- --target /path/to/local/project \
140
- --agents fake-agent \
141
- --complexities short \
142
- --no-screenshot
143
- ```
144
-
145
- ```powershell
146
- npm run experiment:list
147
- npm run experiment:describe -- --experiment context-strategy-comparison
148
- npm run experiment:run -- `
149
- --experiment context-strategy-comparison `
150
- --target "Z:\Users\newuser\Projects\my-dev-kit-v1" `
151
- --agents fake-agent `
152
- --complexities short `
153
- --no-screenshot
154
- ```
155
-
156
- When `--target` is omitted, the experiment runs in self mode against my-dev-kit-lab. When `--target <path>` is provided, the lab remains the tool root and the target project is inspected separately. Generated experiment outputs stay under lab-controlled output directories by default, not inside the target project.
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.
15
+ The default Android profile runs nineteen checks: the original eight checks plus eleven advanced internal checks for Network Security Config, backup/data extraction, release configuration, secret candidates, signing configuration, WebView, FileProvider, sensitive storage, sensitive logging, clipboard, and Firebase/Google services. It runs zero Gradle operations, zero external tools, and zero network operations by default.
283
16
 
284
- If this project helps your workflow, you can support continued development through GitHub Sponsors or PayPal:
17
+ `SecurityFinding` records confirmed conservative evidence. `CandidateEvidence` remains separate review or unresolved evidence and is not a confirmed vulnerability. Text and JSON reports under `reports/security/` include advanced-security checks, external-tool results, candidate-evidence summaries, artifacts, mutation evidence, verdict reasons, and limitations.
285
18
 
286
- - [Sponsor on GitHub](https://github.com/sponsors/dailephd)
287
- - [Support via PayPal](https://paypal.me/daile88)
19
+ Optional Gradle operations use `--android-gradle-operations` and only accept `wrapper-version`, `tasks`, `assemble-debug`, `unit-test-debug`, and `lint-debug`. They are environment-dependent, record mutations, and never perform cleanup or arbitrary tasks.
288
20
 
289
- Support is optional and does not affect access to the project.
21
+ Optional external tools use `--android-external-tools semgrep,osv,android-lint,dependency-check`. Network defaults to `--android-external-network deny`; `allow-requested` authorizes only requested supported network-capable tools. Semgrep uses package-owned local rules, Android Lint reuses the closed offline Gradle path, Dependency-Check disables updates, and OSV requires explicit network authorization. Tools are never installed automatically; unavailable requested tools are skipped or inconclusive, not clean passes.
290
22
 
291
- ---
23
+ Verdicts are `not-ready-security-blocker-remains`, `inconclusive-audit-environment-incomplete`, `ready-except-optional-manual-checks`, and `ready-for-release-preparation`. They are evidence states, not runtime, Play, publication, or pentest guarantees.
292
24
 
293
- ## Documentation
25
+ Selected local references such as supported `@xml` resources are resolved conservatively. Manifests are not merged, full overlay precedence and Gradle evaluation are not implemented, whole-program flow is not performed, and APK/AAB, signing, emulator/device, remote Firebase, live Play policy, and manual pentest validation remain outside scope.
294
26
 
295
- - [docs/PROJECT_OVERVIEW.md](docs/PROJECT_OVERVIEW.md) — product purpose and target users
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
27
+ See [Project overview](docs/PROJECT_OVERVIEW.md), [Commands](docs/COMMANDS.md), [Workflows](docs/WORKFLOWS.md), [Architecture](docs/ARCHITECTURE.md), and [Roadmap](docs/ROADMAP.md).
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import path from "node:path";
2
3
  import { runSecurityValidation } from "../../src/securityValidation/validate/runSecurityValidation.js";
3
4
  import { resolveValidationTarget, reportFilenamePrefix } from "../../src/securityValidation/validate/resolveTarget.js";
4
5
  import { buildSecurityReportFromSummary } from "../../src/securityValidation/report/buildSecurityReport.js";
@@ -8,12 +9,53 @@ import { parseSecurityValidateArgs, normalizeSecurityValidateConfig, applyProfil
8
9
  import { resolveAttackProfile } from "../../src/securityValidation/attackScenarios/attackProfile.js";
9
10
  import { findingsBreachFailOnThreshold } from "../../src/securityValidation/validate/verdict.js";
10
11
  import { resolveToolRoot } from "./resolveToolRoot.js";
12
+ import { validateAndroidTarget } from "../../src/mobile/android/validate/validateAndroidTarget.js";
13
+ import { toAndroidReportModel } from "../../src/mobile/android/report/model.js";
14
+ import { renderAndroidTextReport } from "../../src/mobile/android/report/renderAndroidReport.js";
15
+ import { writeAndroidReportFiles } from "../../src/mobile/android/report/writeAndroidReportFiles.js";
11
16
  const USAGE = "Usage: npm run security:validate -- [--target <path>] [--out <dir>] [--report-prefix <name>] " +
12
17
  "[--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]";
18
+ "[--profile node-cli-package|local-tool|npm-package|android] [--format text,json] [--fail-on blocker|high|medium|low] " +
19
+ "[--android-gradle-operations wrapper-version,tasks,assemble-debug,unit-test-debug,lint-debug] " +
20
+ "[--android-external-tools semgrep,osv,android-lint,dependency-check] " +
21
+ "[--android-external-network deny|allow-requested]\n" +
22
+ "\n" +
23
+ "Android profile:\n" +
24
+ " --profile android performs static, read-only Android project detection, manifest parsing,\n" +
25
+ " permission/exported-component/intent-filter/deep-link audits, static Gradle metadata\n" +
26
+ " extraction, and (as of v0.4.1 Batch 8) eleven internal advanced security checks (network\n" +
27
+ " security config, backup/release configuration, hardcoded secrets, signing configuration,\n" +
28
+ " WebView, FileProvider, sensitive storage/logging, clipboard, and Firebase/Google services).\n" +
29
+ " Gradle and external tools are never executed by default.\n" +
30
+ " --android-gradle-operations explicitly opts into running ONLY the listed allowlisted Gradle\n" +
31
+ " operations (wrapper-version, tasks, assemble-debug, unit-test-debug, lint-debug) via the\n" +
32
+ " project's own Gradle wrapper. Arbitrary Gradle tasks cannot be passed. This option is only\n" +
33
+ " valid together with --profile android.\n" +
34
+ " --android-external-tools explicitly opts into running ONLY the listed allowlisted optional\n" +
35
+ " external security tools (semgrep, osv, android-lint, dependency-check). No arbitrary tool\n" +
36
+ " names, commands, or arguments can be passed. This option is only valid together with\n" +
37
+ " --profile android.\n" +
38
+ " --android-external-network controls whether a requested tool may use network access.\n" +
39
+ " Defaults to deny (osv is skipped unless supported offline data is available; semgrep,\n" +
40
+ " android-lint, and dependency-check always run offline/no-update regardless of this flag).\n" +
41
+ " allow-requested authorizes network only for an explicitly requested tool whose Batch 7\n" +
42
+ " contract supports it (currently only osv). This option is only valid together with\n" +
43
+ " --profile android.\n" +
44
+ " Example: npm run security:validate -- --target \"<android-project-path>\" --profile android\n" +
45
+ " Example: npm run security:validate -- --target \"<android-project-path>\" --profile android --android-gradle-operations wrapper-version,tasks\n" +
46
+ " Example: npm run security:validate -- --target \"<android-project-path>\" --profile android --android-external-tools semgrep,android-lint\n" +
47
+ " Example: npm run security:validate -- --target \"<android-project-path>\" --profile android --android-external-tools osv --android-external-network allow-requested";
14
48
  // Parse CLI arguments from process.argv (after the node/tsx and script path).
15
49
  const rawArgs = process.argv.slice(2);
16
50
  const toolRoot = resolveToolRoot(import.meta.url);
51
+ // Help deliberately wins over every other argument. It must remain a
52
+ // no-work path: no target/default resolution, option normalization, report
53
+ // directory creation, validation orchestration, or subprocess execution.
54
+ if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
55
+ console.log(USAGE);
56
+ process.exitCode = 0;
57
+ process.exit(0);
58
+ }
17
59
  let args;
18
60
  let config;
19
61
  try {
@@ -22,15 +64,18 @@ try {
22
64
  // v0.2.2 Batch 5: --profile with no --checks uses that profile's declared
23
65
  // default checks. No-op unless the user passed --profile without --checks
24
66
  // (see applyProfileDefaultChecksIfApplicable's guard) — the true no-flag
25
- // case and any explicit --checks case are always unaffected.
26
- config = applyProfileDefaultChecksIfApplicable(config, resolveAttackProfile(config.profile).defaultCheckIds);
67
+ // case and any explicit --checks case are always unaffected. Skipped for
68
+ // "android": that profile does not use the classic --checks pipeline.
69
+ if (config.profile !== "android") {
70
+ config = applyProfileDefaultChecksIfApplicable(config, resolveAttackProfile(config.profile).defaultCheckIds);
71
+ }
27
72
  }
28
73
  catch (err) {
29
74
  const msg = err instanceof Error ? err.message : String(err);
30
75
  console.error(`\nERROR: ${msg}`);
31
76
  console.error(USAGE);
32
- process.exitCode = 1;
33
- process.exit(1);
77
+ process.exitCode = 2;
78
+ process.exit(2);
34
79
  }
35
80
  // Resolve and validate target early so we can fail fast with a clean error.
36
81
  let target;
@@ -56,71 +101,166 @@ if (!target.isSelf) {
56
101
  else {
57
102
  console.log(`Mode : self-validation`);
58
103
  }
59
- if (!config.checksWereDefault) {
60
- console.log(`Checks : ${config.checks.join(", ")}`);
61
- }
62
- if (config.plannedChecksRequested.length > 0) {
63
- 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.`);
64
- }
65
- console.log("");
66
- const summary = await runSecurityValidation({
67
- cwd: toolRoot,
68
- targetPath: args.target,
69
- fuzzIterations: parseInt(process.env["FUZZ_ITERATIONS"] ?? "50", 10),
70
- fuzzSeed: parseInt(process.env["FUZZ_SEED"] ?? "0xDEADBEEF", 16),
71
- // Full selection (implemented + planned/attack-scenario ids) — the runner
72
- // gates both implemented check groups and attack-scenario checks off the
73
- // same selectedChecks set.
74
- selectedChecks: config.checks,
75
- profile: config.profile,
76
- });
77
- // v0.2.2 Batch 5: --fail-on breach is additive to (never a substitute for)
78
- // the existing verdict-based exit decision below — it can only escalate
79
- // exit 0 to exit 1 (e.g. --fail-on medium/low catching minor/informational
80
- // findings the verdict policy doesn't already treat as blocking), never
81
- // downgrade an existing blocker.
82
- const failOnBreached = findingsBreachFailOnThreshold(summary.findings, config.failOnThreshold);
83
- // Build report object
84
- const report = buildSecurityReportFromSummary(summary, {
85
- profile: config.profile,
86
- selectedChecks: config.checks,
87
- failOnThreshold: config.failOnThreshold,
88
- formats: config.formats,
89
- failOnBreached,
90
- });
91
- const textReport = renderTextReport(report);
92
- // Determine output directory
93
- const reportsDir = config.out;
94
- // Determine report filename prefix
95
- const prefix = args.reportPrefix ?? reportFilenamePrefix(target);
96
- const { textPath: txtPath, jsonPath, writtenPaths } = writeSecurityReportFiles({
97
- outDir: reportsDir,
98
- prefix,
99
- report,
100
- formats: config.formats,
101
- });
102
- // Print report to stdout
103
- console.log(textReport);
104
- console.log(`\nReports written:`);
105
- for (const p of writtenPaths) {
106
- console.log(` ${p}`);
107
- }
108
- // Exit code based on verdict, escalated (never downgraded) by --fail-on.
109
- const blockerExists = summary.verdict === "not-ready-security-blocker-remains";
110
- const inconclusive = summary.verdict === "inconclusive-audit-environment-incomplete";
111
- if (blockerExists) {
112
- console.error("\nExit 1 — security blocker remains.");
113
- process.exitCode = 1;
114
- }
115
- else if (inconclusive) {
116
- console.warn("\nExit 2 — audit environment incomplete.");
117
- process.exitCode = 2;
118
- }
119
- else if (failOnBreached) {
120
- console.error(`\nExit 1 — --fail-on ${config.failOnThreshold} threshold breached.`);
121
- process.exitCode = 1;
104
+ console.log(`Profile : ${config.profile}`);
105
+ // ---------------------------------------------------------------------------
106
+ // v0.4.0 Batch 5 — Android profile path.
107
+ //
108
+ // A separate orchestrator (not the classic check-group/attack-scenario
109
+ // pipeline below) because the Android check/finding/status vocabulary
110
+ // established in Batches 1-4 does not fit SecurityCheckId/SecurityCheckResult.
111
+ // Same command, same --profile flag, same reports/security/ output root.
112
+ // ---------------------------------------------------------------------------
113
+ if (config.profile === "android") {
114
+ if (config.androidGradleOperationIds.length > 0) {
115
+ console.log(`Gradle ops : ${config.androidGradleOperationIds.join(", ")} (explicitly requested — will execute via the target's Gradle wrapper)`);
116
+ }
117
+ else {
118
+ console.log(`Gradle ops : (none requested — static-only validation, zero Gradle process execution)`);
119
+ }
120
+ // v0.4.1 Batch 8 — external tools remain explicit opt-in, mirroring Gradle
121
+ // operations exactly. "allow-requested" (the CLI-facing value) maps to the
122
+ // Batch 7 dispatcher's "allow-for-requested-tool" network policy value.
123
+ const externalNetworkPolicy = config.androidExternalNetworkPolicy === "allow-requested" ? "allow-for-requested-tool" : "deny";
124
+ if (config.androidExternalToolIds.length > 0) {
125
+ console.log(`External : ${config.androidExternalToolIds.join(", ")} (explicitly requested — network policy: ${config.androidExternalNetworkPolicy})`);
126
+ }
127
+ else {
128
+ console.log(`External : (none requested — zero external-tool process execution)`);
129
+ }
130
+ console.log("");
131
+ const reportsDir = config.out;
132
+ let result;
133
+ try {
134
+ result = await validateAndroidTarget({
135
+ toolRoot,
136
+ targetPath: args.target,
137
+ requestedGradleOperationIds: config.androidGradleOperationIds,
138
+ requestedExternalToolIds: config.androidExternalToolIds,
139
+ externalNetworkPolicy: externalNetworkPolicy,
140
+ externalToolArtifactRoot: path.join(reportsDir, "external-tools"),
141
+ });
142
+ }
143
+ catch (err) {
144
+ const msg = err instanceof Error ? err.message : String(err);
145
+ console.error(`\nERROR: Android validation failed to run: ${msg}`);
146
+ process.exitCode = 3;
147
+ process.exit(3);
148
+ }
149
+ const reportModel = toAndroidReportModel(result, {
150
+ profile: config.profile,
151
+ requestedGradleOperations: config.androidGradleOperationIds,
152
+ requestedExternalTools: config.androidExternalToolIds,
153
+ externalNetworkPolicy: config.androidExternalNetworkPolicy,
154
+ });
155
+ const textReport = renderAndroidTextReport(reportModel);
156
+ const prefix = args.reportPrefix ??
157
+ reportFilenamePrefix({
158
+ isSelf: result.target.local.isSelf,
159
+ packageName: result.target.local.packageName,
160
+ packageVersion: result.target.local.packageVersion,
161
+ targetRoot: result.target.local.targetRoot,
162
+ });
163
+ let writtenPaths;
164
+ try {
165
+ ({ writtenPaths } = writeAndroidReportFiles({ outDir: reportsDir, prefix, report: reportModel, formats: config.formats }));
166
+ }
167
+ catch (err) {
168
+ const msg = err instanceof Error ? err.message : String(err);
169
+ console.error(`\nERROR: Failed to write Android report files: ${msg}`);
170
+ console.error("Validation completed but the report could not be written. The in-memory result was not persisted.");
171
+ process.exitCode = 4;
172
+ process.exit(4);
173
+ }
174
+ console.log(textReport);
175
+ console.log(`\nReports written:`);
176
+ for (const p of writtenPaths) {
177
+ console.log(` ${p}`);
178
+ }
179
+ const blockerExists = result.verdict === "not-ready-security-blocker-remains";
180
+ const inconclusive = result.verdict === "inconclusive-audit-environment-incomplete";
181
+ if (blockerExists) {
182
+ console.error("\nExit 1 — security blocker remains.");
183
+ process.exitCode = 1;
184
+ }
185
+ else if (inconclusive) {
186
+ console.warn("\nExit 2 — android environment incomplete.");
187
+ process.exitCode = 2;
188
+ }
189
+ else {
190
+ console.log("\nExit 0 — validation completed.");
191
+ process.exitCode = 0;
192
+ }
122
193
  }
123
194
  else {
124
- console.log("\nExit 0 — validation completed.");
125
- process.exitCode = 0;
195
+ // ---------------------------------------------------------------------------
196
+ // Classic check-group/attack-scenario pipeline (unchanged from prior versions).
197
+ // ---------------------------------------------------------------------------
198
+ if (!config.checksWereDefault) {
199
+ console.log(`Checks : ${config.checks.join(", ")}`);
200
+ }
201
+ if (config.plannedChecksRequested.length > 0) {
202
+ 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.`);
203
+ }
204
+ console.log("");
205
+ const summary = await runSecurityValidation({
206
+ cwd: toolRoot,
207
+ targetPath: args.target,
208
+ fuzzIterations: parseInt(process.env["FUZZ_ITERATIONS"] ?? "50", 10),
209
+ fuzzSeed: parseInt(process.env["FUZZ_SEED"] ?? "0xDEADBEEF", 16),
210
+ // Full selection (implemented + planned/attack-scenario ids) — the runner
211
+ // gates both implemented check groups and attack-scenario checks off the
212
+ // same selectedChecks set.
213
+ selectedChecks: config.checks,
214
+ profile: config.profile,
215
+ });
216
+ // v0.2.2 Batch 5: --fail-on breach is additive to (never a substitute for)
217
+ // the existing verdict-based exit decision below — it can only escalate
218
+ // exit 0 to exit 1 (e.g. --fail-on medium/low catching minor/informational
219
+ // findings the verdict policy doesn't already treat as blocking), never
220
+ // downgrade an existing blocker.
221
+ const failOnBreached = findingsBreachFailOnThreshold(summary.findings, config.failOnThreshold);
222
+ // Build report object
223
+ const report = buildSecurityReportFromSummary(summary, {
224
+ profile: config.profile,
225
+ selectedChecks: config.checks,
226
+ failOnThreshold: config.failOnThreshold,
227
+ formats: config.formats,
228
+ failOnBreached,
229
+ });
230
+ const textReport = renderTextReport(report);
231
+ // Determine output directory
232
+ const reportsDir = config.out;
233
+ // Determine report filename prefix
234
+ const prefix = args.reportPrefix ?? reportFilenamePrefix(target);
235
+ const { writtenPaths } = writeSecurityReportFiles({
236
+ outDir: reportsDir,
237
+ prefix,
238
+ report,
239
+ formats: config.formats,
240
+ });
241
+ // Print report to stdout
242
+ console.log(textReport);
243
+ console.log(`\nReports written:`);
244
+ for (const p of writtenPaths) {
245
+ console.log(` ${p}`);
246
+ }
247
+ // Exit code based on verdict, escalated (never downgraded) by --fail-on.
248
+ const blockerExists = summary.verdict === "not-ready-security-blocker-remains";
249
+ const inconclusive = summary.verdict === "inconclusive-audit-environment-incomplete";
250
+ if (blockerExists) {
251
+ console.error("\nExit 1 — security blocker remains.");
252
+ process.exitCode = 1;
253
+ }
254
+ else if (inconclusive) {
255
+ console.warn("\nExit 2 — audit environment incomplete.");
256
+ process.exitCode = 2;
257
+ }
258
+ else if (failOnBreached) {
259
+ console.error(`\nExit 1 — --fail-on ${config.failOnThreshold} threshold breached.`);
260
+ process.exitCode = 1;
261
+ }
262
+ else {
263
+ console.log("\nExit 0 — validation completed.");
264
+ process.exitCode = 0;
265
+ }
126
266
  }