dart-decimate 0.0.9 → 0.0.10
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 +1 -1
- package/Cargo.toml +1 -1
- package/README.md +41 -58
- package/package.json +1 -1
- package/src/cli/analyze.rs +6 -3
- package/src/cli/entry_points.rs +18 -2
- package/src/cli/list_run.rs +1 -0
- package/src/cli/tests.rs +74 -0
- package/src/config/rules.rs +50 -13
- package/src/dependencies/analyze.rs +7 -1
- package/src/dependencies/tests.rs +29 -0
- package/src/dependencies.rs +19 -0
- package/src/dependency_scripts.rs +2 -0
- package/src/dupes/packages.rs +71 -0
- package/src/dupes/tests.rs +27 -0
- package/src/dupes.rs +6 -1
- package/src/extract/reference_tests.rs +106 -0
- package/src/extract/references.rs +264 -2
- package/src/extract/tests.rs +25 -0
- package/src/extract.rs +6 -3
- package/src/generated.rs +96 -3
- package/src/graph/package_config_tests.rs +123 -0
- package/src/graph/tests.rs +125 -0
- package/src/graph.rs +6 -5
- package/src/output/feature_flag_findings.rs +63 -1
- package/src/output/graph_findings.rs +23 -21
- package/src/output/security_findings.rs +15 -2
- package/src/output/tests.rs +104 -1
- package/src/package_map.rs +220 -28
- package/src/routes.rs +6 -1
- package/src/scan.rs +15 -5
- package/src/security/detect.rs +140 -6
- package/src/security/tests.rs +96 -0
- package/src/trace.rs +1 -1
package/src/security/tests.rs
CHANGED
|
@@ -121,6 +121,13 @@ class Routes {
|
|
|
121
121
|
class Copy {
|
|
122
122
|
String get settingsSecurityChangePassword => 'Change Password';
|
|
123
123
|
static const String invalidCredentials = 'Invalid email or password';
|
|
124
|
+
static const String passwordsDoNotMatch = 'Passwords do not match';
|
|
125
|
+
static const String passwordTooShort = 'Use at least 8 characters';
|
|
126
|
+
static const String cloudFunctionSubject = 'Jabal Sina Cloud Function Error | token_notifications';
|
|
127
|
+
static const String pingResponse = 'Pong - Token Notifications Active';
|
|
128
|
+
static const String tokenTitle = '🎫 Token Issued';
|
|
129
|
+
static const String requestTokenOperation = 'Pre-fetch token';
|
|
130
|
+
static const String updatingPassword = 'Updating password...';
|
|
124
131
|
}
|
|
125
132
|
",
|
|
126
133
|
)?;
|
|
@@ -134,6 +141,95 @@ class Copy {
|
|
|
134
141
|
Ok(())
|
|
135
142
|
}
|
|
136
143
|
|
|
144
|
+
#[test]
|
|
145
|
+
fn reports_operational_copy_with_concrete_token_segments() -> Result<(), Box<dyn std::error::Error>>
|
|
146
|
+
{
|
|
147
|
+
let fixture = tempfile::tempdir()?;
|
|
148
|
+
write(&fixture, "pubspec.yaml", "name: app\n")?;
|
|
149
|
+
write(
|
|
150
|
+
&fixture,
|
|
151
|
+
"lib/main.dart",
|
|
152
|
+
"class Session {
|
|
153
|
+
static const String accessToken = 'Token issued: abc123abc123';
|
|
154
|
+
static const String operationMessage = 'Pre-fetch token abc123abc123';
|
|
155
|
+
}
|
|
156
|
+
",
|
|
157
|
+
)?;
|
|
158
|
+
|
|
159
|
+
let project = scan_project(fixture.path())?;
|
|
160
|
+
let report = analyze_security(&project, &SecurityOptions::default(), None)?;
|
|
161
|
+
|
|
162
|
+
assert_eq!(report.total_occurrences, 2);
|
|
163
|
+
assert_eq!(
|
|
164
|
+
report.candidates[0].rule_id,
|
|
165
|
+
"dart-decimate/security-hardcoded-secret"
|
|
166
|
+
);
|
|
167
|
+
assert_eq!(report.candidates[0].occurrences.len(), 2);
|
|
168
|
+
|
|
169
|
+
Ok(())
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
#[test]
|
|
173
|
+
fn reports_user_copy_with_secret_bindings_or_token_segments()
|
|
174
|
+
-> Result<(), Box<dyn std::error::Error>> {
|
|
175
|
+
let fixture = tempfile::tempdir()?;
|
|
176
|
+
write(&fixture, "pubspec.yaml", "name: app\n")?;
|
|
177
|
+
write(
|
|
178
|
+
&fixture,
|
|
179
|
+
"lib/main.dart",
|
|
180
|
+
"class Session {
|
|
181
|
+
static const String accessToken = 'Invalid token abc123abc123';
|
|
182
|
+
static const String resetToken = 'Reset link invalid or expired abc123abc123';
|
|
183
|
+
}
|
|
184
|
+
",
|
|
185
|
+
)?;
|
|
186
|
+
|
|
187
|
+
let project = scan_project(fixture.path())?;
|
|
188
|
+
let report = analyze_security(&project, &SecurityOptions::default(), None)?;
|
|
189
|
+
|
|
190
|
+
assert_eq!(report.total_occurrences, 2);
|
|
191
|
+
assert_eq!(
|
|
192
|
+
report.candidates[0].rule_id,
|
|
193
|
+
"dart-decimate/security-hardcoded-secret"
|
|
194
|
+
);
|
|
195
|
+
assert_eq!(report.candidates[0].occurrences.len(), 2);
|
|
196
|
+
|
|
197
|
+
Ok(())
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
#[test]
|
|
201
|
+
fn skips_dot_qualified_diagnostic_identifiers_but_reports_jwts()
|
|
202
|
+
-> Result<(), Box<dyn std::error::Error>> {
|
|
203
|
+
let fixture = tempfile::tempdir()?;
|
|
204
|
+
write(&fixture, "pubspec.yaml", "name: app\n")?;
|
|
205
|
+
write(
|
|
206
|
+
&fixture,
|
|
207
|
+
"lib/main.dart",
|
|
208
|
+
"class Crash {
|
|
209
|
+
static void error(Object error, StackTrace stackTrace, {required String reason}) {}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
void report(Object error, StackTrace stackTrace) {
|
|
213
|
+
Crash.error(error, stackTrace, reason: 'ActiveWorkoutNotifier.saveActiveWorkout.squadCheckIn');
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const jwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
|
|
217
|
+
",
|
|
218
|
+
)?;
|
|
219
|
+
|
|
220
|
+
let project = scan_project(fixture.path())?;
|
|
221
|
+
let report = analyze_security(&project, &SecurityOptions::default(), None)?;
|
|
222
|
+
|
|
223
|
+
assert_eq!(report.total_occurrences, 1);
|
|
224
|
+
assert_eq!(
|
|
225
|
+
report.candidates[0].rule_id,
|
|
226
|
+
"dart-decimate/security-hardcoded-secret"
|
|
227
|
+
);
|
|
228
|
+
assert_eq!(report.candidates[0].occurrences[0].location.line, 9);
|
|
229
|
+
|
|
230
|
+
Ok(())
|
|
231
|
+
}
|
|
232
|
+
|
|
137
233
|
#[test]
|
|
138
234
|
fn reports_secret_named_urls_with_concrete_secret_parameters()
|
|
139
235
|
-> Result<(), Box<dyn std::error::Error>> {
|
package/src/trace.rs
CHANGED
|
@@ -105,7 +105,7 @@ pub struct DependencyTraceReport {
|
|
|
105
105
|
pub type_only_importers: Vec<TraceDependencyDirective>,
|
|
106
106
|
/// Number of Dart import/export directives referencing the package.
|
|
107
107
|
pub total_import_count: usize,
|
|
108
|
-
/// Whether non-Dart
|
|
108
|
+
/// Whether non-Dart tooling files reference the package.
|
|
109
109
|
pub used_in_scripts: bool,
|
|
110
110
|
/// Whether Dart source references the package in import/export directives.
|
|
111
111
|
pub is_used: bool,
|