@hoanghainh/komagu 1.8.0 → 2.0.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 (210) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +1 -1
  3. package/assess/lsa/CHANGELOG.md +6 -0
  4. package/assess/lsa/VERSION +1 -1
  5. package/assess/lsa/adapters/build_adapters.py +16 -8
  6. package/assess/lsa/adapters/codex/README.md +1 -1
  7. package/assess/lsa/adapters/generic/README.md +1 -1
  8. package/assess/lsa/examples/eval-run-4/ground-truth.json +823 -0
  9. package/assess/lsa/examples/eval-run-4/iter0-gptoss-a/ai-run-stats.json +58 -0
  10. package/assess/lsa/examples/eval-run-4/iter0-gptoss-a/coverage.json +85 -0
  11. package/assess/lsa/examples/eval-run-4/iter0-gptoss-a/findings/priv-privilege-001.json +822 -0
  12. package/assess/lsa/examples/eval-run-4/iter0-gptoss-a/findings/priv-privilege-002.json +393 -0
  13. package/assess/lsa/examples/eval-run-4/iter0-gptoss-a/findings.json +4477 -0
  14. package/assess/lsa/examples/eval-run-4/iter0-gptoss-a/mass-assignment.candidates.json +232 -0
  15. package/assess/lsa/examples/eval-run-4/iter0-gptoss-a/routes/routes-001.json +425 -0
  16. package/assess/lsa/examples/eval-run-4/iter0-gptoss-a/routes/routes-002.json +333 -0
  17. package/assess/lsa/examples/eval-run-4/iter0-gptoss-a/routes/routes-003.json +400 -0
  18. package/assess/lsa/examples/eval-run-4/iter0-gptoss-a/routes/routes-004.json +403 -0
  19. package/assess/lsa/examples/eval-run-4/iter0-gptoss-a/routes/routes-005.json +398 -0
  20. package/assess/lsa/examples/eval-run-4/iter0-gptoss-a/routes/routes-006.json +63 -0
  21. package/assess/lsa/examples/eval-run-4/iter0-gptoss-a/score.json +120 -0
  22. package/assess/lsa/examples/eval-run-4/iter1-gptoss-a/ai-run-stats.json +55 -0
  23. package/assess/lsa/examples/eval-run-4/iter1-gptoss-a/coverage.json +50 -0
  24. package/assess/lsa/examples/eval-run-4/iter1-gptoss-a/findings/priv-privilege-001.json +613 -0
  25. package/assess/lsa/examples/eval-run-4/iter1-gptoss-a/findings/priv-privilege-002.json +287 -0
  26. package/assess/lsa/examples/eval-run-4/iter1-gptoss-a/findings.json +4870 -0
  27. package/assess/lsa/examples/eval-run-4/iter1-gptoss-a/mass-assignment.candidates.json +232 -0
  28. package/assess/lsa/examples/eval-run-4/iter1-gptoss-a/routes/routes-001.json +425 -0
  29. package/assess/lsa/examples/eval-run-4/iter1-gptoss-a/routes/routes-002.json +333 -0
  30. package/assess/lsa/examples/eval-run-4/iter1-gptoss-a/routes/routes-003.json +400 -0
  31. package/assess/lsa/examples/eval-run-4/iter1-gptoss-a/routes/routes-004.json +403 -0
  32. package/assess/lsa/examples/eval-run-4/iter1-gptoss-a/routes/routes-005.json +398 -0
  33. package/assess/lsa/examples/eval-run-4/iter1-gptoss-a/routes/routes-006.json +63 -0
  34. package/assess/lsa/examples/eval-run-4/iter1-gptoss-a/score.json +107 -0
  35. package/assess/lsa/examples/eval-run-4/iter1-gptoss-b/ai-run-stats.json +58 -0
  36. package/assess/lsa/examples/eval-run-4/iter1-gptoss-b/coverage.json +92 -0
  37. package/assess/lsa/examples/eval-run-4/iter1-gptoss-b/findings/priv-privilege-001.json +645 -0
  38. package/assess/lsa/examples/eval-run-4/iter1-gptoss-b/findings/priv-privilege-002.json +222 -0
  39. package/assess/lsa/examples/eval-run-4/iter1-gptoss-b/findings.json +4859 -0
  40. package/assess/lsa/examples/eval-run-4/iter1-gptoss-b/mass-assignment.candidates.json +232 -0
  41. package/assess/lsa/examples/eval-run-4/iter1-gptoss-b/routes/routes-001.json +425 -0
  42. package/assess/lsa/examples/eval-run-4/iter1-gptoss-b/routes/routes-002.json +333 -0
  43. package/assess/lsa/examples/eval-run-4/iter1-gptoss-b/routes/routes-003.json +400 -0
  44. package/assess/lsa/examples/eval-run-4/iter1-gptoss-b/routes/routes-004.json +403 -0
  45. package/assess/lsa/examples/eval-run-4/iter1-gptoss-b/routes/routes-005.json +398 -0
  46. package/assess/lsa/examples/eval-run-4/iter1-gptoss-b/routes/routes-006.json +63 -0
  47. package/assess/lsa/examples/eval-run-4/iter1-gptoss-b/score.json +121 -0
  48. package/assess/lsa/examples/eval-run-4/iter1-qwen-a-incomplete/coverage.json +111 -0
  49. package/assess/lsa/examples/eval-run-4/iter1-qwen-a-incomplete/findings/priv-privilege-001.json +6 -0
  50. package/assess/lsa/examples/eval-run-4/iter1-qwen-a-incomplete/findings/priv-privilege-002.json +344 -0
  51. package/assess/lsa/examples/eval-run-4/iter1-qwen-a-incomplete/findings.json +3544 -0
  52. package/assess/lsa/examples/eval-run-4/iter1-qwen-a-incomplete/mass-assignment.candidates.json +232 -0
  53. package/assess/lsa/examples/eval-run-4/iter1-qwen-a-incomplete/routes/routes-001.json +425 -0
  54. package/assess/lsa/examples/eval-run-4/iter1-qwen-a-incomplete/routes/routes-002.json +333 -0
  55. package/assess/lsa/examples/eval-run-4/iter1-qwen-a-incomplete/routes/routes-003.json +400 -0
  56. package/assess/lsa/examples/eval-run-4/iter1-qwen-a-incomplete/routes/routes-004.json +403 -0
  57. package/assess/lsa/examples/eval-run-4/iter1-qwen-a-incomplete/routes/routes-005.json +398 -0
  58. package/assess/lsa/examples/eval-run-4/iter1-qwen-a-incomplete/routes/routes-006.json +63 -0
  59. package/assess/lsa/examples/eval-run-4/iter1-qwen-a-incomplete/score.json +123 -0
  60. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/ai-run-stats.json +50 -0
  61. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/coverage.json +42 -0
  62. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/findings/priv-privilege-001.json +540 -0
  63. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/findings/priv-privilege-002.json +238 -0
  64. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/findings.json +4383 -0
  65. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/findings.sarif +8729 -0
  66. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/mass-assignment.candidates.json +232 -0
  67. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/report.ja.md +1911 -0
  68. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/report.md +1911 -0
  69. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/routes/routes-001.json +425 -0
  70. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/routes/routes-002.json +333 -0
  71. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/routes/routes-003.json +400 -0
  72. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/routes/routes-004.json +403 -0
  73. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/routes/routes-005.json +398 -0
  74. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/routes/routes-006.json +63 -0
  75. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/score.json +101 -0
  76. package/assess/lsa/examples/eval-run-4/iter2-gptoss-a/stack-profile.json +226 -0
  77. package/assess/lsa/examples/eval-run-4/iter2-gptoss-b/ai-run-stats.json +54 -0
  78. package/assess/lsa/examples/eval-run-4/iter2-gptoss-b/coverage.json +66 -0
  79. package/assess/lsa/examples/eval-run-4/iter2-gptoss-b/findings/priv-privilege-001.json +440 -0
  80. package/assess/lsa/examples/eval-run-4/iter2-gptoss-b/findings/priv-privilege-002.json +229 -0
  81. package/assess/lsa/examples/eval-run-4/iter2-gptoss-b/findings.json +3424 -0
  82. package/assess/lsa/examples/eval-run-4/iter2-gptoss-b/mass-assignment.candidates.json +232 -0
  83. package/assess/lsa/examples/eval-run-4/iter2-gptoss-b/routes/routes-001.json +425 -0
  84. package/assess/lsa/examples/eval-run-4/iter2-gptoss-b/routes/routes-002.json +333 -0
  85. package/assess/lsa/examples/eval-run-4/iter2-gptoss-b/routes/routes-003.json +400 -0
  86. package/assess/lsa/examples/eval-run-4/iter2-gptoss-b/routes/routes-004.json +403 -0
  87. package/assess/lsa/examples/eval-run-4/iter2-gptoss-b/routes/routes-005.json +398 -0
  88. package/assess/lsa/examples/eval-run-4/iter2-gptoss-b/routes/routes-006.json +63 -0
  89. package/assess/lsa/examples/eval-run-4/iter2-gptoss-b/score.json +120 -0
  90. package/assess/lsa/examples/eval-run-5/gptoss-a/ai-run-stats.json +88 -0
  91. package/assess/lsa/examples/eval-run-5/gptoss-a/coverage.json +36 -0
  92. package/assess/lsa/examples/eval-run-5/gptoss-a/findings/priv-privilege-001.json +530 -0
  93. package/assess/lsa/examples/eval-run-5/gptoss-a/findings/priv-privilege-002.json +248 -0
  94. package/assess/lsa/examples/eval-run-5/gptoss-a/findings.json +4766 -0
  95. package/assess/lsa/examples/eval-run-5/gptoss-a/findings.sarif +9326 -0
  96. package/assess/lsa/examples/eval-run-5/gptoss-a/mass-assignment.candidates.json +232 -0
  97. package/assess/lsa/examples/eval-run-5/gptoss-a/report.ja.md +2011 -0
  98. package/assess/lsa/examples/eval-run-5/gptoss-a/report.md +2011 -0
  99. package/assess/lsa/examples/eval-run-5/gptoss-a/routes/routes-001.json +425 -0
  100. package/assess/lsa/examples/eval-run-5/gptoss-a/routes/routes-002.json +333 -0
  101. package/assess/lsa/examples/eval-run-5/gptoss-a/routes/routes-003.json +400 -0
  102. package/assess/lsa/examples/eval-run-5/gptoss-a/routes/routes-004.json +403 -0
  103. package/assess/lsa/examples/eval-run-5/gptoss-a/routes/routes-005.json +398 -0
  104. package/assess/lsa/examples/eval-run-5/gptoss-a/routes/routes-006.json +63 -0
  105. package/assess/lsa/examples/eval-run-5/gptoss-a/score.json +80 -0
  106. package/assess/lsa/examples/eval-run-5/gptoss-a/stack-profile.json +226 -0
  107. package/assess/lsa/examples/eval-run-5/gptoss-b/ai-run-stats.json +83 -0
  108. package/assess/lsa/examples/eval-run-5/gptoss-b/coverage.json +44 -0
  109. package/assess/lsa/examples/eval-run-5/gptoss-b/findings/priv-privilege-001.json +579 -0
  110. package/assess/lsa/examples/eval-run-5/gptoss-b/findings/priv-privilege-002.json +268 -0
  111. package/assess/lsa/examples/eval-run-5/gptoss-b/findings.json +3913 -0
  112. package/assess/lsa/examples/eval-run-5/gptoss-b/mass-assignment.candidates.json +232 -0
  113. package/assess/lsa/examples/eval-run-5/gptoss-b/routes/routes-001.json +425 -0
  114. package/assess/lsa/examples/eval-run-5/gptoss-b/routes/routes-002.json +333 -0
  115. package/assess/lsa/examples/eval-run-5/gptoss-b/routes/routes-003.json +400 -0
  116. package/assess/lsa/examples/eval-run-5/gptoss-b/routes/routes-004.json +403 -0
  117. package/assess/lsa/examples/eval-run-5/gptoss-b/routes/routes-005.json +398 -0
  118. package/assess/lsa/examples/eval-run-5/gptoss-b/routes/routes-006.json +63 -0
  119. package/assess/lsa/examples/eval-run-5/gptoss-b/score.json +94 -0
  120. package/assess/lsa/examples/eval-run-5/ground-truth.json +823 -0
  121. package/assess/lsa/knowledge/severity-and-cwe.md +1 -1
  122. package/assess/lsa/prompts/35-privilege-auditor.md +3 -1
  123. package/assess/lsa/scripts/baseline.py +5 -2
  124. package/assess/lsa/scripts/findings_to_sarif.py +24 -1
  125. package/assess/lsa/tests/EVAL-RESULTS.md +156 -0
  126. package/assess/lsa/tests/score_findings.py +58 -0
  127. package/assess/lsa/tests/test_adapters.py +21 -2
  128. package/assess/lsa/tests/test_baseline.py +8 -0
  129. package/assess/lsa/tests/test_contract_groundwork.py +7 -7
  130. package/assess/lsa/tests/test_eval_run_4.py +73 -0
  131. package/assess/lsa/tests/test_eval_run_5.py +73 -0
  132. package/assess/lsa/tests/test_privilege_tier2.py +30 -0
  133. package/operate/ai/anchoring.py +130 -0
  134. package/operate/ai/client.py +13 -0
  135. package/operate/ai/context.py +105 -0
  136. package/operate/ai/runner.py +197 -69
  137. package/operate/cli/__init__.py +1 -1
  138. package/operate/cli/commands/scan.py +3 -8
  139. package/operate/cli/commands/test.py +1 -1
  140. package/operate/cli/env.py +4 -20
  141. package/operate/cross_user_tester/persona_matrix.py +5 -1
  142. package/operate/devsecops/pipeline.py +5 -5
  143. package/operate/exploit/generator.py +5 -1
  144. package/operate/lsa_sarif/lsa_to_sarif.py +24 -2
  145. package/operate/lsa_sarif/sarif_findings.py +96 -0
  146. package/operate/remediator/runner.py +1 -5
  147. package/operate/remediator/strategies.py +1 -1
  148. package/operate/tests/test_ai_anchoring.py +184 -0
  149. package/operate/tests/test_cli_baseline.py +1 -9
  150. package/operate/tests/test_cli_env.py +8 -29
  151. package/operate/tests/test_cross_user_pipeline.py +2 -2
  152. package/operate/tests/test_exploit_and_virtual_patch.py +3 -3
  153. package/operate/tests/test_headless_ai.py +148 -1
  154. package/operate/tests/test_npm_package.py +2 -16
  155. package/operate/tests/test_sarif_from_scan.py +156 -0
  156. package/package.json +2 -4
  157. package/remediate/authz/README.md +1 -1
  158. package/remediate/authz/dotnet/src/Komagu.Security.Authorization/DefaultKomaguAuthorizationService.cs +1 -1
  159. package/remediate/authz/dotnet/src/Komagu.Security.Authorization/SecurityAuditEvent.cs +2 -2
  160. package/remediate/authz/golang/authz.go +1 -1
  161. package/remediate/authz/nodejs/src/service.js +1 -1
  162. package/remediate/authz/nodejs/tests/test-authz.js +1 -1
  163. package/remediate/authz/patcher.py +3 -4
  164. package/remediate/authz/python/komagu_authz/models.py +2 -2
  165. package/remediate/authz/python/tests/test_fastapi_adapter.py +1 -1
  166. package/remediate/authz/python/tests/test_fastapi_d5_crosstest.py +1 -1
  167. package/remediate/authz/python/tests/test_python_authz.py +3 -3
  168. package/remediate/authz/spring/src/main/kotlin/io/komagu/security/authorization/DefaultKomaguSecurityManager.kt +1 -1
  169. package/remediate/authz/spring/src/main/kotlin/io/komagu/security/authorization/SecurityAuditEvent.kt +1 -2
  170. package/remediate/authz/tests/test_bola_patcher.py +1 -1
  171. package/remediate/edge/coraza/rules/coraza-crs-custom.conf +3 -4
  172. package/remediate/edge/coraza/virtual_patcher.py +4 -6
  173. package/remediate/edge/docker-compose.yml +1 -1
  174. package/remediate/ekyc/server/jpki_verifier.py +2 -8
  175. package/remediate/ekyc/server/tokenization.py +2 -8
  176. package/remediate/identity/README.md +5 -5
  177. package/remediate/identity/dotnet/src/Komagu.Security.Identity/KomaguOidcOptions.cs +2 -2
  178. package/remediate/identity/dotnet/tests/Komagu.Security.Identity.Tests/TestTokenGenerator.cs +1 -1
  179. package/remediate/identity/dotnet/tests/Komagu.Security.Identity.Tests/TokenValidationTests.cs +1 -1
  180. package/remediate/identity/python/komagu_identity/oidc_validator.py +2 -8
  181. package/remediate/identity/python/tests/test_oidc_validator.py +1 -1
  182. package/remediate/identity/spring/src/main/kotlin/io/komagu/security/identity/KomaguOidcProperties.kt +2 -2
  183. package/remediate/identity/spring/src/test/kotlin/io/komagu/security/identity/KomaguIdentityAutoConfigurationTest.kt +2 -2
  184. package/remediate/identity/spring/src/test/kotlin/io/komagu/security/identity/TestJwtFactory.kt +1 -1
  185. package/remediate/identity/spring/src/test/kotlin/io/komagu/security/identity/TokenValidationIntegrationTest.kt +1 -1
  186. package/remediate/identity/test-env/realm-komagu.json +1 -1
  187. package/remediate/legacy_shims/coldfusion/KomaguSecurityShim.cfc +5 -5
  188. package/remediate/query/README.md +1 -1
  189. package/remediate/query/dotnet/src/Komagu.Security.Query.Analyzers/DiagnosticIds.cs +1 -1
  190. package/remediate/query/dotnet/src/Komagu.Security.Query.Analyzers/Komagu.Security.Query.Analyzers.csproj +1 -1
  191. package/remediate/query/spring/src/main/kotlin/io/komagu/security/query/detekt/KomaguRuleSetProvider.kt +1 -1
  192. package/remediate/resilience/dr/dr_manager.py +2 -8
  193. package/remediate/resilience/dr/runbook.md +2 -2
  194. package/remediate/resilience/terraform/variables.tf +1 -1
  195. package/remediate/tenancy/audit/audit_trail.py +2 -8
  196. package/remediate/tenancy/crypto/byok_manager.py +2 -8
  197. package/remediate/tenancy/middleware/tenant_context.py +2 -8
  198. package/remediate/tenancy/sql/rls_isolation.sql +11 -11
  199. package/remediate/tenancy/sql/schema_per_tenant.sql +7 -7
  200. package/remediate/tenancy/test_sql_postgres.py +1 -1
  201. package/remediate/tenancy/tests/test_tenancy.py +4 -4
  202. package/bin/komainu +0 -16
  203. package/bin/komainu-legacy.js +0 -16
  204. package/remediate/ekyc/tests/test_legacy_env.py +0 -33
  205. package/remediate/identity/python/tests/test_legacy_env.py +0 -33
  206. package/remediate/identity/spring/src/main/kotlin/io/komagu/security/identity/LegacyKomainuPropertiesPostProcessor.kt +0 -60
  207. package/remediate/identity/spring/src/main/resources/META-INF/spring.factories +0 -2
  208. package/remediate/identity/spring/src/test/kotlin/io/komagu/security/identity/LegacyKomainuPropertiesPostProcessorTest.kt +0 -86
  209. package/remediate/resilience/tests/test_legacy_env.py +0 -33
  210. package/remediate/tenancy/tests/test_legacy_env.py +0 -49
@@ -0,0 +1,440 @@
1
+ {
2
+ "batch_id": "privilege-001",
3
+ "findings": [
4
+ {
5
+ "finding_id": "BFLA-R-0007-1",
6
+ "category": "bfla",
7
+ "subtype": "missing_role_check",
8
+ "title": "Authenticated users can delete any user",
9
+ "route_id": "R-0007",
10
+ "location": {
11
+ "file": "dotnet-mvc/Controllers/AdminController.cs",
12
+ "start_line": 11
13
+ },
14
+ "evidence": [
15
+ {
16
+ "file": "dotnet-mvc/Controllers/AdminController.cs",
17
+ "line": 12,
18
+ "why": "DeleteUser action has no role check; only [Authorize] allows any authenticated user"
19
+ }
20
+ ],
21
+ "impact": "Delete any user account",
22
+ "severity": "critical",
23
+ "confidence": "high",
24
+ "cwe": [
25
+ "CWE-285"
26
+ ],
27
+ "recommendation": "Add [Authorize(Roles=\"Admin\")] to DeleteUser",
28
+ "status": "unverified"
29
+ },
30
+ {
31
+ "finding_id": "BFLA-R-0009-1",
32
+ "category": "bfla",
33
+ "subtype": "missing_role_check",
34
+ "title": "Export users without role check",
35
+ "route_id": "R-0009",
36
+ "location": {
37
+ "file": "dotnet-mvc/Controllers/AdminController.cs",
38
+ "start_line": 30
39
+ },
40
+ "evidence": [
41
+ {
42
+ "file": "dotnet-mvc/Controllers/AdminController.cs",
43
+ "line": 32,
44
+ "why": "Export action uses Request.QueryString[\"isAdmin\"] to allow export; no role check"
45
+ }
46
+ ],
47
+ "impact": "Export all user data",
48
+ "severity": "critical",
49
+ "confidence": "high",
50
+ "cwe": [
51
+ "CWE-285"
52
+ ],
53
+ "recommendation": "Add role check before exporting data",
54
+ "status": "unverified"
55
+ },
56
+ {
57
+ "finding_id": "BFLA-R-0023-1",
58
+ "category": "bfla",
59
+ "subtype": "missing_role_check",
60
+ "title": "Delete user without admin check",
61
+ "route_id": "R-0023",
62
+ "location": {
63
+ "file": "java-spring/Controllers/AdminUserController.java",
64
+ "start_line": 13
65
+ },
66
+ "evidence": [
67
+ {
68
+ "file": "java-spring/Controllers/AdminUserController.java",
69
+ "line": 13,
70
+ "why": "Delete mapping has no @PreAuthorize; any authenticated user can delete"
71
+ }
72
+ ],
73
+ "impact": "Delete any user account",
74
+ "severity": "critical",
75
+ "confidence": "high",
76
+ "cwe": [
77
+ "CWE-285"
78
+ ],
79
+ "recommendation": "Add @PreAuthorize(\"hasRole('ADMIN')\") to delete method",
80
+ "status": "unverified"
81
+ },
82
+ {
83
+ "finding_id": "BFLA-R-0030-1",
84
+ "category": "bfla",
85
+ "subtype": "missing_role_check",
86
+ "title": "Delete user without admin check",
87
+ "route_id": "R-0030",
88
+ "location": {
89
+ "file": "node-express/routes.js",
90
+ "start_line": 8
91
+ },
92
+ "evidence": [
93
+ {
94
+ "file": "node-express/routes.js",
95
+ "line": 8,
96
+ "why": "Route uses ensureLoggedIn but no requireAdmin; any logged\u2011in user can delete"
97
+ }
98
+ ],
99
+ "impact": "Delete any user account",
100
+ "severity": "critical",
101
+ "confidence": "high",
102
+ "cwe": [
103
+ "CWE-285"
104
+ ],
105
+ "recommendation": "Add requireAdmin middleware to delete route",
106
+ "status": "unverified"
107
+ },
108
+ {
109
+ "finding_id": "BFLA-R-0032-1",
110
+ "category": "bfla",
111
+ "subtype": "missing_role_check",
112
+ "title": "Export reports without admin check",
113
+ "route_id": "R-0032",
114
+ "location": {
115
+ "file": "node-express/routes.js",
116
+ "start_line": 16
117
+ },
118
+ "evidence": [
119
+ {
120
+ "file": "node-express/routes.js",
121
+ "line": 16,
122
+ "why": "Export route uses ensureLoggedIn but no requireAdmin; any logged\u2011in user can export"
123
+ }
124
+ ],
125
+ "impact": "Export all report data",
126
+ "severity": "critical",
127
+ "confidence": "high",
128
+ "cwe": [
129
+ "CWE-285"
130
+ ],
131
+ "recommendation": "Add requireAdmin middleware to export route",
132
+ "status": "unverified"
133
+ },
134
+ {
135
+ "finding_id": "BFLA-R-0057-1",
136
+ "category": "bfla",
137
+ "subtype": "missing_role_check",
138
+ "title": "View user data without admin check",
139
+ "route_id": "R-0057",
140
+ "location": {
141
+ "file": "php-plain/admin.php",
142
+ "start_line": 6
143
+ },
144
+ "evidence": [
145
+ {
146
+ "file": "php-plain/admin.php",
147
+ "line": 6,
148
+ "why": "Case 'view' executes without any role check; any logged\u2011in user can view any user"
149
+ }
150
+ ],
151
+ "impact": "View any user record",
152
+ "severity": "critical",
153
+ "confidence": "high",
154
+ "cwe": [
155
+ "CWE-285"
156
+ ],
157
+ "recommendation": "Add checkRole('admin') before executing view logic",
158
+ "status": "unverified"
159
+ },
160
+ {
161
+ "finding_id": "BFLA-R-0058-1",
162
+ "category": "bfla",
163
+ "subtype": "missing_role_check",
164
+ "title": "Delete user without admin check",
165
+ "route_id": "R-0058",
166
+ "location": {
167
+ "file": "php-plain/admin.php",
168
+ "start_line": 10
169
+ },
170
+ "evidence": [
171
+ {
172
+ "file": "php-plain/admin.php",
173
+ "line": 10,
174
+ "why": "Case 'delete' executes without any role check; any logged\u2011in user can delete any user"
175
+ }
176
+ ],
177
+ "impact": "Delete any user account",
178
+ "severity": "critical",
179
+ "confidence": "high",
180
+ "cwe": [
181
+ "CWE-285"
182
+ ],
183
+ "recommendation": "Add checkRole('admin') before executing delete logic",
184
+ "status": "unverified"
185
+ },
186
+ {
187
+ "finding_id": "BFLA-R-0066-1",
188
+ "category": "bfla",
189
+ "subtype": "missing_role_check",
190
+ "title": "Delete user without admin check",
191
+ "route_id": "R-0066",
192
+ "location": {
193
+ "file": "php-plain/admin/delete_user.php",
194
+ "start_line": 1
195
+ },
196
+ "evidence": [
197
+ {
198
+ "file": "php-plain/admin/delete_user.php",
199
+ "line": 5,
200
+ "why": "Delete logic runs without any role check; any logged\u2011in user can delete any user"
201
+ }
202
+ ],
203
+ "impact": "Delete any user account",
204
+ "severity": "critical",
205
+ "confidence": "high",
206
+ "cwe": [
207
+ "CWE-285"
208
+ ],
209
+ "recommendation": "Add checkRole('admin') before executing delete logic",
210
+ "status": "unverified"
211
+ },
212
+ {
213
+ "finding_id": "BFLA-R-0067-1",
214
+ "category": "bfla",
215
+ "subtype": "missing_role_check",
216
+ "title": "Promote user without admin check",
217
+ "route_id": "R-0067",
218
+ "location": {
219
+ "file": "php-plain/admin/promote.php",
220
+ "start_line": 1
221
+ },
222
+ "evidence": [
223
+ {
224
+ "file": "php-plain/admin/promote.php",
225
+ "line": 5,
226
+ "why": "Role promotion runs without any role check; any logged\u2011in user can promote themselves"
227
+ }
228
+ ],
229
+ "impact": "Promote any user to admin",
230
+ "severity": "critical",
231
+ "confidence": "high",
232
+ "cwe": [
233
+ "CWE-285"
234
+ ],
235
+ "recommendation": "Add checkRole('admin') before executing promotion logic",
236
+ "status": "unverified"
237
+ },
238
+ {
239
+ "finding_id": "BFLA-R-0059-1",
240
+ "category": "bfla",
241
+ "subtype": "missing_role_check",
242
+ "title": "Delete user without admin check",
243
+ "route_id": "R-0059",
244
+ "location": {
245
+ "file": "php-plain/manage_users.php",
246
+ "start_line": 5
247
+ },
248
+ "evidence": [
249
+ {
250
+ "file": "php-plain/manage_users.php",
251
+ "line": 5,
252
+ "why": "POST handler deletes user without any role check; any logged\u2011in user can delete any user"
253
+ }
254
+ ],
255
+ "impact": "Delete any user account",
256
+ "severity": "critical",
257
+ "confidence": "high",
258
+ "cwe": [
259
+ "CWE-285"
260
+ ],
261
+ "recommendation": "Add checkRole('admin') before executing delete logic",
262
+ "status": "unverified"
263
+ },
264
+ {
265
+ "finding_id": "MASS-M-0011-1",
266
+ "category": "mass_assignment",
267
+ "subtype": "privileged_field_writable",
268
+ "title": "Profile update allows role change",
269
+ "candidate_id": "M-0011",
270
+ "location": {
271
+ "file": "php-plain/profile.php",
272
+ "start_line": 6
273
+ },
274
+ "evidence": [
275
+ {
276
+ "file": "php-plain/profile.php",
277
+ "line": 10,
278
+ "why": "$user->role = $_POST['role']; no restriction on role field"
279
+ }
280
+ ],
281
+ "impact": "Privilege escalation via role field",
282
+ "severity": "high",
283
+ "confidence": "high",
284
+ "cwe": [
285
+ "CWE-915"
286
+ ],
287
+ "recommendation": "Do not bind role field from request; set role server\u2011side only",
288
+ "status": "unverified"
289
+ },
290
+ {
291
+ "finding_id": "MASS-M-0012-1",
292
+ "category": "mass_assignment",
293
+ "subtype": "privileged_field_writable",
294
+ "title": "Profile update allows role change",
295
+ "candidate_id": "M-0012",
296
+ "location": {
297
+ "file": "php-plain/profile.php",
298
+ "start_line": 6
299
+ },
300
+ "evidence": [
301
+ {
302
+ "file": "php-plain/profile.php",
303
+ "line": 10,
304
+ "why": "$user->role = $_POST['role']; no restriction on role field"
305
+ }
306
+ ],
307
+ "impact": "Privilege escalation via role field",
308
+ "severity": "high",
309
+ "confidence": "high",
310
+ "cwe": [
311
+ "CWE-915"
312
+ ],
313
+ "recommendation": "Do not bind role field from request; set role server\u2011side only",
314
+ "status": "unverified"
315
+ }
316
+ ],
317
+ "privilege_route_verdicts": [
318
+ {
319
+ "route_id": "R-0003",
320
+ "verdict": "safe",
321
+ "reason": "checkRole('admin') in php-plain/inc/auth.php:45"
322
+ },
323
+ {
324
+ "route_id": "R-0007",
325
+ "verdict": "vulnerable",
326
+ "finding_ids": [
327
+ "BFLA-R-0007-1"
328
+ ]
329
+ },
330
+ {
331
+ "route_id": "R-0009",
332
+ "verdict": "vulnerable",
333
+ "finding_ids": [
334
+ "BFLA-R-0009-1"
335
+ ]
336
+ },
337
+ {
338
+ "route_id": "R-0023",
339
+ "verdict": "vulnerable",
340
+ "finding_ids": [
341
+ "BFLA-R-0023-1"
342
+ ]
343
+ },
344
+ {
345
+ "route_id": "R-0030",
346
+ "verdict": "vulnerable",
347
+ "finding_ids": [
348
+ "BFLA-R-0030-1"
349
+ ]
350
+ },
351
+ {
352
+ "route_id": "R-0032",
353
+ "verdict": "vulnerable",
354
+ "finding_ids": [
355
+ "BFLA-R-0032-1"
356
+ ]
357
+ },
358
+ {
359
+ "route_id": "R-0057",
360
+ "verdict": "vulnerable",
361
+ "finding_ids": [
362
+ "BFLA-R-0057-1"
363
+ ]
364
+ },
365
+ {
366
+ "route_id": "R-0058",
367
+ "verdict": "vulnerable",
368
+ "finding_ids": [
369
+ "BFLA-R-0058-1"
370
+ ]
371
+ },
372
+ {
373
+ "route_id": "R-0066",
374
+ "verdict": "vulnerable",
375
+ "finding_ids": [
376
+ "BFLA-R-0066-1"
377
+ ]
378
+ },
379
+ {
380
+ "route_id": "R-0067",
381
+ "verdict": "vulnerable",
382
+ "finding_ids": [
383
+ "BFLA-R-0067-1"
384
+ ]
385
+ },
386
+ {
387
+ "route_id": "R-0059",
388
+ "verdict": "vulnerable",
389
+ "finding_ids": [
390
+ "BFLA-R-0059-1"
391
+ ]
392
+ },
393
+ {
394
+ "route_id": "R-0063",
395
+ "verdict": "safe",
396
+ "reason": "Profile update is user\u2011owned and does not modify privileged data"
397
+ }
398
+ ],
399
+ "candidate_verdicts": [
400
+ {
401
+ "candidate_id": "M-0011",
402
+ "verdict": "vulnerable",
403
+ "finding_ids": [
404
+ "MASS-M-0011-1"
405
+ ]
406
+ },
407
+ {
408
+ "candidate_id": "M-0012",
409
+ "verdict": "vulnerable",
410
+ "finding_ids": [
411
+ "MASS-M-0012-1"
412
+ ]
413
+ },
414
+ {
415
+ "candidate_id": "M-0001",
416
+ "verdict": "safe",
417
+ "reason": "No privileged fields in Customer model"
418
+ },
419
+ {
420
+ "candidate_id": "M-0002",
421
+ "verdict": "safe",
422
+ "reason": "No privileged fields in Customer model"
423
+ },
424
+ {
425
+ "candidate_id": "M-0003",
426
+ "verdict": "safe",
427
+ "reason": "No privileged fields in Account model"
428
+ },
429
+ {
430
+ "candidate_id": "M-0004",
431
+ "verdict": "safe",
432
+ "reason": "No privileged fields in Account model"
433
+ },
434
+ {
435
+ "candidate_id": "M-0005",
436
+ "verdict": "safe",
437
+ "reason": "No privileged fields in Account model"
438
+ }
439
+ ]
440
+ }
@@ -0,0 +1,229 @@
1
+ {
2
+ "batch_id": "privilege-002",
3
+ "findings": [
4
+ {
5
+ "finding_id": "MASS-M-0006-1",
6
+ "category": "mass_assignment",
7
+ "subtype": "whole_object_binding",
8
+ "title": "Unfiltered request body bound to User model in /profile",
9
+ "route_id": null,
10
+ "candidate_id": "M-0006",
11
+ "location": {
12
+ "file": "routes/user.js",
13
+ "start_line": 8
14
+ },
15
+ "evidence": [
16
+ {
17
+ "file": "routes/user.js",
18
+ "line": 8,
19
+ "why": "User.findByIdAndUpdate(req.user._id, req.body, ...) binds the entire request body to the User model without filtering privileged fields such as role."
20
+ }
21
+ ],
22
+ "impact": "Privilege escalation via the role field",
23
+ "severity": "critical",
24
+ "confidence": "high",
25
+ "cwe": [
26
+ "CWE-915"
27
+ ],
28
+ "recommendation": "Whitelist allowed fields or set privileged fields server\u2011side; do not bind the raw request body.",
29
+ "status": "unverified"
30
+ },
31
+ {
32
+ "finding_id": "MASS-M-0007-1",
33
+ "category": "mass_assignment",
34
+ "subtype": "whole_object_binding",
35
+ "title": "Unfiltered request body bound to User model in /profile",
36
+ "route_id": null,
37
+ "candidate_id": "M-0007",
38
+ "location": {
39
+ "file": "routes/user.js",
40
+ "start_line": 8
41
+ },
42
+ "evidence": [
43
+ {
44
+ "file": "routes/user.js",
45
+ "line": 8,
46
+ "why": "User.findByIdAndUpdate(req.user._id, req.body, ...) binds the entire request body to the User model without filtering privileged fields such as role."
47
+ }
48
+ ],
49
+ "impact": "Privilege escalation via the role field",
50
+ "severity": "critical",
51
+ "confidence": "high",
52
+ "cwe": [
53
+ "CWE-915"
54
+ ],
55
+ "recommendation": "Whitelist allowed fields or set privileged fields server\u2011side; do not bind the raw request body.",
56
+ "status": "unverified"
57
+ },
58
+ {
59
+ "finding_id": "MASS-M-0008-1",
60
+ "category": "mass_assignment",
61
+ "subtype": "whole_object_binding",
62
+ "title": "Unfiltered request body bound to User model in register",
63
+ "route_id": null,
64
+ "candidate_id": "M-0008",
65
+ "location": {
66
+ "file": "app/Http/Controllers/AccountController.php",
67
+ "start_line": 13
68
+ },
69
+ "evidence": [
70
+ {
71
+ "file": "app/Http/Controllers/AccountController.php",
72
+ "line": 13,
73
+ "why": "User::create($request->all()) binds all request fields to the User model, including privileged fields such as role."
74
+ }
75
+ ],
76
+ "impact": "Privilege escalation via the role field",
77
+ "severity": "critical",
78
+ "confidence": "high",
79
+ "cwe": [
80
+ "CWE-915"
81
+ ],
82
+ "recommendation": "Use a fillable/allowlist or explicitly set privileged fields server\u2011side.",
83
+ "status": "unverified"
84
+ },
85
+ {
86
+ "finding_id": "MASS-M-0009-1",
87
+ "category": "mass_assignment",
88
+ "subtype": "privileged_field_writable",
89
+ "title": "Owner ID writable in Team creation",
90
+ "route_id": null,
91
+ "candidate_id": "M-0009",
92
+ "location": {
93
+ "file": "app/Http/Controllers/AccountController.php",
94
+ "start_line": 23
95
+ },
96
+ "evidence": [
97
+ {
98
+ "file": "app/Http/Controllers/AccountController.php",
99
+ "line": 23,
100
+ "why": "Team::create($request->all()) allows the owner_id field to be set by the client."
101
+ }
102
+ ],
103
+ "impact": "Arbitrary ownership assignment via owner_id",
104
+ "severity": "critical",
105
+ "confidence": "high",
106
+ "cwe": [
107
+ "CWE-915"
108
+ ],
109
+ "recommendation": "Do not allow owner_id to be set by the client; set it server\u2011side based on the authenticated user.",
110
+ "status": "unverified"
111
+ },
112
+ {
113
+ "finding_id": "MASS-M-0010-1",
114
+ "category": "mass_assignment",
115
+ "subtype": "whole_object_binding",
116
+ "title": "Unfiltered request body bound to Team model in team",
117
+ "route_id": null,
118
+ "candidate_id": "M-0010",
119
+ "location": {
120
+ "file": "app/Http/Controllers/AccountController.php",
121
+ "start_line": 23
122
+ },
123
+ "evidence": [
124
+ {
125
+ "file": "app/Http/Controllers/AccountController.php",
126
+ "line": 23,
127
+ "why": "Team::create($request->all()) binds all request fields, including privileged fields such as owner_id."
128
+ }
129
+ ],
130
+ "impact": "Privilege escalation via owner_id",
131
+ "severity": "critical",
132
+ "confidence": "high",
133
+ "cwe": [
134
+ "CWE-915"
135
+ ],
136
+ "recommendation": "Whitelist allowed fields or set privileged fields server\u2011side.",
137
+ "status": "unverified"
138
+ },
139
+ {
140
+ "finding_id": "MASS-M-0015-1",
141
+ "category": "mass_assignment",
142
+ "subtype": "whole_object_binding",
143
+ "title": "Unfiltered request body bound to User in PATCH /users/<uid>",
144
+ "route_id": null,
145
+ "candidate_id": "M-0015",
146
+ "location": {
147
+ "file": "app.py",
148
+ "start_line": 27
149
+ },
150
+ "evidence": [
151
+ {
152
+ "file": "app.py",
153
+ "line": 27,
154
+ "why": "for key, value in request.json.items(): setattr(user, key, value) binds all fields, including privileged ones such as role."
155
+ }
156
+ ],
157
+ "impact": "Privilege escalation via the role field",
158
+ "severity": "critical",
159
+ "confidence": "high",
160
+ "cwe": [
161
+ "CWE-915"
162
+ ],
163
+ "recommendation": "Whitelist editable fields or set privileged fields server\u2011side.",
164
+ "status": "unverified"
165
+ },
166
+ {
167
+ "finding_id": "MASS-M-0014-1",
168
+ "category": "mass_assignment",
169
+ "subtype": "whole_object_binding",
170
+ "title": "Unfiltered request body bound to User in POST /users",
171
+ "route_id": null,
172
+ "candidate_id": "M-0014",
173
+ "location": {
174
+ "file": "app.py",
175
+ "start_line": 10
176
+ },
177
+ "evidence": [
178
+ {
179
+ "file": "app.py",
180
+ "line": 10,
181
+ "why": "User(**request.json) binds all request fields, including privileged ones such as role."
182
+ }
183
+ ],
184
+ "impact": "Privilege escalation via the role field",
185
+ "severity": "critical",
186
+ "confidence": "high",
187
+ "cwe": [
188
+ "CWE-915"
189
+ ],
190
+ "recommendation": "Whitelist allowed fields or set privileged fields server\u2011side.",
191
+ "status": "unverified"
192
+ }
193
+ ],
194
+ "privilege_route_verdicts": [],
195
+ "candidate_verdicts": [
196
+ {
197
+ "candidate_id": "M-0006",
198
+ "verdict": "vulnerable"
199
+ },
200
+ {
201
+ "candidate_id": "M-0007",
202
+ "verdict": "vulnerable"
203
+ },
204
+ {
205
+ "candidate_id": "M-0008",
206
+ "verdict": "vulnerable"
207
+ },
208
+ {
209
+ "candidate_id": "M-0009",
210
+ "verdict": "vulnerable"
211
+ },
212
+ {
213
+ "candidate_id": "M-0010",
214
+ "verdict": "vulnerable"
215
+ },
216
+ {
217
+ "candidate_id": "M-0015",
218
+ "verdict": "vulnerable"
219
+ },
220
+ {
221
+ "candidate_id": "M-0014",
222
+ "verdict": "vulnerable"
223
+ },
224
+ {
225
+ "candidate_id": "M-0013",
226
+ "verdict": "safe"
227
+ }
228
+ ]
229
+ }