Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ All notable changes to Diskern are documented here. The format follows

### Fixed

- Chrome caches under macOS `~/Library/Caches` now appear in scan reports
- Restoring a quarantined file across filesystems no longer fails with
`EXDEV`
- Restore refuses when something is already at the original path, rather
Expand Down
2 changes: 1 addition & 1 deletion crates/diskern-core/rules/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
{
"id": "chrome-cache",
"patterns": ["**/google/chrome/user data/*/cache/**", "**/.cache/google-chrome/**"],
"patterns": ["**/google/chrome/user data/*/cache/**", "**/.cache/google-chrome/**", "**/library/caches/google/chrome/*/cache/**"],
"category": "browser_cache",
"verdict": "safe",
"description": "Chrome browser cache. Fully regenerated on next use; no effect on installed applications or saved data."
Expand Down
23 changes: 23 additions & 0 deletions crates/diskern-core/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,29 @@ mod tests {
}
}

#[test]
fn chrome_cache_is_safe_to_remove_on_each_platform() {
let db = RulesDb::embedded();
for path in [
"/home/u/.cache/google-chrome/Default/Cache/data_0",
"C:\\Users\\x\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Cache\\data_0",
"/Users/x/Library/Caches/Google/Chrome/Default/Cache/data_0",
] {
let (cat, verdict, rule) = db.classify(std::path::Path::new(path));
assert_eq!(cat, Category::BrowserCache, "{path} matched {rule:?}");
assert_eq!(verdict, Verdict::Safe, "{path} matched {rule:?}");
}
}

#[test]
fn chrome_profile_data_is_not_safe_to_remove() {
let db = RulesDb::embedded();
let path = "/Users/x/Library/Application Support/Google/Chrome/Default/History";
let (cat, verdict, rule) = db.classify(std::path::Path::new(path));
assert_eq!(cat, Category::Unknown, "{path} matched {rule:?}");
assert_ne!(verdict, Verdict::Safe, "{path} matched {rule:?}");
}

/// Issue #40. `/mozilla/firefox/profiles` covered the whole profile
/// directory, so bookmarks, history, logins and cookies were listed
/// under "Safe to remove" and `quarantine_finding` accepted them.
Expand Down
2 changes: 1 addition & 1 deletion docs/RULES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ time from [`crates/diskern-core/rules/base.json`](../crates/diskern-core/rules/b
```json
{
"id": "chrome-cache",
"patterns": ["**/google/chrome/user data/*/cache/**", "**/.cache/google-chrome/**"],
"patterns": ["**/google/chrome/user data/*/cache/**", "**/.cache/google-chrome/**", "**/library/caches/google/chrome/*/cache/**"],
"category": "browser_cache",
"verdict": "safe",
"description": "Chrome browser cache. Fully regenerated on next use."
Expand Down