dart-decimate 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Cargo.lock CHANGED
@@ -92,7 +92,7 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
92
92
 
93
93
  [[package]]
94
94
  name = "dart-decimate"
95
- version = "0.0.6"
95
+ version = "0.0.8"
96
96
  dependencies = [
97
97
  "clap",
98
98
  "glob",
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "dart-decimate"
3
- version = "0.0.6"
3
+ version = "0.0.8"
4
4
  edition = "2024"
5
5
  rust-version = "1.85"
6
6
  description = "Rust-native codebase intelligence for Dart and Flutter module graphs."
package/README.md CHANGED
@@ -44,6 +44,21 @@ dependencies, duplicated code, complex functions, dependency hygiene,
44
44
  architecture drift, Flutter graph issues, security candidates, and PR-risk
45
45
  signals.
46
46
 
47
+ To open the same report in your browser:
48
+
49
+ ```bash
50
+ npx --yes dart-decimate html .
51
+ ```
52
+
53
+ To review only files changed from another branch or ref:
54
+
55
+ ```bash
56
+ npx --yes dart-decimate html . --compare origin/main
57
+ ```
58
+
59
+ `--compare REF` aliases `--changed-since REF`. If the ref is not found,
60
+ Dart Decimate suggests similar local or remote branches.
61
+
47
62
  For JSON output that agents and CI can parse:
48
63
 
49
64
  ```bash
@@ -76,7 +91,7 @@ Add this to `package.json` if you want a short project command:
76
91
  "dart-decimate": "dart-decimate json ."
77
92
  },
78
93
  "devDependencies": {
79
- "dart-decimate": "^0.0.6"
94
+ "dart-decimate": "^0.0.8"
80
95
  }
81
96
  }
82
97
  ```
@@ -149,6 +164,10 @@ The `html` shortcut opens the report by default. On report commands, use
149
164
  `--format html` to print static HTML or `--open` to write a private temporary
150
165
  file and open it in the default browser.
151
166
 
167
+ Generated finding reports group issues by type in numbered, collapsible
168
+ sections. Search narrows visible findings, and type filters open the selected
169
+ group.
170
+
152
171
  Human terminal reports strip control characters from user-derived paths and
153
172
  messages; HTML reports escape user-derived content.
154
173
 
@@ -158,6 +177,10 @@ Print the HTML report instead:
158
177
  npx --yes dart-decimate html . --stdout > dart-decimate-report.html
159
178
  ```
160
179
 
180
+ Changed files only: `npx --yes dart-decimate html . --compare origin/main`.
181
+ `--compare REF` aliases `--changed-since REF` and suggests similar branches when
182
+ the ref is not found.
183
+
161
184
  To run the GitHub version directly:
162
185
 
163
186
  ```bash
@@ -321,6 +344,7 @@ Dart Decimate finds candidates for:
321
344
  - risky WebView settings
322
345
  - process execution
323
346
  - raw SQL
347
+ - Firebase client API keys in `FirebaseOptions`
324
348
  - plain local storage of secret-like material
325
349
 
326
350
  Useful commands:
@@ -329,8 +353,13 @@ Useful commands:
329
353
  dart-decimate security . --surface --format json
330
354
  dart-decimate security . --ci --sarif-file dart-decimate-security.sarif
331
355
  git diff --cached --unified=0 | dart-decimate security . --gate new --diff-stdin --format json
356
+ dart-decimate security . --gate newly-reachable --compare origin/main --format json
332
357
  ```
333
358
 
359
+ `--gate new` keeps candidates on added lines. `--gate newly-reachable` keeps
360
+ reachable candidates affected by changed files. Both accept `--compare REF`,
361
+ `--changed-since REF`, `--diff-file PATCH`, or `--diff-stdin`.
362
+
334
363
  ### 9. PR Risk
335
364
 
336
365
  Use this before merging changed code.
@@ -431,6 +460,10 @@ Example shape:
431
460
  }
432
461
  ```
433
462
 
463
+ When grouped security findings hide additional occurrences, `next_steps` can
464
+ include `review-security-surface`, which reruns
465
+ `dart-decimate security . --format json --surface`.
466
+
434
467
  If a JSON command fails before a report can be built, stdout still stays
435
468
  machine-readable:
436
469
 
@@ -526,7 +559,7 @@ rules = ["lib/domain:lib/ui"]
526
559
 
527
560
  [security]
528
561
  surface = true
529
- categories = ["hardcoded-secret", "insecure-transport", "tls-bypass"]
562
+ categories = ["hardcoded-secret", "firebase-api-key", "insecure-transport", "tls-bypass"]
530
563
 
531
564
  [rules]
532
565
  unused-files = "error"
@@ -544,49 +577,8 @@ dart-decimate schema --format json | jq .issue_types
544
577
 
545
578
  Current issue types:
546
579
 
547
- ```text
548
- dead-file
549
- unused-export
550
- unused-type
551
- private-type-leak
552
- unused-enum-member
553
- unused-class-member
554
- duplicate-export
555
- route-collision
556
- private-widget-class
557
- widget-top-level-function-boundary
558
- unused-widget-param
559
- unrendered-widget
560
- missing-context-mounted-after-await
561
- missing-entry-point
562
- circular-dependency
563
- re-export-cycle
564
- boundary-violation
565
- boundary-coverage
566
- boundary-call-violation
567
- policy-violation
568
- unresolved-dependency
569
- part-of-violation
570
- unused-dependency
571
- unused-dev-dependency
572
- test-only-dependency
573
- unused-dependency-override
574
- misconfigured-dependency-override
575
- unlisted-dependency
576
- private-src-import
577
- code-duplication
578
- high-cyclomatic-complexity
579
- high-cognitive-complexity
580
- high-complexity
581
- coverage-gap
582
- high-crap-score
583
- health-hotspot
584
- refactoring-target
585
- feature-flag
586
- security-candidate
587
- stale-suppression
588
- missing-suppression-reason
589
- ```
580
+ See [docs/issue-types.md](docs/issue-types.md). Prefer the schema command when
581
+ you need the installed binary's exact list.
590
582
 
591
583
  ## CI
592
584
 
@@ -622,7 +614,9 @@ This repository already runs:
622
614
  - Rust format, clippy, and tests
623
615
  - npm package checks
624
616
  - version sync between `Cargo.toml` and `package.json`
625
- - a release-version gate so published versions cannot be reused
617
+ - a PR version-bump gate requiring both package files to increase to an
618
+ unpublished version
619
+ - release guards that reject reused npm versions or tags on different commits
626
620
  - migration checks that block previous package, command, schema, and MCP names
627
621
  - Dependabot and weekly dependency/security audits
628
622
 
@@ -666,6 +660,7 @@ cargo fmt --check
666
660
  cargo clippy --all-targets -- -D warnings
667
661
  cargo test --all-targets
668
662
  npm run version:check
663
+ npm run version:bump:check -- origin/main
669
664
  npm run release:check
670
665
  npm run migration:check
671
666
  npm run pack:check
@@ -675,19 +670,25 @@ This repository forbids `unsafe_code`.
675
670
 
676
671
  ## Release Flow
677
672
 
678
- Current version: `0.0.6`.
673
+ Current version: `0.0.8`.
679
674
 
680
- After the first public release, changes should go through pull requests.
675
+ After the first public release, changes should go through pull requests. Every
676
+ PR to `main` must bump both `Cargo.toml` and `package.json` above the base
677
+ branch and to an unpublished npm version.
681
678
 
682
679
  To release a new version:
683
680
 
684
- 1. Update both `Cargo.toml` and `package.json`.
681
+ 1. Update both `Cargo.toml` and `package.json` to the same unpublished version.
685
682
  2. Open a PR.
686
683
  3. Let CI pass.
687
684
  4. Merge to `main`.
688
685
  5. GitHub Actions publishes `dart-decimate` to npm, creates tag `vX.Y.Z`, and
689
686
  creates the GitHub release.
690
687
 
688
+ Release reruns for the same commit may update GitHub release assets. If the npm
689
+ package already exists for that commit, the publish step is skipped; a reused tag
690
+ or npm version from another commit fails.
691
+
691
692
  Local hooks block stale package names, mismatched versions, reused npm versions,
692
693
  and direct pushes to `main`.
693
694
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dart-decimate",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "Rust-native codebase intelligence for Dart and Flutter module graphs.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -28,6 +28,7 @@
28
28
  "scripts": {
29
29
  "postinstall": "node npm/scripts/postinstall.js",
30
30
  "version:check": "node scripts/check-version-sync.mjs",
31
+ "version:bump:check": "node scripts/check-pr-version-bump.mjs",
31
32
  "release:check": "node scripts/check-release-version.mjs",
32
33
  "migration:check": "node scripts/check-dart-decimate-migration.mjs",
33
34
  "pack:check": "npm pack --dry-run",
package/src/baseline.rs CHANGED
@@ -378,6 +378,10 @@ pub fn apply_baseline_to_report(report: &mut JsonReport, baseline: &Baseline) {
378
378
  .retain(|finding| !known.contains(finding_identity(finding).as_str()));
379
379
  filter_detail_sections(report);
380
380
  recompute_summary(report);
381
+ let has_hidden_security_surface = report.has_hidden_security_candidate_occurrences();
382
+ report
383
+ .next_steps
384
+ .retain(|step| next_step_live(&step.id, &report.findings, has_hidden_security_surface));
381
385
  report.verdict = if report
382
386
  .findings
383
387
  .iter()
@@ -435,9 +439,6 @@ fn filter_detail_sections(report: &mut JsonReport) {
435
439
  report
436
440
  .attack_surface
437
441
  .retain(|entry| attack_surface_live(entry, &report.security_candidates));
438
- report
439
- .next_steps
440
- .retain(|step| next_step_live(&step.id, &remaining));
441
442
  }
442
443
 
443
444
  fn clone_group_live(
@@ -500,21 +501,25 @@ fn attack_surface_live(
500
501
  .any(|candidate| candidate.category == entry.category)
501
502
  }
502
503
 
503
- fn next_step_live(id: &str, remaining: &[(FindingKind, String, Option<String>)]) -> bool {
504
+ fn next_step_live(id: &str, findings: &[Finding], has_hidden_security_surface: bool) -> bool {
504
505
  match id {
505
- "trace-unused-export" => has_kind(remaining, FindingKind::UnusedExport),
506
- "trace-unused-type" => has_kind(remaining, FindingKind::UnusedType),
507
- "trace-unused-dependency" => remaining
506
+ "trace-unused-export" => has_finding_kind(findings, FindingKind::UnusedExport),
507
+ "trace-unused-type" => has_finding_kind(findings, FindingKind::UnusedType),
508
+ "trace-unused-dependency" => findings
508
509
  .iter()
509
- .any(|(kind, _, _)| is_dependency_hygiene_kind(*kind)),
510
- "trace-code-duplication" => has_kind(remaining, FindingKind::CodeDuplication),
511
- "complexity-breakdown" => remaining.iter().any(|(kind, _, _)| complexity_kind(*kind)),
510
+ .any(|finding| is_dependency_hygiene_kind(finding.kind)),
511
+ "trace-code-duplication" => has_finding_kind(findings, FindingKind::CodeDuplication),
512
+ "complexity-breakdown" => findings.iter().any(|finding| complexity_kind(finding.kind)),
513
+ "review-security-surface" => {
514
+ has_hidden_security_surface
515
+ && has_finding_kind(findings, FindingKind::SecurityCandidate)
516
+ }
512
517
  _ => true,
513
518
  }
514
519
  }
515
520
 
516
- fn has_kind(remaining: &[(FindingKind, String, Option<String>)], expected: FindingKind) -> bool {
517
- remaining.iter().any(|(kind, _, _)| *kind == expected)
521
+ fn has_finding_kind(findings: &[Finding], expected: FindingKind) -> bool {
522
+ findings.iter().any(|finding| finding.kind == expected)
518
523
  }
519
524
 
520
525
  fn complexity_kind(kind: FindingKind) -> bool {
@@ -1,4 +1,5 @@
1
1
  use std::collections::BTreeSet;
2
+ use std::fmt;
2
3
  use std::path::{Path, PathBuf};
3
4
  use std::process::Command;
4
5
 
@@ -17,15 +18,37 @@ pub enum ChangedScopeError {
17
18
  source: std::io::Error,
18
19
  },
19
20
  /// Git returned a non-zero status.
20
- #[error("git diff failed for base {base:?}: {stderr}")]
21
+ #[error("git diff failed for base {base:?}: {stderr}{suggestions}")]
21
22
  GitDiff {
22
23
  /// Base revision passed by the caller.
23
24
  base: String,
24
25
  /// Stderr from git.
25
26
  stderr: String,
27
+ /// Similar refs found in the local repository.
28
+ suggestions: RefSuggestions,
26
29
  },
27
30
  }
28
31
 
32
+ /// Similar Git refs for an invalid changed-scope base.
33
+ #[derive(Debug, Clone, Default)]
34
+ pub struct RefSuggestions(Vec<String>);
35
+
36
+ impl fmt::Display for RefSuggestions {
37
+ fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
38
+ match self.0.as_slice() {
39
+ [] => Ok(()),
40
+ [one] => write!(formatter, "\nDid you mean {one}?"),
41
+ many => write!(formatter, "\nDid you mean one of: {}?", many.join(", ")),
42
+ }
43
+ }
44
+ }
45
+
46
+ impl RefSuggestions {
47
+ pub(crate) fn for_base(root: &Path, base: &str) -> Self {
48
+ Self(similar_refs(root, base))
49
+ }
50
+ }
51
+
29
52
  /// Return root-normalized files changed since `base`.
30
53
  ///
31
54
  /// # Errors
@@ -40,10 +63,7 @@ pub fn changed_files(root: &Path, base: &str) -> Result<Vec<PathBuf>, ChangedSco
40
63
  .map_err(|source| ChangedScopeError::Git { source })?;
41
64
 
42
65
  if !output.status.success() {
43
- return Err(ChangedScopeError::GitDiff {
44
- base: base.to_owned(),
45
- stderr: String::from_utf8_lossy(&output.stderr).trim().to_owned(),
46
- });
66
+ return Err(git_diff_error(root, base, &output.stderr));
47
67
  }
48
68
 
49
69
  let untracked = Command::new("git")
@@ -56,6 +76,7 @@ pub fn changed_files(root: &Path, base: &str) -> Result<Vec<PathBuf>, ChangedSco
56
76
  return Err(ChangedScopeError::GitDiff {
57
77
  base: base.to_owned(),
58
78
  stderr: String::from_utf8_lossy(&untracked.stderr).trim().to_owned(),
79
+ suggestions: RefSuggestions::default(),
59
80
  });
60
81
  }
61
82
 
@@ -115,3 +136,75 @@ fn normalize_changed_path(root: &Path, line: &str) -> Option<PathBuf> {
115
136
  let path = normalize_against(root, Path::new(line));
116
137
  path.starts_with(root).then_some(path)
117
138
  }
139
+
140
+ fn git_diff_error(root: &Path, base: &str, stderr: &[u8]) -> ChangedScopeError {
141
+ ChangedScopeError::GitDiff {
142
+ base: base.to_owned(),
143
+ stderr: String::from_utf8_lossy(stderr).trim().to_owned(),
144
+ suggestions: RefSuggestions::for_base(root, base),
145
+ }
146
+ }
147
+
148
+ fn similar_refs(root: &Path, base: &str) -> Vec<String> {
149
+ let Ok(output) = Command::new("git")
150
+ .args([
151
+ "for-each-ref",
152
+ "--format=%(refname:short)",
153
+ "refs/heads",
154
+ "refs/remotes",
155
+ ])
156
+ .current_dir(root)
157
+ .output()
158
+ else {
159
+ return Vec::new();
160
+ };
161
+ if !output.status.success() {
162
+ return Vec::new();
163
+ }
164
+
165
+ let mut scored = String::from_utf8_lossy(&output.stdout)
166
+ .lines()
167
+ .map(str::trim)
168
+ .filter(|ref_name| !ref_name.is_empty())
169
+ .filter(|ref_name| !ref_name.ends_with("/HEAD"))
170
+ .filter(|ref_name| *ref_name != base)
171
+ .filter_map(|ref_name| {
172
+ let short = ref_name.rsplit('/').next().unwrap_or(ref_name);
173
+ let score = levenshtein(base, ref_name).min(levenshtein(base, short));
174
+ let contains_bonus = if ref_name.contains(base) || short.contains(base) {
175
+ 0
176
+ } else {
177
+ score
178
+ };
179
+ let score = score.min(contains_bonus);
180
+ (score <= suggestion_threshold(base)).then_some((score, ref_name.to_owned()))
181
+ })
182
+ .collect::<Vec<_>>();
183
+ scored.sort();
184
+ scored
185
+ .into_iter()
186
+ .map(|(_, ref_name)| ref_name)
187
+ .take(3)
188
+ .collect()
189
+ }
190
+
191
+ fn suggestion_threshold(value: &str) -> usize {
192
+ 2.max(value.len() / 3)
193
+ }
194
+
195
+ fn levenshtein(left: &str, right: &str) -> usize {
196
+ let right_chars = right.chars().collect::<Vec<_>>();
197
+ let mut previous = (0..=right_chars.len()).collect::<Vec<_>>();
198
+ for (left_index, left_char) in left.chars().enumerate() {
199
+ let mut current = Vec::with_capacity(right_chars.len() + 1);
200
+ current.push(left_index + 1);
201
+ for (right_index, right_char) in right_chars.iter().enumerate() {
202
+ let insertion = current[right_index] + 1;
203
+ let deletion = previous[right_index + 1] + 1;
204
+ let substitution = previous[right_index] + usize::from(left_char != *right_char);
205
+ current.push(insertion.min(deletion).min(substitution));
206
+ }
207
+ previous = current;
208
+ }
209
+ previous[right_chars.len()]
210
+ }
@@ -7,7 +7,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
7
7
  use clap::{Arg, ArgMatches};
8
8
 
9
9
  use crate::baseline::baseline_from_report;
10
- use crate::changed_scope::{changed_file_scope_from_changed, changed_files};
10
+ use crate::changed_scope::{RefSuggestions, changed_file_scope_from_changed, changed_files};
11
11
  use crate::config::apply_rules_to_report;
12
12
  use crate::graph::normalize_path;
13
13
  use crate::output::{
@@ -284,6 +284,7 @@ where
284
284
  Err(crate::changed_scope::ChangedScopeError::GitDiff {
285
285
  base: base.to_owned(),
286
286
  stderr: String::from_utf8_lossy(&output.stderr).trim().to_owned(),
287
+ suggestions: RefSuggestions::default(),
287
288
  }
288
289
  .into())
289
290
  }
package/src/cli/error.rs CHANGED
@@ -41,7 +41,7 @@ pub enum CliError {
41
41
  Widgets(#[from] WidgetAnalysisError),
42
42
  /// Security top truncation cannot safely run before changed-line scoping.
43
43
  #[error(
44
- "security --top cannot be combined with --gate, --diff-file, --diff-stdin, or --changed-since"
44
+ "security --top cannot be combined with --gate, --diff-file, --diff-stdin, --changed-since, or --compare"
45
45
  )]
46
46
  UnsupportedSecurityTopScope,
47
47
  /// Cross-language duplicate detection is JavaScript/TypeScript-specific in Fallow.
@@ -74,8 +74,9 @@ pub(super) fn run_fix<W: Write>(subcommand: &ArgMatches, mut writer: W) -> Resul
74
74
  conditional_environment: super::common_args::conditional_environment(subcommand),
75
75
  },
76
76
  )?;
77
+ let command = ReportCommand::Check;
77
78
  let request = CommandRequest {
78
- command: ReportCommand::Check,
79
+ command,
79
80
  root,
80
81
  format: match format {
81
82
  OutputFormat::Human => super::ReportOutputFormat::Human,
@@ -94,16 +95,10 @@ pub(super) fn run_fix<W: Write>(subcommand: &ArgMatches, mut writer: W) -> Resul
94
95
  policy_packs: Vec::new(),
95
96
  audit_base: None,
96
97
  audit_gate: super::audit_run::AuditGate::default(),
97
- file_paths: subcommand
98
- .get_many::<std::path::PathBuf>("file")
99
- .map(|values| values.cloned().collect())
100
- .unwrap_or_default(),
101
- workspace_patterns: subcommand
102
- .get_many::<String>("workspace")
103
- .map(|values| values.cloned().collect())
104
- .unwrap_or_default(),
105
- changed_workspaces: subcommand.get_one::<String>("changed-workspaces").cloned(),
106
- changed_since: subcommand.get_one::<String>("changed-since").cloned(),
98
+ file_paths: super::scope_args::file_paths(command, subcommand),
99
+ workspace_patterns: super::scope_args::workspace_patterns(command, subcommand),
100
+ changed_workspaces: super::scope_args::changed_workspaces(command, subcommand),
101
+ changed_since: super::scope_args::changed_since(command, subcommand),
107
102
  baseline_paths: Vec::new(),
108
103
  security_sarif_file: None,
109
104
  security_gate: None,
@@ -18,6 +18,7 @@ pub(super) fn report_command(command: Command) -> Command {
18
18
  .arg(workspace_arg())
19
19
  .arg(changed_workspaces_arg())
20
20
  .arg(changed_since_arg())
21
+ .arg(compare_arg())
21
22
  }
22
23
 
23
24
  pub(super) fn file_arg() -> Arg {
@@ -53,6 +54,15 @@ pub(super) fn changed_since_arg() -> Arg {
53
54
  .long("changed-since")
54
55
  .value_name("REF")
55
56
  .help("Scope findings to files changed since a Git ref")
57
+ .conflicts_with("compare")
58
+ }
59
+
60
+ pub(super) fn compare_arg() -> Arg {
61
+ Arg::new("compare")
62
+ .long("compare")
63
+ .value_name("REF")
64
+ .help("Alias for --changed-since; scope findings to files changed since a Git ref")
65
+ .conflicts_with("changed-since")
56
66
  }
57
67
 
58
68
  pub(super) fn workspace_patterns(command: ReportCommand, subcommand: &ArgMatches) -> Vec<String> {
@@ -90,7 +100,10 @@ pub(super) fn changed_workspaces(
90
100
 
91
101
  pub(super) fn changed_since(command: ReportCommand, subcommand: &ArgMatches) -> Option<String> {
92
102
  if supports_report_scope(command) {
93
- subcommand.get_one::<String>("changed-since").cloned()
103
+ subcommand
104
+ .get_one::<String>("changed-since")
105
+ .or_else(|| subcommand.get_one::<String>("compare"))
106
+ .cloned()
94
107
  } else {
95
108
  None
96
109
  }
@@ -143,7 +143,10 @@ pub(super) fn security_cli_options(
143
143
  sarif_file: matches.get_one::<PathBuf>("sarif-file").cloned(),
144
144
  gate: security_gate_mode(matches),
145
145
  diff: security_diff(matches),
146
- changed_since: matches.get_one::<String>("changed-since").cloned(),
146
+ changed_since: matches
147
+ .get_one::<String>("changed-since")
148
+ .or_else(|| matches.get_one::<String>("compare"))
149
+ .cloned(),
147
150
  ci: matches.get_flag("ci"),
148
151
  fail_on_issues: matches.get_flag("fail-on-issues"),
149
152
  summary: matches.get_flag("summary"),
package/src/cli.rs CHANGED
@@ -497,7 +497,7 @@ fn request_from_matches(matches: &ArgMatches) -> Result<CommandRequest, CliError
497
497
  let file_paths = scope_args::file_paths(command, subcommand);
498
498
  let workspace_patterns = scope_args::workspace_patterns(command, subcommand);
499
499
  let changed_workspaces = scope_args::changed_workspaces(command, subcommand);
500
- let changed_since = scope_args::changed_since(command, subcommand);
500
+ let changed_since = report_changed_since(command, subcommand, &security_cli);
501
501
  let baseline_paths = baseline_paths(command, subcommand);
502
502
  let save_baseline = if supports_global_baseline(command) {
503
503
  subcommand.get_one::<PathBuf>("save-baseline").cloned()
@@ -604,6 +604,21 @@ fn validate_security_cli(
604
604
  Ok(())
605
605
  }
606
606
 
607
+ fn report_changed_since(
608
+ command: ReportCommand,
609
+ subcommand: &ArgMatches,
610
+ security_cli: &SecurityCliOptions,
611
+ ) -> Option<String> {
612
+ let changed_since = scope_args::changed_since(command, subcommand);
613
+ if command == ReportCommand::Security
614
+ && security_cli.gate == Some(SecurityGateMode::NewlyReachable)
615
+ {
616
+ None
617
+ } else {
618
+ changed_since
619
+ }
620
+ }
621
+
607
622
  fn baseline_paths(command: ReportCommand, subcommand: &ArgMatches) -> Vec<PathBuf> {
608
623
  let mut paths = Vec::new();
609
624
  if supports_global_baseline(command) {
@@ -18,6 +18,11 @@ pub(super) fn aliases(rule_id: &str, kind: FindingKind) -> Vec<&'static str> {
18
18
  "security-hardcoded-secret",
19
19
  "hardcoded-secret",
20
20
  ],
21
+ "security-firebase-api-key" => vec![
22
+ "dart-decimate/security-firebase-api-key",
23
+ "security-firebase-api-key",
24
+ "firebase-api-key",
25
+ ],
21
26
  "security-insecure-transport" => vec![
22
27
  "dart-decimate/security-insecure-transport",
23
28
  "security-insecure-transport",
@@ -92,6 +97,9 @@ fn all_security_aliases() -> Vec<&'static str> {
92
97
  "dart-decimate/security-hardcoded-secret",
93
98
  "security-hardcoded-secret",
94
99
  "hardcoded-secret",
100
+ "dart-decimate/security-firebase-api-key",
101
+ "security-firebase-api-key",
102
+ "firebase-api-key",
95
103
  "dart-decimate/security-insecure-transport",
96
104
  "security-insecure-transport",
97
105
  "insecure-transport",
@@ -99,11 +99,12 @@ pub fn apply_rules_to_report(report: &mut JsonReport, rules: &RuleConfig) -> Res
99
99
  report
100
100
  .attack_surface
101
101
  .retain(|entry| security_surface_enabled(entry, &rules));
102
- report
103
- .next_steps
104
- .retain(|step| next_step_enabled(&step.id, &report.findings));
105
102
 
106
103
  recompute_summary(report);
104
+ let has_hidden_security_surface = report.has_hidden_security_candidate_occurrences();
105
+ report
106
+ .next_steps
107
+ .retain(|step| next_step_enabled(&step.id, &report.findings, has_hidden_security_surface));
107
108
  report.verdict = if report
108
109
  .findings
109
110
  .iter()
@@ -246,6 +247,7 @@ fn complexity_kind(rule_id: &str) -> FindingKind {
246
247
  fn security_surface_enabled(entry: &JsonAttackSurfaceEntry, rules: &RuleMatcher) -> bool {
247
248
  let rule_id = match entry.category {
248
249
  SecurityCategory::HardcodedSecret => "dart-decimate/security-hardcoded-secret",
250
+ SecurityCategory::FirebaseApiKey => "dart-decimate/security-firebase-api-key",
249
251
  SecurityCategory::InsecureTransport => "dart-decimate/security-insecure-transport",
250
252
  SecurityCategory::TlsBypass => "dart-decimate/security-tls-bypass",
251
253
  SecurityCategory::WebViewRisk => "dart-decimate/security-webview-risk",
@@ -256,7 +258,7 @@ fn security_surface_enabled(entry: &JsonAttackSurfaceEntry, rules: &RuleMatcher)
256
258
  rules.level(rule_id, FindingKind::SecurityCandidate) != RuleLevel::Off
257
259
  }
258
260
 
259
- fn next_step_enabled(id: &str, findings: &[Finding]) -> bool {
261
+ fn next_step_enabled(id: &str, findings: &[Finding], has_hidden_security_surface: bool) -> bool {
260
262
  match id {
261
263
  "trace-unused-export" => has_kind(findings, FindingKind::UnusedExport),
262
264
  "trace-unused-type" => has_kind(findings, FindingKind::UnusedType),
@@ -273,6 +275,9 @@ fn next_step_enabled(id: &str, findings: &[Finding]) -> bool {
273
275
  | FindingKind::HighCrapScore
274
276
  )
275
277
  }),
278
+ "review-security-surface" => {
279
+ has_hidden_security_surface && has_kind(findings, FindingKind::SecurityCandidate)
280
+ }
276
281
  _ => true,
277
282
  }
278
283
  }
package/src/config.rs CHANGED
@@ -602,6 +602,7 @@ fn security_schema() -> Value {
602
602
  "type": "string",
603
603
  "enum": [
604
604
  "hardcoded-secret",
605
+ "firebase-api-key",
605
606
  "insecure-transport",
606
607
  "tls-bypass",
607
608
  "web-view-risk",
package/src/explain.rs CHANGED
@@ -644,6 +644,7 @@ const ISSUES: &[IssueExplanation] = &[
644
644
  "security-candidates",
645
645
  "security-sink",
646
646
  "hardcoded-secret",
647
+ "firebase-api-key",
647
648
  "insecure-transport",
648
649
  "tls-bypass",
649
650
  "webview-risk",