dart-decimate 0.0.29 → 0.0.30

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 (70) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/README.md +36 -60
  4. package/npm/bin/runner.js +26 -14
  5. package/npm/scripts/postinstall.js +89 -63
  6. package/package.json +3 -2
  7. package/src/baseline.rs +38 -0
  8. package/src/cli/health_args.rs +36 -7
  9. package/src/cli/html_open.rs +4 -0
  10. package/src/cli/issue_filter_args.rs +1 -0
  11. package/src/cli/security_summary_run.rs +1 -0
  12. package/src/config/health.rs +22 -2
  13. package/src/config/rule_aliases.rs +43 -0
  14. package/src/config/rules.rs +46 -1
  15. package/src/config.rs +2 -1
  16. package/src/dart_parser/test_support.rs +51 -0
  17. package/src/dart_parser.rs +8 -0
  18. package/src/dependencies/analyze.rs +3 -1
  19. package/src/dependencies/tests.rs +111 -7
  20. package/src/dependencies/usage.rs +5 -1
  21. package/src/dependencies.rs +7 -3
  22. package/src/explain/flutter_style.rs +43 -0
  23. package/src/explain/misc.rs +72 -0
  24. package/src/explain.rs +23 -67
  25. package/src/flutter_style/scanner.rs +883 -0
  26. package/src/flutter_style/types.rs +90 -0
  27. package/src/flutter_style/usage.rs +349 -0
  28. package/src/flutter_style.rs +72 -0
  29. package/src/generated.rs +154 -0
  30. package/src/health/large_units.rs +49 -0
  31. package/src/health/tests.rs +212 -1
  32. package/src/health/threshold_types.rs +31 -1
  33. package/src/health/thresholds.rs +49 -0
  34. package/src/health/types.rs +35 -0
  35. package/src/health.rs +72 -6
  36. package/src/inspect.rs +8 -0
  37. package/src/lib.rs +17 -5
  38. package/src/manifest.rs +7 -3
  39. package/src/output/dependency_findings.rs +14 -1
  40. package/src/output/flutter_style.rs +189 -0
  41. package/src/output/health_findings.rs +93 -10
  42. package/src/output/health_inventory.rs +121 -0
  43. package/src/output/html/tests.rs +20 -0
  44. package/src/output/html.rs +10 -1
  45. package/src/output/human.rs +85 -1
  46. package/src/output/human_details.rs +93 -12
  47. package/src/output/scope.rs +62 -2
  48. package/src/output/security_findings.rs +101 -76
  49. package/src/output/security_sarif.rs +24 -13
  50. package/src/output/suppressions.rs +4 -0
  51. package/src/output/types.rs +38 -2
  52. package/src/output/verdict.rs +12 -0
  53. package/src/output.rs +77 -74
  54. package/src/report_schema/inventory.rs +268 -4
  55. package/src/report_schema.rs +94 -60
  56. package/src/security/catalogue.rs +103 -0
  57. package/src/security/detect/weak_randomness.rs +762 -0
  58. package/src/security/detect.rs +1535 -221
  59. package/src/security/security_matchers.toml +172 -0
  60. package/src/security/tests.rs +336 -2
  61. package/src/security.rs +292 -56
  62. package/src/security_gate.rs +28 -0
  63. package/src/semantic.rs +276 -0
  64. package/src/symbols/semantic_evidence.rs +342 -0
  65. package/src/symbols.rs +20 -10
  66. package/src/trace/rendering.rs +54 -0
  67. package/src/trace/semantic.rs +126 -0
  68. package/src/trace.rs +54 -62
  69. package/src/widgets/inheritance.rs +63 -0
  70. package/src/widgets.rs +33 -3
package/src/output.rs CHANGED
@@ -4,9 +4,11 @@ mod audit_risk;
4
4
  mod dependency_findings;
5
5
  mod duplication_findings;
6
6
  mod feature_flag_findings;
7
+ mod flutter_style;
7
8
  mod format;
8
9
  mod graph_findings;
9
10
  mod health_findings;
11
+ mod health_inventory;
10
12
  mod html;
11
13
  mod human;
12
14
  mod human_details;
@@ -20,6 +22,7 @@ mod security_sarif;
20
22
  mod suppressions;
21
23
  mod symbol_findings;
22
24
  mod types;
25
+ mod verdict;
23
26
  mod widget_findings;
24
27
 
25
28
  use crate::{
@@ -34,6 +37,7 @@ pub use duplication_findings::{JsonCloneGroup, JsonCloneInstance};
34
37
  use duplication_findings::{add_duplication_findings, json_clone_groups};
35
38
  pub use feature_flag_findings::{JsonFeatureFlag, JsonFeatureFlagOccurrence};
36
39
  use feature_flag_findings::{add_feature_flag_findings, json_feature_flags};
40
+ pub use flutter_style::{JsonFlutterStyleFinding, JsonThemeTokenEvidence};
37
41
  use graph_findings::{
38
42
  add_boundary_call_findings, add_boundary_findings, add_cycle_findings, add_dead_code_findings,
39
43
  add_part_of_findings, add_policy_findings, add_re_export_cycle_findings,
@@ -41,11 +45,16 @@ use graph_findings::{
41
45
  };
42
46
  pub use health_findings::{
43
47
  JsonComplexityContribution, JsonComplexityFinding, JsonEffectiveThresholds,
44
- JsonFileHealthScore, JsonHealthHotspot, JsonRefactoringTarget, JsonThresholdOverride,
48
+ JsonFileHealthScore, JsonHealthHotspot, JsonLargeFunction, JsonRefactoringTarget,
49
+ JsonThresholdOverride,
45
50
  };
46
51
  use health_findings::{
47
- add_health_findings, json_complexity, json_file_scores, json_hotspots,
48
- json_refactoring_targets, json_threshold_overrides,
52
+ add_health_findings, json_file_scores, json_hotspots, json_refactoring_targets,
53
+ };
54
+ use health_inventory::{
55
+ apply_aux_inventory_summary, apply_flutter_style_summary, apply_health_inventory_summary,
56
+ apply_semantic_summary, health_and_semantic_inventories, json_runtime_coverage_for,
57
+ json_threshold_overrides_for,
49
58
  };
50
59
  pub use html::{render_decision_surface_html_report, render_html_report};
51
60
  pub use human::render_human_report;
@@ -59,14 +68,14 @@ pub use runtime_coverage::{
59
68
  };
60
69
  use scope::{
61
70
  file_scope, finding_in_scope, health_file_score_count, project_file_scope_count,
62
- scope_attack_surface, scope_clone_groups, scope_complexity, scope_feature_flags,
63
- scope_file_scores, scope_hotspots, scope_refactoring_targets, scope_security_candidates,
64
- scoped_quality_score,
71
+ scope_clone_groups, scope_feature_flags, scope_file_scores, scope_hotspots,
72
+ scope_refactoring_targets, scoped_quality_score,
65
73
  };
66
74
  pub use security_findings::{
67
- JsonAttackSurfaceEntry, JsonSecurityCandidate, JsonSecurityOccurrence, JsonSecurityReachability,
75
+ JsonAttackSurfaceEntry, JsonSecurityBlindSpot, JsonSecurityCandidate, JsonSecurityOccurrence,
76
+ JsonSecurityReachability,
68
77
  };
69
- use security_findings::{add_security_findings, json_attack_surface, json_security_candidates};
78
+ use security_findings::{add_security_findings, json_security_inventories};
70
79
  pub(crate) use security_sarif::render_sarif_report;
71
80
  use suppressions::filter_suppressed_findings;
72
81
  use symbol_findings::add_symbol_findings;
@@ -74,6 +83,7 @@ pub use types::{
74
83
  AuditAttribution, AuditAttributionCounts, AuditRiskLevel, Finding, FindingAction, FindingEdge,
75
84
  FindingKind, JsonReport, NextStep, ReportCommand, ReportSummary, Severity, Verdict,
76
85
  };
86
+ use verdict::report_verdict;
77
87
  use widget_findings::add_widget_findings;
78
88
 
79
89
  /// Stable JSON schema version for agent consumers.
@@ -127,13 +137,11 @@ pub fn build_json_report(project: &ScannedProject, results: &AnalysisResults) ->
127
137
  .map_or_else(Vec::new, |report| json_clone_groups(&project.root, report)),
128
138
  scope.as_ref(),
129
139
  );
130
- let complexity = scope_complexity(
131
- results
132
- .health
133
- .as_ref()
134
- .map_or_else(Vec::new, |report| json_complexity(&project.root, report)),
135
- scope.as_ref(),
136
- );
140
+ let (complexity, large_functions, flutter_style, semantic) =
141
+ health_and_semantic_inventories(project, results, scope.as_ref());
142
+ summary.large_functions = large_functions.len();
143
+ apply_flutter_style_summary(&mut summary, &flutter_style);
144
+ apply_semantic_summary(&mut summary, semantic.as_ref());
137
145
  let file_scores = scope_file_scores(
138
146
  results
139
147
  .health
@@ -163,39 +171,28 @@ pub fn build_json_report(project: &ScannedProject, results: &AnalysisResults) ->
163
171
  .map_or_else(Vec::new, |report| json_feature_flags(&project.root, report)),
164
172
  scope.as_ref(),
165
173
  );
166
- let security_candidates = scope_security_candidates(
167
- results.security.as_ref().map_or_else(Vec::new, |report| {
168
- json_security_candidates(&project.root, report)
169
- }),
170
- scope.as_ref(),
171
- );
172
- let attack_surface = scope_attack_surface(
173
- results.security.as_ref().map_or_else(Vec::new, |report| {
174
- json_attack_surface(&project.root, report)
175
- }),
176
- scope.as_ref(),
177
- );
174
+ let security =
175
+ json_security_inventories(&project.root, results.security.as_ref(), scope.as_ref());
178
176
  let next_steps = if scope.is_some() {
179
177
  Vec::new()
180
178
  } else {
181
179
  next_steps(&project.root, results)
182
180
  };
183
181
  if scope.is_some() {
184
- summary.code_duplications = clone_groups.len();
185
- summary.file_scores = file_scores.len();
186
- summary.hotspots = hotspots.len();
187
- summary.refactoring_targets = refactoring_targets.len();
188
- summary.feature_flags = feature_flags.len();
189
- summary.feature_flag_occurrences = feature_flags
190
- .iter()
191
- .map(|flag| flag.occurrences.len())
192
- .sum();
193
- summary.security_candidates = security_candidates.len();
194
- summary.security_candidate_occurrences = security_candidates
195
- .iter()
196
- .map(|candidate| candidate.occurrences.len())
197
- .sum();
198
- summary.attack_surface = attack_surface.len();
182
+ apply_health_inventory_summary(
183
+ &mut summary,
184
+ &clone_groups,
185
+ &file_scores,
186
+ &hotspots,
187
+ &refactoring_targets,
188
+ );
189
+ apply_aux_inventory_summary(
190
+ &mut summary,
191
+ &feature_flags,
192
+ &security.candidates,
193
+ &security.blind_spots,
194
+ &security.attack_surface,
195
+ );
199
196
  }
200
197
 
201
198
  JsonReport {
@@ -208,13 +205,17 @@ pub fn build_json_report(project: &ScannedProject, results: &AnalysisResults) ->
208
205
  findings,
209
206
  clone_groups,
210
207
  complexity,
208
+ large_functions,
209
+ flutter_style,
210
+ semantic,
211
211
  file_scores,
212
212
  hotspots,
213
213
  refactoring_targets,
214
214
  threshold_overrides,
215
215
  feature_flags,
216
- security_candidates,
217
- attack_surface,
216
+ security_candidates: security.candidates,
217
+ security_blind_spots: security.blind_spots,
218
+ attack_surface: security.attack_surface,
218
219
  runtime_coverage,
219
220
  next_steps,
220
221
  }
@@ -233,53 +234,46 @@ pub fn filter_report_findings(report: &mut JsonReport, allowed: &[FindingKind])
233
234
  }
234
235
  if !allowed.iter().any(|kind| is_complexity_kind(*kind)) {
235
236
  report.complexity.clear();
237
+ report.large_functions.clear();
236
238
  report.file_scores.clear();
237
239
  report.hotspots.clear();
238
240
  report.refactoring_targets.clear();
239
241
  report.threshold_overrides.clear();
240
242
  report.runtime_coverage = None;
241
243
  }
244
+ if !allowed.iter().any(|kind| {
245
+ matches!(
246
+ kind,
247
+ FindingKind::RawFlutterStyleValue
248
+ | FindingKind::NearDuplicateThemeToken
249
+ | FindingKind::UnusedThemeExtensionToken
250
+ )
251
+ }) {
252
+ report.flutter_style.clear();
253
+ }
242
254
  if !allowed.contains(&FindingKind::FeatureFlag) {
243
255
  report.feature_flags.clear();
244
256
  }
245
257
  if !allowed.contains(&FindingKind::SecurityCandidate) {
246
258
  report.security_candidates.clear();
259
+ report.security_blind_spots.clear();
247
260
  report.attack_surface.clear();
261
+ report.summary.security_blind_spots = 0;
248
262
  }
249
263
  report.next_steps.clear();
250
264
  report.summary.findings = report.findings.len();
251
265
  apply_scoped_counts(&mut report.summary, &report.findings);
252
- report.verdict = report_verdict(&report.findings);
253
- }
254
-
255
- fn json_runtime_coverage_for(
256
- project: &ScannedProject,
257
- results: &AnalysisResults,
258
- ) -> Option<JsonRuntimeCoverage> {
259
- results.health.as_ref().and_then(|report| {
260
- report
261
- .runtime_coverage
262
- .as_ref()
263
- .map(|runtime| json_runtime_coverage(&project.root, runtime))
264
- })
265
- }
266
-
267
- fn json_threshold_overrides_for(results: &AnalysisResults) -> Vec<JsonThresholdOverride> {
268
- results
269
- .health
266
+ report.summary.large_functions = report.large_functions.len();
267
+ apply_flutter_style_summary(&mut report.summary, &report.flutter_style);
268
+ report.summary.semantic_evidence = report
269
+ .semantic
270
270
  .as_ref()
271
- .map_or_else(Vec::new, json_threshold_overrides)
272
- }
273
-
274
- fn report_verdict(findings: &[Finding]) -> Verdict {
275
- if findings
276
- .iter()
277
- .any(|finding| finding.severity == Severity::Error)
278
- {
279
- Verdict::Fail
280
- } else {
281
- Verdict::Pass
282
- }
271
+ .map_or(0, |semantic| semantic.evidence.len());
272
+ report.summary.type_couplings = report
273
+ .semantic
274
+ .as_ref()
275
+ .map_or(0, |semantic| semantic.type_couplings.len());
276
+ report.verdict = report_verdict(&report.findings);
283
277
  }
284
278
 
285
279
  fn report_findings(
@@ -409,6 +403,8 @@ fn apply_dependency_summary(
409
403
  .as_ref()
410
404
  .map_or(0, |report| report.unused_dependencies.len());
411
405
  summary.unused_dev_dependencies = kind_count(findings, FindingKind::UnusedDevDependency);
406
+ summary.dev_dependencies_in_production =
407
+ kind_count(findings, FindingKind::DevDependencyInProduction);
412
408
  summary.test_only_dependencies = kind_count(findings, FindingKind::TestOnlyDependency);
413
409
  summary.dependency_overrides = dependency_override_count(findings);
414
410
  summary.unused_dependency_overrides =
@@ -509,6 +505,10 @@ fn apply_security_summary(summary: &mut ReportSummary, results: &AnalysisResults
509
505
  .security
510
506
  .as_ref()
511
507
  .map_or(0, |report| report.total_occurrences);
508
+ summary.security_blind_spots = results
509
+ .security
510
+ .as_ref()
511
+ .map_or(0, |report| report.blind_spots.len());
512
512
  summary.attack_surface = results
513
513
  .security
514
514
  .as_ref()
@@ -582,6 +582,8 @@ fn apply_scoped_counts(summary: &mut ReportSummary, findings: &[Finding]) {
582
582
  summary.part_of_violations = kind_count(findings, FindingKind::PartOfViolation);
583
583
  summary.unused_dependencies = dependency_count(findings);
584
584
  summary.unused_dev_dependencies = kind_count(findings, FindingKind::UnusedDevDependency);
585
+ summary.dev_dependencies_in_production =
586
+ kind_count(findings, FindingKind::DevDependencyInProduction);
585
587
  summary.test_only_dependencies = kind_count(findings, FindingKind::TestOnlyDependency);
586
588
  summary.dependency_overrides = dependency_override_count(findings);
587
589
  summary.unused_dependency_overrides =
@@ -651,6 +653,7 @@ const fn is_dependency_hygiene_kind(kind: FindingKind) -> bool {
651
653
  kind,
652
654
  FindingKind::UnusedDependency
653
655
  | FindingKind::UnusedDevDependency
656
+ | FindingKind::DevDependencyInProduction
654
657
  | FindingKind::TestOnlyDependency
655
658
  | FindingKind::UnusedDependencyOverride
656
659
  )
@@ -86,6 +86,222 @@ pub(super) fn complexity_contribution_schema() -> Value {
86
86
  })
87
87
  }
88
88
 
89
+ pub(super) fn large_function_schema() -> Value {
90
+ json!({
91
+ "type": "object",
92
+ "additionalProperties": false,
93
+ "required": [
94
+ "rule_id",
95
+ "path",
96
+ "symbol",
97
+ "kind",
98
+ "line",
99
+ "column",
100
+ "end_line",
101
+ "line_count",
102
+ "max_unit_size",
103
+ "guidance"
104
+ ],
105
+ "properties": {
106
+ "rule_id": string_schema(),
107
+ "path": string_schema(),
108
+ "symbol": string_schema(),
109
+ "kind": string_schema(),
110
+ "line": positive_integer_schema(),
111
+ "column": nonnegative_integer_schema(),
112
+ "end_line": positive_integer_schema(),
113
+ "line_count": positive_integer_schema(),
114
+ "max_unit_size": positive_integer_schema(),
115
+ "threshold_source": nullable_string_schema(),
116
+ "threshold_reason": nullable_string_schema(),
117
+ "guidance": string_schema()
118
+ }
119
+ })
120
+ }
121
+
122
+ pub(super) fn flutter_style_finding_schema() -> Value {
123
+ json!({
124
+ "type": "object",
125
+ "additionalProperties": false,
126
+ "required": [
127
+ "rule_id",
128
+ "kind",
129
+ "path",
130
+ "line",
131
+ "column",
132
+ "value_kind",
133
+ "value",
134
+ "token",
135
+ "nearest_token",
136
+ "distance"
137
+ ],
138
+ "properties": {
139
+ "rule_id": string_schema(),
140
+ "kind": {
141
+ "type": "string",
142
+ "enum": [
143
+ "raw-flutter-style-value",
144
+ "near-duplicate-theme-token",
145
+ "unused-theme-extension-token"
146
+ ]
147
+ },
148
+ "path": string_schema(),
149
+ "line": positive_integer_schema(),
150
+ "column": nonnegative_integer_schema(),
151
+ "value_kind": { "type": "string", "enum": ["color", "text-style"] },
152
+ "value": nullable_string_schema(),
153
+ "token": nullable_ref_schema("theme_token_evidence"),
154
+ "nearest_token": nullable_ref_schema("theme_token_evidence"),
155
+ "distance": nullable_string_schema()
156
+ }
157
+ })
158
+ }
159
+
160
+ pub(super) fn theme_token_evidence_schema() -> Value {
161
+ json!({
162
+ "type": "object",
163
+ "additionalProperties": false,
164
+ "required": [
165
+ "name",
166
+ "path",
167
+ "line",
168
+ "column",
169
+ "value_kind",
170
+ "value",
171
+ "custom"
172
+ ],
173
+ "properties": {
174
+ "name": string_schema(),
175
+ "path": string_schema(),
176
+ "line": positive_integer_schema(),
177
+ "column": nonnegative_integer_schema(),
178
+ "value_kind": { "type": "string", "enum": ["color", "text-style"] },
179
+ "value": nullable_string_schema(),
180
+ "custom": { "type": "boolean" }
181
+ }
182
+ })
183
+ }
184
+
185
+ pub(super) fn semantic_report_schema() -> Value {
186
+ json!({
187
+ "type": "object",
188
+ "additionalProperties": false,
189
+ "required": [
190
+ "completeness",
191
+ "reasons",
192
+ "candidate_count",
193
+ "processed_candidates",
194
+ "omitted_candidates",
195
+ "capacity",
196
+ "evidence",
197
+ "type_couplings"
198
+ ],
199
+ "properties": {
200
+ "completeness": semantic_completeness_schema(),
201
+ "reasons": {
202
+ "type": "array",
203
+ "items": semantic_omission_reason_schema()
204
+ },
205
+ "candidate_count": nonnegative_integer_schema(),
206
+ "processed_candidates": nonnegative_integer_schema(),
207
+ "omitted_candidates": nonnegative_integer_schema(),
208
+ "capacity": positive_integer_schema(),
209
+ "evidence": array_ref_schema("semantic_evidence"),
210
+ "type_couplings": array_ref_schema("semantic_type_coupling")
211
+ }
212
+ })
213
+ }
214
+
215
+ pub(super) fn semantic_identity_schema() -> Value {
216
+ json!({
217
+ "type": "object",
218
+ "additionalProperties": false,
219
+ "required": [
220
+ "library_uri",
221
+ "path",
222
+ "kind",
223
+ "name",
224
+ "start_line",
225
+ "start_column",
226
+ "end_line"
227
+ ],
228
+ "properties": {
229
+ "library_uri": string_schema(),
230
+ "path": string_schema(),
231
+ "kind": string_schema(),
232
+ "name": string_schema(),
233
+ "start_line": positive_integer_schema(),
234
+ "start_column": nonnegative_integer_schema(),
235
+ "end_line": positive_integer_schema()
236
+ }
237
+ })
238
+ }
239
+
240
+ pub(super) fn semantic_evidence_schema() -> Value {
241
+ json!({
242
+ "type": "object",
243
+ "additionalProperties": false,
244
+ "required": ["subject", "decision", "reasons"],
245
+ "properties": {
246
+ "subject": { "$ref": "#/$defs/semantic_identity" },
247
+ "decision": semantic_decision_schema(),
248
+ "reasons": {
249
+ "type": "array",
250
+ "items": semantic_omission_reason_schema()
251
+ }
252
+ }
253
+ })
254
+ }
255
+
256
+ pub(super) fn semantic_type_coupling_schema() -> Value {
257
+ json!({
258
+ "type": "object",
259
+ "additionalProperties": false,
260
+ "required": [
261
+ "source",
262
+ "referenced_type",
263
+ "target",
264
+ "line",
265
+ "column",
266
+ "decision"
267
+ ],
268
+ "properties": {
269
+ "source": { "$ref": "#/$defs/semantic_identity" },
270
+ "referenced_type": string_schema(),
271
+ "target": { "$ref": "#/$defs/semantic_identity" },
272
+ "line": positive_integer_schema(),
273
+ "column": nonnegative_integer_schema(),
274
+ "decision": semantic_decision_schema()
275
+ }
276
+ })
277
+ }
278
+
279
+ fn semantic_completeness_schema() -> Value {
280
+ json!({ "type": "string", "enum": ["complete", "partial", "unavailable"] })
281
+ }
282
+
283
+ fn semantic_decision_schema() -> Value {
284
+ json!({
285
+ "type": "string",
286
+ "enum": ["confirmed", "retained-unresolved", "retained-abstained"]
287
+ })
288
+ }
289
+
290
+ fn semantic_omission_reason_schema() -> Value {
291
+ json!({
292
+ "type": "string",
293
+ "enum": [
294
+ "dynamic-access",
295
+ "generated-code",
296
+ "framework-registration",
297
+ "ambiguous-owner",
298
+ "parse-failure",
299
+ "capacity",
300
+ "unsupported-syntax"
301
+ ]
302
+ })
303
+ }
304
+
89
305
  pub(super) fn effective_thresholds_schema() -> Value {
90
306
  json!({
91
307
  "type": "object",
@@ -93,7 +309,8 @@ pub(super) fn effective_thresholds_schema() -> Value {
93
309
  "properties": {
94
310
  "max_cyclomatic": nonnegative_integer_schema(),
95
311
  "max_cognitive": nonnegative_integer_schema(),
96
- "max_crap": nonnegative_integer_schema()
312
+ "max_crap": nonnegative_integer_schema(),
313
+ "max_unit_size": nonnegative_integer_schema()
97
314
  }
98
315
  })
99
316
  }
@@ -233,11 +450,24 @@ pub(super) fn security_candidate_schema() -> Value {
233
450
  "candidate": {
234
451
  "type": "object",
235
452
  "additionalProperties": false,
236
- "required": ["source", "sink", "boundary"],
453
+ "required": [
454
+ "source",
455
+ "sink",
456
+ "boundary",
457
+ "effect",
458
+ "evidence_template",
459
+ "trace_role"
460
+ ],
237
461
  "properties": {
238
462
  "source": string_schema(),
239
463
  "sink": string_schema(),
240
- "boundary": string_schema()
464
+ "boundary": string_schema(),
465
+ "effect": string_schema(),
466
+ "evidence_template": string_schema(),
467
+ "trace_role": {
468
+ "type": "string",
469
+ "enum": ["source", "sink", "boundary"]
470
+ }
241
471
  }
242
472
  },
243
473
  "sink": string_schema(),
@@ -310,6 +540,30 @@ fn security_trace_step_schema() -> Value {
310
540
  })
311
541
  }
312
542
 
543
+ pub(super) fn security_blind_spot_schema() -> Value {
544
+ json!({
545
+ "type": "object",
546
+ "additionalProperties": false,
547
+ "required": ["category", "path", "line", "column", "sink", "reason", "evidence"],
548
+ "properties": {
549
+ "category": security_category_schema(),
550
+ "path": string_schema(),
551
+ "line": positive_integer_schema(),
552
+ "column": nonnegative_integer_schema(),
553
+ "sink": string_schema(),
554
+ "reason": {
555
+ "type": "string",
556
+ "enum": [
557
+ "unflattened-random-flow",
558
+ "ambiguous-random-provenance",
559
+ "unflattened-call"
560
+ ]
561
+ },
562
+ "evidence": string_schema()
563
+ }
564
+ })
565
+ }
566
+
313
567
  pub(super) fn attack_surface_schema() -> Value {
314
568
  json!({
315
569
  "type": "object",
@@ -364,7 +618,8 @@ fn security_category_schema() -> Value {
364
618
  "web-view-risk",
365
619
  "process-execution",
366
620
  "raw-sql",
367
- "plain-secret-storage"
621
+ "plain-secret-storage",
622
+ "weak-randomness"
368
623
  ]
369
624
  })
370
625
  }
@@ -391,6 +646,15 @@ fn array_ref_schema(definition: &str) -> Value {
391
646
  })
392
647
  }
393
648
 
649
+ fn nullable_ref_schema(definition: &str) -> Value {
650
+ json!({
651
+ "oneOf": [
652
+ { "$ref": format!("#/$defs/{definition}") },
653
+ { "type": "null" }
654
+ ]
655
+ })
656
+ }
657
+
394
658
  fn string_schema() -> Value {
395
659
  json!({ "type": "string" })
396
660
  }