dart-decimate 0.0.18 → 0.0.20

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
@@ -102,7 +102,7 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
102
102
 
103
103
  [[package]]
104
104
  name = "dart-decimate"
105
- version = "0.0.18"
105
+ version = "0.0.20"
106
106
  dependencies = [
107
107
  "clap",
108
108
  "glob",
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "dart-decimate"
3
- version = "0.0.18"
3
+ version = "0.0.20"
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
@@ -91,7 +91,7 @@ Add this to `package.json` if you want a short project command:
91
91
  "dart-decimate": "dart-decimate json ."
92
92
  },
93
93
  "devDependencies": {
94
- "dart-decimate": "^0.0.18"
94
+ "dart-decimate": "^0.0.20"
95
95
  }
96
96
  }
97
97
  ```
@@ -675,7 +675,7 @@ This repository forbids `unsafe_code`.
675
675
 
676
676
  ## Release Flow
677
677
 
678
- Current version: `0.0.18`.
678
+ Current version: `0.0.20`.
679
679
 
680
680
  After the first public release, changes should go through pull requests. Every
681
681
  PR to `main` must bump both `Cargo.toml` and `package.json` above the base
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dart-decimate",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "Rust-native codebase intelligence for Dart and Flutter module graphs.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -101,7 +101,13 @@ fn detect_hardcoded_secrets(
101
101
  {
102
102
  continue;
103
103
  }
104
- if secret_name && literal.value.len() >= 12 || secret_value {
104
+ if ((secret_binding_name
105
+ || (secret_name
106
+ && (literal_has_concrete_token_like_segment(&literal.value)
107
+ || literal_has_embedded_url_credentials(&literal.value))))
108
+ && literal.value.len() >= 12)
109
+ || secret_value
110
+ {
105
111
  candidates.push(detected(
106
112
  path,
107
113
  source,
@@ -2435,6 +2441,7 @@ fn literal_looks_like_user_facing_copy(value: &str) -> bool {
2435
2441
  "password reset",
2436
2442
  "enter password",
2437
2443
  "confirm password",
2444
+ "confirm your password",
2438
2445
  "password must",
2439
2446
  "password is",
2440
2447
  "password should",
@@ -141,6 +141,65 @@ class Copy {
141
141
  Ok(())
142
142
  }
143
143
 
144
+ #[test]
145
+ fn skips_low_entropy_labels_with_secret_like_words() -> Result<(), Box<dyn std::error::Error>> {
146
+ let fixture = tempfile::tempdir()?;
147
+ write(&fixture, "pubspec.yaml", "name: app\n")?;
148
+ write(
149
+ &fixture,
150
+ "lib/main.dart",
151
+ "void log(String message) => print(message);
152
+
153
+ void main() {
154
+ log('requestAuthorization result');
155
+ log('synchronizeRemoteCatalog');
156
+ }
157
+ ",
158
+ )?;
159
+
160
+ let project = scan_project(fixture.path())?;
161
+ let report = analyze_security(&project, &SecurityOptions::default(), None)?;
162
+
163
+ assert!(report.candidates.is_empty());
164
+ assert_eq!(report.total_occurrences, 0);
165
+
166
+ Ok(())
167
+ }
168
+
169
+ #[test]
170
+ fn reports_secret_bindings_and_shaped_literals() -> Result<(), Box<dyn std::error::Error>> {
171
+ let fixture = tempfile::tempdir()?;
172
+ write(&fixture, "pubspec.yaml", "name: app\n")?;
173
+ write(
174
+ &fixture,
175
+ "lib/main.dart",
176
+ "const clientSecret = 'ordinary dictionary words';
177
+
178
+ void authenticate({required String accessToken}) {}
179
+ void log(String message) => print(message);
180
+
181
+ void main() {
182
+ authenticate(accessToken: 'another dictionary phrase');
183
+ log('ghp_0123456789abcdef0123456789abcdef');
184
+ print(clientSecret);
185
+ }
186
+ ",
187
+ )?;
188
+
189
+ let project = scan_project(fixture.path())?;
190
+ let report = analyze_security(&project, &SecurityOptions::default(), None)?;
191
+
192
+ assert_eq!(report.total_occurrences, 3);
193
+ assert_eq!(report.candidates.len(), 1);
194
+ assert_eq!(
195
+ report.candidates[0].rule_id,
196
+ "dart-decimate/security-hardcoded-secret"
197
+ );
198
+ assert_eq!(report.candidates[0].occurrences.len(), 3);
199
+
200
+ Ok(())
201
+ }
202
+
144
203
  #[test]
145
204
  fn reports_operational_copy_with_concrete_token_segments() -> Result<(), Box<dyn std::error::Error>>
146
205
  {
package/src/symbols.rs CHANGED
@@ -348,7 +348,7 @@ fn unused_member_from_declaration(
348
348
  &indexed.member.owner,
349
349
  &indexed.member.name,
350
350
  reachable_files,
351
- )
351
+ ) + index.qualified_reference_count(&indexed.member.owner, "values", reachable_files)
352
352
  } else {
353
353
  let library = index.library_path(&indexed.path);
354
354
  index.library_reference_count(&indexed.member.name, library, reachable_files)